TeamTalk 5 C-API DLL Version 5.19A

Classes | Macros | Typedefs | Enumerations | Functions
Video Capture and Image Display

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. More...
typedef struct VideoFormat | VideoFormat
| A struct containing the properties of a video capture format. More...
typedef struct VideoFrame | VideoFrame
| A RGB32 image where the pixels can be accessed directly in an allocated frameBuffer. More...
typedef struct VideoCaptureDevice | VideoCaptureDevice
| A struct containing the properties of a video capture device. More...

## 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. More...
TEAMTALKDLL_API TTBOOL | TT_InitVideoCaptureDevice (IN TTInstance *lpTTInstance, IN const TTCHAR *szDeviceID, IN const VideoFormat *lpVideoFormat)
| Initialize a video capture device. More...
TEAMTALKDLL_API TTBOOL | TT_CloseVideoCaptureDevice (IN TTInstance *lpTTInstance)
| Close a video capture device. More...
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). More...
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). More...
TEAMTALKDLL_API VideoFrame * | TT_AcquireUserVideoCaptureFrame (IN TTInstance *lpTTInstance, IN INT32 nUserID)
| Extract a user's video capture frame for display. More...
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. More...

## Detailed Description

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:

- Initialize Video Capture Device
- Display Captured Video

# Initialize Video Capture Device

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.

# Display Captured Video

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.

## Macro Definition Documentation

## ◆ TT_VIDEOFORMATS_MAX

#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.

## Typedef Documentation

## ◆ FourCC

typedef enum FourCC FourCC

The picture format used by a capture device.

See also
  VideoFormat
  VideoCaptureDevice

## ◆ VideoFormat

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.

## ◆ VideoFrame

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.

## ◆ VideoCaptureDevice

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.

See also
  TT_GetVideoCaptureDevices

## Enumeration Type Documentation

## ◆ FourCC

enum FourCC

The picture format used by a capture device.

See also
  VideoFormat
  VideoCaptureDevice

Enumerator
FOURCC_NONE | Internal use to denote no supported formats.
FOURCC_I420 | Prefered image format with the lowest bandwidth usage. A 640x480 pixel image takes up 460.800 bytes.
FOURCC_YUY2 | Image format where a 640x480 pixel images takes up 614.400 bytes.
FOURCC_RGB32 | The image format with the highest bandwidth usage. A 640x480 pixel images takes up 1.228.880 bytes.

Definition at line 818 of file TeamTalk.h.

## Function Documentation

## ◆ TT_GetVideoCaptureDevices()

TEAMTALKDLL_API TTBOOL TT_GetVideoCaptureDevices | ( | IN OUT VideoCaptureDevice * | lpVideoDevices,
|  | IN OUT INT32 * | lpnHowMany
| ) |  |

Get the list of devices available for video capture.

Parameters

  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.

See also
  TT_InitVideoCaptureDevice

## ◆ TT_InitVideoCaptureDevice()

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()

Parameters

  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.

See also
  TT_GetVideoCaptureDevices
  TT_CloseVideoCaptureDevice

## ◆ TT_CloseVideoCaptureDevice()

TEAMTALKDLL_API TTBOOL TT_CloseVideoCaptureDevice | ( | IN TTInstance * | lpTTInstance | ) |

Close a video capture device.

See also
  TT_InitVideoCaptureDevice

## ◆ TT_PaintVideoFrame()

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.

## ◆ TT_PaintVideoFrameEx()

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);

Parameters

  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()

See also
  TT_AcquireUserVideoCaptureFrame

## ◆ 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.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  nUserID | The user's ID. 0 for local user.

Returns
  Returns video frame which will contain the image data. Note that it's the frameBuffer member of VideoFrame which will contain the image data allocated internally by TeamTalk. Returns NULL if no video frame could be acquired.

See also
  TT_ReleaseUserVideoCaptureFrame

## ◆ TT_ReleaseUserVideoCaptureFrame()

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.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  lpVideoFrame | Pointer to VideoFrame which should be deallocated.

Returns
  Returns TRUE If a video frame was successfully deallocated.

See also
  TT_AcquireUserVideoCaptureFrame