TeamTalk 5 C-API DLL Version 5.15A
|
This section explains how to initialize a video device and display captured images on the user's display. More...
Classes | |
struct | VideoFormat |
A struct containing the properties of a video capture format. More... | |
struct | VideoFrame |
A RGB32 image where the pixels can be accessed directly in an allocated frameBuffer. More... | |
struct | VideoCaptureDevice |
A struct containing the properties of a video capture device. More... | |
Macros | |
#define | TT_VIDEOFORMATS_MAX 1024 |
Typedefs | |
typedef enum FourCC | FourCC |
The picture format used by a capture device. | |
typedef struct VideoFormat | VideoFormat |
A struct containing the properties of a video capture format. | |
typedef struct VideoFrame | VideoFrame |
A RGB32 image where the pixels can be accessed directly in an allocated frameBuffer. | |
typedef struct VideoCaptureDevice | VideoCaptureDevice |
A struct containing the properties of a video capture device. | |
Enumerations | |
enum | FourCC { FOURCC_NONE = 0 , FOURCC_I420 = 100 , FOURCC_YUY2 = 101 , FOURCC_RGB32 = 102 } |
The picture format used by a capture device. More... | |
Functions | |
TEAMTALKDLL_API TTBOOL | TT_GetVideoCaptureDevices (IN OUT VideoCaptureDevice *lpVideoDevices, IN OUT INT32 *lpnHowMany) |
Get the list of devices available for video capture. | |
TEAMTALKDLL_API TTBOOL | TT_InitVideoCaptureDevice (IN TTInstance *lpTTInstance, IN const TTCHAR *szDeviceID, IN const VideoFormat *lpVideoFormat) |
Initialize a video capture device. | |
TEAMTALKDLL_API TTBOOL | TT_CloseVideoCaptureDevice (IN TTInstance *lpTTInstance) |
Close a video capture device. | |
TEAMTALKDLL_API TTBOOL | TT_PaintVideoFrame (IN HDC hDC, IN INT32 XDest, IN INT32 YDest, IN INT32 nDestWidth, IN INT32 nDestHeight, IN VideoFrame *lpVideoFrame) |
Paint user's video frame using a Windows' DC (device context). | |
TEAMTALKDLL_API TTBOOL | TT_PaintVideoFrameEx (IN HDC hDC, IN INT32 XDest, IN INT32 YDest, IN INT32 nDestWidth, IN INT32 nDestHeight, IN INT32 XSrc, IN INT32 YSrc, IN INT32 nSrcWidth, IN INT32 nSrcHeight, IN VideoFrame *lpVideoFrame) |
Paint user's video frame using a Windows' DC (device context). | |
TEAMTALKDLL_API VideoFrame * | TT_AcquireUserVideoCaptureFrame (IN TTInstance *lpTTInstance, IN INT32 nUserID) |
Extract a user's video capture frame for display. | |
TEAMTALKDLL_API TTBOOL | TT_ReleaseUserVideoCaptureFrame (IN TTInstance *lpTTInstance, IN VideoFrame *lpVideoFrame) |
Delete a user's video frame, acquired through TT_AcquireUserVideoCaptureFrame(), so its allocated resources can be released. | |
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.
Sections:
This section explains how to detect and configure video capture devices.
To capture video the user application must first query the available capture devices by calling TT_GetVideoCaptureDevices. A VideoCaptureDevice supports a certain number of capture formats each described in the videoFormats member of VideoFormat.
Once a device has been chosen the TT_InitVideoCaptureDevice must be called for the client instance to start capturing video frames. Use the szDevice member of VideoCaptureDevice as the device identifier for the video capture device and pass a VideoFormat from the videoFormats array of VideoCaptureDevice. Check out section Audio and Video Codecs on how to configure the video codec.
When a video frame becomes available the event CLIENTEVENT_USER_VIDEOCAPTURE is posted to the application and TT_AcquireUserVideoCaptureFrame can be used to extract the RGB32 image. On Windows it's also possible to call TT_PaintVideoFrame to make the client instance paint on a HWND by getting its HDC, otherwise use the VideoFrame's frame buffer pointer to access the bitmap data.
#define TT_VIDEOFORMATS_MAX 1024 |
The maximum number of video formats which will be queried for a VideoCaptureDevice.
Definition at line 101 of file TeamTalk.h.
The picture format used by a capture device.
typedef struct VideoFormat VideoFormat |
A struct containing the properties of a video capture format.
A struct for holding a supported video capture format by a VideoCaptureDevice.
typedef struct VideoFrame VideoFrame |
A RGB32 image where the pixels can be accessed directly in an allocated frameBuffer.
Use TT_AcquireUserVideoCaptureFrame() to acquire a user's image and remember to call TT_ReleaseUserVideoCaptureFrame() when the image has been processed so TeamTalk can release its resources.
typedef struct VideoCaptureDevice VideoCaptureDevice |
A struct containing the properties of a video capture device.
The information retrieved from the video capture device is used to initialize the video capture device using the TT_InitVideoCaptureDevice function.
enum FourCC |
The picture format used by a capture device.
Definition at line 818 of file TeamTalk.h.
TEAMTALKDLL_API TTBOOL TT_GetVideoCaptureDevices | ( | IN OUT VideoCaptureDevice * | lpVideoDevices, |
IN OUT INT32 * | lpnHowMany | ||
) |
Get the list of devices available for video capture.
lpVideoDevices | Array of VideoCaptureDevice-stucts where lpnHowMany hold the size of the array. Pass NULL to query the number of devices. |
lpnHowMany | This is both an input and output parameter. If lpVideoDevices is NULL lpnHowMany will after the call hold the number of devices, otherwise it should hold the size of the lpVideoDevices array. |
TEAMTALKDLL_API TTBOOL TT_InitVideoCaptureDevice | ( | IN TTInstance * | lpTTInstance, |
IN const TTCHAR * | szDeviceID, | ||
IN const VideoFormat * | lpVideoFormat | ||
) |
Initialize a video capture device.
To transmit video capture data to a channel call TT_StartVideoCaptureTransmission()
lpTTInstance | Pointer to client instance created by TT_InitTeamTalk. |
szDeviceID | The device idenfier szDeviceID of VideoCaptureDevice. |
lpVideoFormat | The capture format to use, i.e. frame-rate, resolution and picture format. |
TEAMTALKDLL_API TTBOOL TT_CloseVideoCaptureDevice | ( | IN TTInstance * | lpTTInstance | ) |
Close a video capture device.
TEAMTALKDLL_API TTBOOL TT_PaintVideoFrame | ( | IN HDC | hDC, |
IN INT32 | XDest, | ||
IN INT32 | YDest, | ||
IN INT32 | nDestWidth, | ||
IN INT32 | nDestHeight, | ||
IN VideoFrame * | lpVideoFrame | ||
) |
Paint user's video frame using a Windows' DC (device context).
Same as calling TT_PaintVideoFrameEx() like this:
TT_PaintVideoFrameEx(lpTTInstance, 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.
TEAMTALKDLL_API TTBOOL TT_PaintVideoFrameEx | ( | IN HDC | hDC, |
IN INT32 | XDest, | ||
IN INT32 | YDest, | ||
IN INT32 | nDestWidth, | ||
IN INT32 | nDestHeight, | ||
IN INT32 | XSrc, | ||
IN INT32 | YSrc, | ||
IN INT32 | nSrcWidth, | ||
IN INT32 | nSrcHeight, | ||
IN VideoFrame * | lpVideoFrame | ||
) |
Paint user's video frame using a Windows' DC (device context).
An application can either paint using TT_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:
StretchDIBits(hDC, nPosX, nPosY, nWidth, nHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, frame_buf, &bmi, DIB_RGB_COLORS, SRCCOPY);
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. |
lpVideoFrame | Video frame retrieved by TT_AcquireUserVideoCaptureFrame() |
TEAMTALKDLL_API VideoFrame * TT_AcquireUserVideoCaptureFrame | ( | IN TTInstance * | lpTTInstance, |
IN INT32 | nUserID | ||
) |
Extract a user's video capture frame for display.
The VideoFrame extracted from the client instance will contain a pointer to the image's frame buffer, so a RGB32 bitmap can be displayed in a window control.
To release the acquired VideoFrame call TT_ReleaseUserVideoCaptureFrame().
A video capture frame comes from a user's STREAMTYPE_VIDEOCAPTURE.
lpTTInstance | Pointer to client instance created by TT_InitTeamTalk. |
nUserID | The user's ID. 0 for local user. |
TEAMTALKDLL_API TTBOOL TT_ReleaseUserVideoCaptureFrame | ( | IN TTInstance * | lpTTInstance, |
IN VideoFrame * | lpVideoFrame | ||
) |
Delete a user's video frame, acquired through TT_AcquireUserVideoCaptureFrame(), so its allocated resources can be released.
lpTTInstance | Pointer to client instance created by TT_InitTeamTalk. |
lpVideoFrame | Pointer to VideoFrame which should be deallocated. |