/** @brief Delete a user's video frame, acquired through * TeamTalk.AcquireUserVideoCaptureFrame(), so its allocated resources can be * released. * * @param lpVideoFrame Pointer to #BearWare.VideoFrame which should be deallocated. * @return Returns TRUE If a video frame was successfully deallocated. * @see TeamTalk.AcquireUserVideoCaptureFrame() */ public bool ReleaseUserVideoCaptureFrame(VideoFrame lpVideoFrame) { IntPtr ptr; if (vidcapframes.TryGetValue(lpVideoFrame.frameBuffer, out ptr)) { vidcapframes.Remove(lpVideoFrame.frameBuffer); return TTDLL.TT_ReleaseUserVideoCaptureFrame(m_ttInst, ptr); } return false; }
/** * @brief Paint user's video frame using a Windows' DC (device * context). * * An application can either paint using TeamTalk.AcquireUserVideoCaptureFrame() * which provides a raw RGB32 array of the image or the * application can ask the client instance to paint the image * using this function. * * Typically this paint operation will be called in the WM_PAINT * message. Here is how the client instance paints internally: * @verbatim StretchDIBits(hDC, nPosX, nPosY, nWidth, nHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, frame_buf, &bmi, DIB_RGB_COLORS, SRCCOPY); @endverbatim * * @param nUserID The user's ID. 0 for local user. * @param hDC The handle to the Windows device context. * @param XDest Coordinate of left corner where to start painting. * @param YDest Coordinate or top corner where to start painting. * @param nDestWidth The width of the image. * @param nDestHeight The height of the image. * @param XSrc The left coordinate in the source bitmap of where * to start reading. * @param YSrc The top left coordinate in the source bitmap of where * to start reading. * @param nSrcWidth The number of width pixels to read from source bitmap. * @param nSrcHeight The number of height pixels to read from source bitmap. * @param lpVideoFrame Video frame retrieved by TeamTalk.AcquireUserVideoCaptureFrame() */ public bool PaintVideoFrameEx(int nUserID, System.IntPtr hDC, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, ref VideoFrame lpVideoFrame) { return TTDLL.TT_PaintVideoFrameEx(nUserID, hDC, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, ref lpVideoFrame); }
/** @brief Delete a user's video frame, acquired through * TeamTalk.AcquireUserMediaVideoFrame(), so its allocated resources can * be released. * * @param lpVideoFrame Pointer to #BearWare.VideoFrame which should be deallocated. * @return Returns TRUE if a video frame was successfully deallocated. * @see AcquireUserMediaVideoFrame() */ public bool ReleaseUserMediaVideoFrame(VideoFrame lpVideoFrame) { IntPtr ptr; if (mediaframes.TryGetValue(lpVideoFrame.frameBuffer, out ptr)) { mediaframes.Remove(lpVideoFrame.frameBuffer); return TTDLL.TT_ReleaseUserMediaVideoFrame(m_ttInst, ptr); } return false; }
void ttclient_OnUserVideoFrame(int nUserID, int nStreamID) { if (userid != nUserID) return; if (bmp != null) bmp.Dispose(); bmp = null; //Release shared memory ttclient.ReleaseUserVideoCaptureFrame(vidframe); vidframe = ttclient.AcquireUserVideoCaptureFrame(nUserID, out bmp); Invalidate(); }