Microsoft DirectX 8.0

Video and Image Functions

Declaration: Wxutil.h

The Wxutil.h header file in the Microsoft® DirectShow® base classes provides functions and macros to help convert between VIDEOINFOHEADER and BITMAPINFO structures.

BIT_MASKS_MATCHCompares the masks of two video images.
BITMASKSRetrieves a pointer to the array of bitmasks for the specified VIDEOINFOHEADER structure.
COLORSRetrieves a pointer to an array of RGBQUAD structures that describes the color palette for the specified VIDEOINFOHEADER structure.
ContainsPaletteChecks if the video image contains a color palette.
ConvertVideoInfoToVideoInfo2Converts a VIDEOINFO stream format to a VIDEOINFOHEADER2 format.
DIBSIZECalculates the byte size of the specified bitmap
GetBitCountFinds the number of bits per pixel.
GetBitmapFormatSizeFinds the size (in bytes) needed to build a VIDEOINFOHEADER structure and related data.
GetBitmapPaletteFinds the first palette entry in a VIDEOINFOHEADER structure.
GetBitmapSizeFinds the size (in bytes) needed to hold an image.
GetBitmapSubtypeFinds the GUID subtype for a given bitmap info header structure.
GetSubtypeNameFinds the (debug) name for a given GUID subtype.
GetTrueColorTypeFinds the GUID subtype for a given bitmap header.
HEADERRetrieves a pointer to the image data from the specified video image.
MPEG1_SEQUENCE_INFORetrieves the sequence header for the specified MPEG-1 video image.
PALETTISEDChecks if the video image's color palette is 8-bit or less.
PALETTE_ENTRIESReturns the number of colors in the video image's palette.
RESET_MASKSClears the specified video image's bitmasks.
RESET_HEADERClears the specified video image.
RESET_PALETTEClears the specified video image's color palette.
SIZE_EGA_PALETTECalculates the size of the EGA (4-bit) color palette.
SIZE_MASKSCalculates the size of the mask's color palette.
SIZE_MPEG1VIDEOINFOCalculates the size of the specified MPEG-1 video image.
SIZE_PALETTECalculates the size of the 8-bit color palette.
SIZE_PREHEADERCalculates the byte offset for the video image's bitmap information.
SIZE_VIDEOHEADERCalculates the size of the video image.
TRUECOLORINFORetrieves a pointer to an array of TRUECOLORINFO structures that describes the bitmasks and color palette for the specified VIDEOINFOHEADER structure.

These functions are made available to help manage VIDEOINFOHEADER structures, which are used throughout DirectShow to describe video data streams. Although similar to the BITMAPINFO structure used in Microsoft® Win32® and existing multimedia, VIDEOINFOHEADER also adds some new video-specific fields.

Global dataDescription
bits555 Array of color bitmasks for an RGB 555 bitmap.
bits565 Array of color bitmasks for an RGB 565 bitmap.
bits888 Array of color bitmasks for an RGB 24-bit bitmap.

BIT_MASKS_MATCH

Video and Image Functions

Retrieves the bitmasks for the specified video image.

Syntax

BIT_MASKS_MATCH(
  pbmi1,
  pbmi2
  )

Parameters

pbmi1
Pointer to a Win32 VIDEOINFOHEADER structure that contains the first video image.
pbmi2
Pointer to a Win32 VIDEOINFOHEADER structure that contains the second video image.

Return Value

Returns nonzero if the bitmasks for both video images are identical or zero otherwise.

BITMASKS

Video and Image Functions

Retrieves the bitmasks for the specified video image.

Syntax

BITMASKS(
  pbmi
  )

Parameters

pbmi
Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

Return Value

Returns a pointer to the array of bitmasks for the specified VIDEOINFOHEADER structure.

COLORS

Video and Image Functions

Retrieves the color palette for the specified video image.

Syntax

COLORS(
  pbmi
  )

Parameters

pbmi
Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

Return Value

Returns a pointer to an array of RGBQUAD structures that describes the color palette for the specified VIDEOINFOHEADER structure.

ContainsPalette

Video and Image Functions

Checks if the specified video image contains a color palette.

Syntax

BOOL ContainsPalette(
  const VIDEOINFOHEADER *pVideoInfo
  );

Parameters

pVideoInfo
Pointer to a VIDEOINFOHEADER structure.

Return Value

Returns TRUE if the VIDEOINFOHEADER structure contains a color palette or FALSE otherwise.

ConvertVideoInfoToVideoInfo2

Video and Image Functions

Converts a VIDEOINFO stream format to a VIDEOINFOHEADER2 format.

Syntax

STDAPI ConvertVideoInfoToVideoInfo2(
    AM_MEDIA_TYPE *pmt
    );

Parameters

pmt
[in/out] Pointer to the AM_MEDIA_TYPE enumerated type.

Return Value

Returns an HRESULT value that depends on the implementation of the interface. HRESULT can include one of the following standard constants, or other values not listed.

E_OUTOFMEMORY Operation ran out of memory.
S_OK Success.

Remarks

If successful, this function modifies the formattype member of AM_MEDIA_TYPE to change its registered GUID from a VIDEOINFO type to a VIDEOINFOHEADER2 type.

DIBSIZE

Video and Image Functions

Calculates the byte size of the specified (device-independent) bitmap.

Syntax

DIBSIZE(
  bi
  )

Parameters

bi
A Win32 BITMAPINFOHEADER structure that specifies the source bitmap.

Return Value

Returns the byte size of the bi parameter.

GetBitCount

Video and Image Functions

Finds the number of bits per pixel.

Syntax

WORD GetBitCount(
  const GUID *pSubtype
  );

Parameters

pSubtype
Pointer to a GUID for a given video subtype.

Return Value

Returns the number of bits per pixel for this subtype, or USHRT_MAX if an error occurred.

GetBitmapFormatSize

Video and Image Functions

Finds the size (in bytes) needed to build a VIDEOINFOHEADER structure and related data.

Syntax

LONG GetBitmapFormatSize(
  const BITMAPINFOHEADER *pHeader
  );

Parameters

pHeader
Pointer to a Win32 BITMAPINFOHEADER structure.

Return Value

Returns the number of bytes for the VIDEOINFOHEADER structure described by this BITMAPINFOHEADER, including prefix information, the BITMAPINFOHEADER field, and any other color information on the end.

GetBitmapPalette

Video and Image Functions

Finds the first palette for a VIDEOINFOHEADER structure.

Syntax

const RGBQUAD * GetBitmapPalette(
  const VIDEOINFOHEADER *pVideoInfo
  );

Parameters

pVideoInfo
Pointer to a VIDEOINFOHEADER structure.

Return Value

Returns a pointer to the first entry in a palette.

GetBitmapSize

Video and Image Functions

Finds the number of bytes needed to hold an image.

Syntax

DWORD GetBitmapSize(
  const BITMAPINFOHEADER *pHeader
  );

Parameters

pHeader
Pointer to a Win32 BITMAPINFOHEADER structure.

Return Value

Returns the number of bytes needed to hold an image.

GetBitmapSubtype

Video and Image Functions

Finds the subtype for the specified bitmap.

Syntax

const GUID GetBitmapSubtype(
  const BITMAPINFOHEADER *pHeader
  );

Parameters

pHeader
Pointer to a Win32 BITMAPINFOHEADER structure.

Return Value

Returns the video subtype GUID of the bitmap specified by pHeader, or GUID_NULL if pHeader is NULL.

GetSubtypeName

Video and Image Functions

Retrieves the name for a given GUID subtype.

Syntax

TCHAR * GetSubtypeName(
  const GUID *pSubtype
  );

Parameters

pSubtype
Pointer to a GUID for a given video subtype.

Return Value

Returns the debug name of this GUID, or UNKNOWN if the name is not known.

GetTrueColorType

Video and Image Functions

Finds the subtype for the specified 16-bit color bitmap.

Syntax

const GUID GetTrueColorType(
  const BITMAPINFOHEADER *pHeader
  );

Parameters

pHeader
Pointer to a Win32 BITMAPINFOHEADER structure.

Return Value

Returns the video subtype GUID of the 16-bit color bitmap specified by pHeader, or GUID_NULL if pHeader is NULL.

HEADER

Video and Image Functions

Retrieves a pointer to the image data from the specified video image.

Syntax

HEADER(
  pVideoInfo
  )

Parameters

pVideoInfo
Pointer to the VIDEOINFOHEADER structure that specifies the video image.

Return Value

Returns a pointer to the Win32 BITMAPINFOHEADER structure contained in the VIDEOINFOHEADER structure's bmiHeader data member.

MPEG1_SEQUENCE_INFO

Video and Image Functions

Retrieves the sequence header for the specified MPEG-1 video image.

Syntax

MPEG1_SEQUENCE_INFO(
  pv
  )

Parameters

pv
Pointer to an MPEG1VIDEOINFO structure.

Return Value

Returns the bSequenceHeader data member of the specified MPEG1VIDEOINFO structure.

PALETTISED

Video and Image Functions

Checks if the video image's color palette is 8-bit or less.

Syntax

PALETTISED(
  pbmi
  )

Parameters

pbmi
Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

Return Value

Returns nonzero if the video image's palette contains 256 or fewer colors, or zero otherwise.

PALETTE_ENTRIES

Video and Image Functions

Retrieves the number of colors in the video image's palette.

Syntax

PALETTE_ENTRIES(
  pbmi
  )

Parameters

pbmi
Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

Return Value

Returns the number of colors in the video image's palette.

RESET_MASKS

Clears the specified video image's bitmasks.

Syntax

RESET_MASKS(
  pbmi
  )

Parameters

pbmi
Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

Return Value

No return value.

RESET_HEADER

Video and Image Functions

Clears the specified video image.

Syntax

RESET_HEADER(
  pbmi
  )

Parameters

pbmi
Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

Return Value

No return value.

RESET_PALETTE

Video and Image Functions

Clears the specified video image's color palette.

Syntax

RESET_PALETTE(
  pbmi
  )

Parameters

pbmi
Pointer to the Win32 BITMAPINFOHEADER structure that specifies the video image.

Return Value

No return value.

SIZE_EGA_PALETTE

Video and Image Functions

Calculates the size of a 4-bit color palette.

Syntax

SIZE_EGA_PALETTE

Return Value

Returns the size of a 16-color palette, in bytes.

SIZE_MASKS

Video and Image Functions

Calculates the size of a bitmask's color palette.

Syntax

SIZE_MASKS

Return Value

Returns the size, in bytes, of a bitmap mask's color palette, which has three colors.

SIZE_MPEG1VIDEOINFO

Video and Image Functions

Calculates the size of the specified MPEG-1 video image.

Syntax

SIZE_MPEG1VIDEOINFO(
  pv
  )

Parameters

pv
Pointer to the MPEG1VIDEOINFO structure that specifies the video image.

Return Value

Returns the byte size of the specified MPEG1VIDEOINFO structure.

SIZE_PALETTE

Video and Image Functions

Calculates the size of the 8-bit color palette.

Syntax

SIZE_PALETTE

Return Value

Returns the size of the 256-color palette.

SIZE_PREHEADER

Video and Image Functions

Calculates the byte offset for the video image's bitmap information.

Syntax

SIZE_PREHEADER

Return Value

Returns the byte offset of the VIDEOINFOHEADER structure's bmiHeader data member.

SIZE_VIDEOHEADER

Video and Image Functions

Calculates the size of the video image.

Syntax

SIZE_VIDEOHEADER

Return Value

Returns the combined size of all of the VIDEOINFOHEADER structure's data members.

TRUECOLORINFO

Video and Image Functions

Retrieves the color palette and bitmasks for the specified video image.

Syntax

TRUECOLORINFO(
  pbmi
  )

Parameters

pbmi
Pointer to a Win32 VIDEOINFOHEADER structure that contains the video image.

Return Value

Returns a pointer to an array of TRUECOLORINFO structures that describes the bitmasks and color palette for the specified VIDEOINFOHEADER structure.