Obtaining and Setting the Video Format

The BITMAPINFO structure is of variable length to accommodate standard and compressed data formats. Because this structure is of variable length, applications must always query the size of the structure and allocate memory before retrieving the current video format. The following example uses the capGetVideoFormatSize macro to retrieve the buffer size and then calls the capGetVideoFormat macro to retrieve the current video format.

LPBITMAPINFO lpbi;
DWORD dwSize;

dwSize = capGetVideoFormatSize(hWndC);
lpbi = GlobalAllocPtr (GHND, dwSize);
capGetVideoFormat(hWndC, lpbi, dwSize); 

// Access the video format and then free the allocated memory.
 

Applications can use the capSetVideoFormat macro (or the WM_CAP_SET_VIDEOFORMAT message) to send a BITMAPINFO header structure to the capture window. Because video formats are device specific, your application should check the return value to determine if the format was accepted.

Using Video Capture