TeamTalk 4 .NET DLL
Version 4.5A
|
This section explains how to initialize a video device and display captured images on the user's display. More...
Classes | |
struct | BearWare.CaptureFormat |
A struct containing the properties of a video capture format. More... | |
struct | BearWare.VideoFrame |
A RGB32 image where the pixels can be accessed directly in an allocated imageBuffer. More... | |
struct | BearWare.VideoCaptureDevice |
A struct containing the properties of a video capture device. More... | |
struct | BearWare.MediaFileInfo |
Struct describing the audio and video format used by a media file. More... | |
Enumerations | |
enum | BearWare.FourCC : uint { BearWare.FOURCC_NONE = 0, BearWare.FOURCC_I420 = 100, BearWare.FOURCC_YUY2 = 101, BearWare.FOURCC_RGB32 = 102 } |
The picture format used by a capture device. More... | |
Functions | |
bool | BearWare.TeamTalk4.GetVideoCaptureDevices (out VideoCaptureDevice[] lpVideoDevices) |
Get the list of devices available for video capture. More... | |
bool | BearWare.TeamTalk4.InitVideoCaptureDevice (string szDeviceID, CaptureFormat lpCaptureFormat, VideoCodec lpVideoCodec) |
Initialize a video capture device. More... | |
bool | BearWare.TeamTalk4.CloseVideoCaptureDevice () |
Close a video capture device. More... | |
bool | BearWare.TeamTalk4.PaintVideoFrame (int nUserID, System.IntPtr hDC, int XDest, int YDest, int nDestWidth, int nDestHeight) |
Paint user's video frame using a Windows' DC (device context). More... | |
bool | BearWare.TeamTalk4.PaintVideoFrameEx (int nUserID, System.IntPtr hDC, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight) |
Paint user's video frame using a Windows' DC (device context). More... | |
bool | BearWare.TeamTalk4.GetUserVideoFrame (int nUserID, ref System.Drawing.Bitmap lpPicture) |
Get or query the raw RGB32 bitmap data of a user's video frame. More... | |
bool | BearWare.TeamTalk4.AcquireUserVideoFrame (int nUserID, ref VideoFrame lpVideoFrame) |
Extract a user's video frame by making TeamTalk allocate the image buffer. More... | |
bool | BearWare.TeamTalk4.ReleaseUserVideoFrame (int nUserID) |
Delete a user's video frame, acquired through TeamTalk4.AcquireUserVideoFrame(), so its allocated resources can be released. More... | |
Variables | |
const int | BearWare.TeamTalk4.TT_CAPTUREFORMATS_MAX = 128 |
This section explains how to initialize a video device and display captured images on the user's display.
The client is able to capture video and present them to the user application in RGB32-format and transmit the image in encoded format to other users.
To capture video the user application must first query the available capture devices by calling TeamTalk4.GetVideoCaptureDevices(). A BearWare.VideoCaptureDevice supports a certain number of capture formats each described in the captureFormats member of BearWare.CaptureFormat.
Once a device has been chosen the TeamTalk4.InitVideoCaptureDevice() must be called for the client instance to start capturing video frames. Use the szDevice member of BearWare.VideoCaptureDevice as the device identifier for the video capture device and pass a BearWare.CaptureFormat from the captureFormats array of BearWare.VideoCaptureDevice. The lpVideoCodec parameter of TeamTalk4.InitVideoCaptureDevice() can be passed as NULL if the captured video frames do not need to be transmitted. Check out section Audio and Video Codecs on how to configure the video codec.
When a video frame becomes available the event TeamTalk4.OnUserVideoFrame() is posted to the application and TeamTalk4.GetUserVideoFrame() can be used to extract the RGB32 image. On Windows it's also possible to call TeamTalk4.PaintVideoFrame() to make the client instance paint on a HWND
by getting its HDC.
enum BearWare.FourCC : uint |
The picture format used by a capture device.
bool BearWare.TeamTalk4.GetVideoCaptureDevices | ( | out VideoCaptureDevice[] | lpVideoDevices | ) |
Get the list of devices available for video capture.
lpVideoDevices | An output array of BearWare.VideoCaptureDevice-stucts which will receive the available video capture devices |
bool BearWare.TeamTalk4.InitVideoCaptureDevice | ( | string | szDeviceID, |
CaptureFormat | lpCaptureFormat, | ||
VideoCodec | lpVideoCodec | ||
) |
Initialize a video capture device.
szDeviceID | The device idenfier szDeviceID of BearWare.VideoCaptureDevice. |
lpCaptureFormat | The capture format to use, i.e. frame-rate, resolution and picture format. |
lpVideoCodec | Video codec to use for transmission. Use NULL or set nCodec of BearWare.VideoCodec to Codec NO_CODEC if capture device should only be used for testing locally. |
bool BearWare.TeamTalk4.CloseVideoCaptureDevice | ( | ) |
Close a video capture device.
bool BearWare.TeamTalk4.PaintVideoFrame | ( | int | nUserID, |
System.IntPtr | hDC, | ||
int | XDest, | ||
int | YDest, | ||
int | nDestWidth, | ||
int | nDestHeight | ||
) |
Paint user's video frame using a Windows' DC (device context).
Same as calling TeamTalk4.PaintVideoFrameEx() like this:
ttclient.PaintVideoFrameEx(nUserID, hDC, XDest, YDest, nDestWidth, nDestHeight, 0, 0, src_bmp_width, src_bmp_height);
src_bmp_width
and src_bmp_height
are extracted internally from the source image.
bool BearWare.TeamTalk4.PaintVideoFrameEx | ( | int | nUserID, |
System.IntPtr | hDC, | ||
int | XDest, | ||
int | YDest, | ||
int | nDestWidth, | ||
int | nDestHeight, | ||
int | XSrc, | ||
int | YSrc, | ||
int | nSrcWidth, | ||
int | nSrcHeight | ||
) |
Paint user's video frame using a Windows' DC (device context).
An application can either paint using TeamTalk4.GetUserVideoFrame() 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:
StretchDIBits(hDC, nPosX, nPosY, nWidth, nHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, frame_buf, &bmi, DIB_RGB_COLORS, SRCCOPY);
nUserID | The user's ID. 0 for local user. |
hDC | The handle to the Windows device context. |
XDest | Coordinate of left corner where to start painting. |
YDest | Coordinate or top corner where to start painting. |
nDestWidth | The width of the image. |
nDestHeight | The height of the image. |
XSrc | The left coordinate in the source bitmap of where to start reading. |
YSrc | The top left coordinate in the source bitmap of where to start reading. |
nSrcWidth | The number of width pixels to read from source bitmap. |
nSrcHeight | The number of height pixels to read from source bitmap. |
bool BearWare.TeamTalk4.GetUserVideoFrame | ( | int | nUserID, |
ref System.Drawing.Bitmap | lpPicture | ||
) |
Get or query the raw RGB32 bitmap data of a user's video frame.
nUserID | The user's ID. 0 for local client instance. |
lpPicture | Reference to a bitmap which will receive the video frame. If the lpPicture reference is null or not the proper size a new Bitmap object will be allocated and returned instead. Ensure to ALWAYS call with the same lpPicture reference for each nUserID, otherwise a new Bitmap object will be allocated each time and cause the application to use a significant amount of memory. |
bool BearWare.TeamTalk4.AcquireUserVideoFrame | ( | int | nUserID, |
ref VideoFrame | lpVideoFrame | ||
) |
Extract a user's video frame by making TeamTalk allocate the image buffer.
Unlike TeamTalk4.GetUserVideoFrame() this function does not require that the user preallocates a buffer which will contain the image data. Instead the image buffer is allocated in internally. REMEMBER, however, to call TeamTalk4.ReleaseUserVideoFrame() when the image has been processed so the resources allocated by TeamTalk can be released.
nUserID | The user's ID. 0 for local user. |
lpVideoFrame | The struct which will contain the image data. Note that it's the frameBuffer member of BearWare.VideoFrame which will contain the image data allocated internally by TeamTalk. |
bool BearWare.TeamTalk4.ReleaseUserVideoFrame | ( | int | nUserID | ) |
Delete a user's video frame, acquired through TeamTalk4.AcquireUserVideoFrame(), so its allocated resources can be released.
nUserID | The user's ID. 0 for local user. |
const int BearWare.TeamTalk4.TT_CAPTUREFORMATS_MAX = 128 |
The maximum number of video formats which will be queried for a BearWare.VideoCaptureDevice.