Video and Image Functions

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

These functions and macros manipulate the DirectShow video format structures.

Function Description
BIT_MASKS_MATCH Compares the color masks for two VIDEOINFO structures.
BITMASKS Retrieves the color masks from a VIDEOINFO structure
CheckVideoInfoType Checks a media type that contains a VIDEOINFOHEADER format structure for errors that can cause buffer overruns or integer overflows.
CheckVideoInfo2Type Checks a media type that contains a VIDEOINFOHEADER2 format structure for errors that can cause buffer overruns or integer overflows.
COLORS Retrieves the palette entries from a VIDEOINFO structure
ContainsPalette Determines whether a specified VIDEOINFOHEADER structure contains a palette.
ConvertVideoInfoToVideoInfo2 Converts a media type that uses VIDEOINFOHEADER to one that uses VIDEOINFOHEADER2
DIBSIZE Calculates the number of bytes required by a device-independent bitmap (DIB).
GetBitCount Returns the number of bits per pixel used by a specified video subtype.
GetBitmapFormatSize Calculates the size needed for a VIDEOINFO structure that can hold a specified BITMAPINFOHEADER structure.
GetBitmapPalette Returns the first palette entry in a VIDEOINFOHEADER structure.
GetBitmapSize Calculates the number of bytes required by a device-independent bitmap (DIB).
GetBitmapSubtype Returns the media subtype GUID for the specified bitmap.
GetSubtypeName Retrieves the human-readable name of a video subtype.
GetTrueColorType Returns the media subtype GUID for a 16-bit uncompressed RGB bitmap.
HEADER Returns the address of the BITMAPINFOHEADER within a VIDEOINFOHEADER.
MPEG1_SEQUENCE_INFO Returns the address of the sequence header inside an MPEG1VIDEOINFO structure.
PALETTISED Checks whether a bitmap has a color depth of 8 bits or less.
PALETTE_ENTRIES Retrieves the maximum number of colors in the palette of a specified bitmap.
RESET_MASKS Fills the color mask fields in a VIDEOINFO structure with zeroes.
RESET_HEADER Fills a VIDEOINFOHEADER with zeroes.
RESET_PALETTE Fills the palette entries in a VIDEOINFO structure with zeroes.
SIZE_EGA_PALETTE Calculates the size needed for the palette entries in a 4-bit RGB bitmap.
SIZE_MASKS Calculates the size of the color masks in a VIDEOINFO structure.
SIZE_MPEG1VIDEOINFO Calculates the size of an MPEG1VIDEOINFO structure, including the sequence header.
SIZE_PALETTE calculates the size of the palette entries in a VIDEOINFO structure.
SIZE_PREHEADER Calculates the byte offset of the bmiHeader field within a VIDEOINFOHEADER structure.
SIZE_VIDEOHEADER Calculates the size of the VIDEOINFOHEADER structure.
TRUECOLOR Returns the TRUECOLORINFO structure from a VIDEOINFO structure.
ValidateBitmapInfoHeader Checks a BITMAPINFOHEADER structure for errors that can cause buffer overruns or integer overflows.

 

Remarks

Most of the macros and functions described in the section are designed for manipulating VIDEOINFOHEADER and VIDEOINFO structures for RGB bitmaps. Use these macros with care: Most of them assume that the specified structure has been initialized properly. Many of them also assume that the BITMAPINFOHEADER structure is the standard size; that is, biSize == sizeof(BITMAPINFOHEADER).

The DirectShow base class library also provide the following global constants, which define the standard color masks for true-color bitmaps.

Global Data Description
bits555 Array of color masks for a 16-bit RGB bitmap in 5-5-5 format.
bits565 Array of color masks for a 16-bit RGB bitmap in 5-6-5 format.
bits888 Array of color masks for a 24-bit RGB bitmap.

 

Each of these constants in an array of three DWORDs, containing the red, green, and blue masks, in that order.