Setting the Video Data Format

Developers of video capture clients expect video capture data to be stored as device independent bitmaps (DIBs). DIB contents are described by BITMAPINFO and BITMAPINFOHEADER structures, which are discussed in the Win32 SDK. A client can specify a data format, or query the driver for the current format, by sending the driver a DVM_FORMAT message and including the address of a BITMAPINFOHEADER structure.

You can also allow users to modify the format. Typically, you include format options in the dialog boxes associated with VIDEO_IN and VIDEO_OUT channels, and your driver displays these dialog boxes when it receives DVM_DIALOG messages. For more information, see Configuring Video Channels.

The sample video capture drivers do not support DVM_FORMAT for the VIDEO_OUT channel, because the VIDEO_OUT channel is handled by Video Compression Manager drivers.

Your driver should provide default values for all format variables. These default values should represent a format that can be handled most efficiently by the video capture hardware. The driver should use the default values if client-specified (via DVM_FORMAT) or user-specified (via DVM_DIALOG) values are not available.

Following is a typical scenario in which a client modifies the format because of limited system storage space:

  1. Prior to opening an input stream, a client sends a DVM_FORMAT message, with the VIDEO_CONFIGURE_GET flag set, to determine the current format.

  2. The client calculates the amount of storage needed to store a captured video stream if the current format is used.

  3. The client attempts to allocate enough storage to save the stream. The allocation fails because there is not enough storage space available.

  4. The client sends a DVM_FORMAT message to change the format to one that requires less storage space.

  5. The client again attempts to allocate enough storage to save the stream. This time the allocation succeeds.

  6. The client opens the stream and saves the input data. (For details, see Transferring Video Capture Data.)