获取和设置视频格式

BITMAPINFO 结构长度可变,以适应标准和压缩的数据格式。 由于此结构长度可变,因此应用程序在检索当前视频格式之前必须始终查询结构的大小并分配内存。 以下示例使用 capGetVideoFormatSize 宏检索缓冲区大小,然后调用 capGetVideoFormat 宏来检索当前视频格式。

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.
 

应用程序可以使用 capSetVideoFormat 宏 (或 WM_CAP_SET_VIDEOFORMAT 消息) 将 BITMAPINFO 标头结构发送到捕获窗口。 由于视频格式特定于设备,因此应用程序应检查返回值,以确定格式是否被接受。

使用视频捕获