MFCalculateBitmapImageSize function (mfapi.h)

Retrieves the image size for a video format. Given a BITMAPINFOHEADER structure, this function calculates the correct value of the biSizeImage member.

Syntax

HRESULT MFCalculateBitmapImageSize(
  [in]  const BITMAPINFOHEADER *pBMIH,
  [in]  UINT32                 cbBufSize,
  [out] UINT32                 *pcbImageSize,
  [out] BOOL                   *pbKnown
);

Parameters

[in] pBMIH

Pointer to a BITMAPINFOHEADER structure that describes the format.

[in] cbBufSize

Size of the pBMIH buffer, in bytes. The size includes any color masks or palette entries that follow the BITMAPINFOHEADER structure.

[out] pcbImageSize

Receives the image size, in bytes.

[out] pbKnown

Receives the value TRUE if the function recognizes the video format. Otherwise, receives the value FALSE. This parameter can be NULL.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The function succeeded.
E_INVALIDARG
The BITMAPINFOHEADER structure is not valid, or the value of cbBufSize is too small.

Remarks

Before calling this function, you must set at least the following members of the BITMAPINFOHEADER structure:

  • biCompression
  • biBitCount
  • biWidth
  • biHeight
Also, if biCompression is BI_BITFIELDS, the BITMAPINFOHEADER structure must be followed by an array of color masks.

This function fails if the BITMAPINFOHEADER structure describes a format that is not a video format. For example, it fails if biCompresson is BI_JPEG or BI_PNG .

This function is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header mfapi.h
Library Mfplat.lib
DLL Mfplat.dll

See also

Media Foundation Functions