MFCreate2DMediaBuffer function (mfapi.h)

Creates a system-memory buffer object to hold 2D image data.

Syntax

HRESULT MFCreate2DMediaBuffer(
  [in]  DWORD          dwWidth,
  [in]  DWORD          dwHeight,
  [in]  DWORD          dwFourCC,
  [in]  BOOL           fBottomUp,
  [out] IMFMediaBuffer **ppBuffer
);

Parameters

[in] dwWidth

Width of the image, in pixels.

[in] dwHeight

Height of the image, in pixels.

[in] dwFourCC

A FOURCC code or D3DFORMAT value that specifies the video format. If you have a video subtype GUID, you can use the first DWORD of the subtype.

[in] fBottomUp

If TRUE, the buffer's IMF2DBuffer::ContiguousCopyTo method copies the buffer into a bottom-up format. The bottom-up format is compatible with GDI for uncompressed RGB images. If this parameter is FALSE, the ContiguousCopyTo method copies the buffer into a top-down format, which is compatible with DirectX.

For more information about top-down versus bottom-up images, see Image Stride.

[out] ppBuffer

Receives a pointer to the IMFMediaBuffer interface.

Return value

This function can return one of these values.

Return code Description
S_OK
Success.
MF_E_INVALIDMEDIATYPE
Unrecognized video format.

Remarks

The returned buffer object also exposes the IMF2DBuffer2 interface.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header mfapi.h
Library Mfplat.lib
DLL Mfplat.dll

See also

Media Foundation Functions