TeamTalk 5 .NET DLL Version 5.12A
Video Capture and Image Display

This section explains how to detect and configure video capture devices. More...

Classes

struct  BearWare.VideoFormat
 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...
 

Enumerations

enum  BearWare.FourCC : uint { BearWare.FourCC.FOURCC_NONE = 0 , BearWare.FourCC.FOURCC_I420 = 100 , BearWare.FourCC.FOURCC_YUY2 = 101 , BearWare.FourCC.FOURCC_RGB32 = 102 }
 The picture format used by a capture device. More...
 

Functions

static bool BearWare.TeamTalkBase.GetVideoCaptureDevices (out VideoCaptureDevice[] lpVideoDevices)
 Get the list of devices available for video capture. More...
 
bool BearWare.TeamTalkBase.InitVideoCaptureDevice (string szDeviceID, VideoFormat lpVideoFormat)
 Initialize a video capture device. More...
 
bool BearWare.TeamTalkBase.CloseVideoCaptureDevice ()
 Close a video capture device. More...
 
bool BearWare.TeamTalkBase.PaintVideoFrame (int nUserID, System.IntPtr hDC, int XDest, int YDest, int nDestWidth, int nDestHeight, ref VideoFrame lpVideoFrame)
 Paint user's video frame using a Windows' DC (device context). More...
 
bool BearWare.TeamTalkBase.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)
 Paint user's video frame using a Windows' DC (device context). More...
 
VideoFrame BearWare.TeamTalkBase.AcquireUserVideoCaptureFrame (int nUserID, out Bitmap bmp)
 Extract a user's video frame for display. More...
 
bool BearWare.TeamTalkBase.ReleaseUserVideoCaptureFrame (VideoFrame lpVideoFrame)
 Delete a user's video frame, acquired through TeamTalkBase.AcquireUserVideoCaptureFrame(), so its allocated resources can be released. More...
 

Variables

const int BearWare.TeamTalkBase.TT_VIDEOFORMATS_MAX = 1024
 

Detailed Description

This section explains how to detect and configure video capture devices.

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

To capture video the user application must first query the available capture devices by calling TeamTalkBase.GetVideoCaptureDevices(). A BearWare.VideoCaptureDevice supports a certain number of capture formats each described in the videoFormats member of BearWare.VideoFormat.

Once a device has been chosen the TeamTalkBase.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.VideoFormat from the videoFormats array of BearWare.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 TeamTalkBase.OnUserVideoCapture() is posted to the application and TeamTalkBase.GetUserVideoFrame() can be used to extract the RGB32 image. On Windows it's also possible to call TeamTalkBase.PaintVideoFrame() to make the client instance paint on a HWND by getting its HDC.

Enumeration Type Documentation

◆ FourCC

enum BearWare.FourCC : uint

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 596 of file TeamTalk.cs.

Function Documentation

◆ GetVideoCaptureDevices()

static bool BearWare.TeamTalkBase.GetVideoCaptureDevices ( out VideoCaptureDevice[]  lpVideoDevices)
static

Get the list of devices available for video capture.

Parameters
lpVideoDevicesAn output array of BearWare.VideoCaptureDevice-stucts which will receive the available video capture devices
See also
TeamTalkBase.InitVideoCaptureDevice

Definition at line 5695 of file TeamTalk.cs.

◆ InitVideoCaptureDevice()

bool BearWare.TeamTalkBase.InitVideoCaptureDevice ( string  szDeviceID,
VideoFormat  lpVideoFormat 
)

Initialize a video capture device.

To transmit video capture data to a channel call TeamTalkBase.StartVideoCaptureTransmission()

Parameters
szDeviceIDThe device idenfier szDeviceID of BearWare.VideoCaptureDevice.
lpVideoFormatThe capture format to use, i.e. frame-rate, resolution and picture format.
See also
TeamTalkBase.GetVideoCaptureDevices
TeamTalkBase.CloseVideoCaptureDevice

Definition at line 5723 of file TeamTalk.cs.

◆ CloseVideoCaptureDevice()

bool BearWare.TeamTalkBase.CloseVideoCaptureDevice ( )

Close a video capture device.

See also
TeamTalkBase.InitVideoCaptureDevice

Definition at line 5732 of file TeamTalk.cs.

◆ PaintVideoFrame()

bool BearWare.TeamTalkBase.PaintVideoFrame ( int  nUserID,
System.IntPtr  hDC,
int  XDest,
int  YDest,
int  nDestWidth,
int  nDestHeight,
ref VideoFrame  lpVideoFrame 
)

Paint user's video frame using a Windows' DC (device context).

Same as calling TeamTalkBase.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.

Definition at line 5750 of file TeamTalk.cs.

◆ PaintVideoFrameEx()

bool BearWare.TeamTalkBase.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 
)

Paint user's video frame using a Windows' DC (device context).

An application can either paint using TeamTalkBase.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
nUserIDThe user's ID. 0 for local user.
hDCThe handle to the Windows device context.
XDestCoordinate of left corner where to start painting.
YDestCoordinate or top corner where to start painting.
nDestWidthThe width of the image.
nDestHeightThe height of the image.
XSrcThe left coordinate in the source bitmap of where to start reading.
YSrcThe top left coordinate in the source bitmap of where to start reading.
nSrcWidthThe number of width pixels to read from source bitmap.
nSrcHeightThe number of height pixels to read from source bitmap.
lpVideoFrameVideo frame retrieved by TeamTalkBase.AcquireUserVideoCaptureFrame()

Definition at line 5793 of file TeamTalk.cs.

◆ AcquireUserVideoCaptureFrame()

VideoFrame BearWare.TeamTalkBase.AcquireUserVideoCaptureFrame ( int  nUserID,
out Bitmap  bmp 
)

Extract a user's video frame for display.

The BearWare.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 BearWare.VideoFrame call TeamTalkBase.ReleaseUserVideoCaptureFrame().

A video capture frame comes from a user's StreamType.STREAMTYPE_VIDEOCAPTURE.

Parameters
nUserIDThe user's ID. 0 for local user.
bmpA bitmap created from the BearWare.VideoFrame's data.
Returns
Returns video frame 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 TeamTalkBase. A BearWare.VideoFrame with all members assigned to 0 will be returned if no video frame is available.
See also
TeamTalkBase.ReleaseUserVideoCaptureFrame()

Definition at line 5828 of file TeamTalk.cs.

◆ ReleaseUserVideoCaptureFrame()

bool BearWare.TeamTalkBase.ReleaseUserVideoCaptureFrame ( VideoFrame  lpVideoFrame)

Delete a user's video frame, acquired through TeamTalkBase.AcquireUserVideoCaptureFrame(), so its allocated resources can be released.

Parameters
lpVideoFramePointer to BearWare.VideoFrame which should be deallocated.
Returns
Returns TRUE If a video frame was successfully deallocated.
See also
TeamTalkBase.AcquireUserVideoCaptureFrame()

Definition at line 5852 of file TeamTalk.cs.

Variable Documentation

◆ TT_VIDEOFORMATS_MAX

const int BearWare.TeamTalkBase.TT_VIDEOFORMATS_MAX = 1024
static

The maximum number of video formats which will be queried for a BearWare.VideoCaptureDevice.

Definition at line 4190 of file TeamTalk.cs.