IMFMediaBuffer interface (mfobjects.h)

Represents a block of memory that contains media data. Use this interface to access the data in the buffer.


The IMFMediaBuffer interface inherits from the IUnknown interface. IMFMediaBuffer also has these types of members:


The IMFMediaBuffer interface has these methods.


Retrieves the length of the valid data in the buffer.

Retrieves the allocated size of the buffer.

Gives the caller access to the memory in the buffer, for reading or writing.

Sets the length of the valid data in the buffer.

Unlocks a buffer that was previously locked. Call this method once for every call to IMFMediaBuffer::Lock.


If the buffer contains 2-D image data (such as an uncompressed video frame), you should query the buffer for the IMF2DBuffer interface. The methods on IMF2DBuffer are optimized for 2-D data.

To get a buffer from a media sample, call one of the following IMFSample methods:

To create a new buffer object, use one of the following functions.
Function Description
MFCreateMemoryBuffer Creates a buffer and allocates system memory.
MFCreateMediaBufferWrapper Creates a media buffer that wraps an existing media buffer.
MFCreateDXSurfaceBuffer Creates a buffer that manages a DirectX surface.
MFCreateAlignedMemoryBuffer Creates a buffer and allocates system memory with a specified alignment.

This interface 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.


Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header mfobjects.h (include Mfidl.h)

See also

Media Buffers

Media Foundation Interfaces