MFCreateDXSurfaceBuffer function

Creates a media buffer object that manages a Direct3D 9 surface.


HRESULT MFCreateDXSurfaceBuffer(
  REFIID         riid,
  IUnknown       *punkSurface,
  BOOL           fBottomUpWhenLinear,
  IMFMediaBuffer **ppBuffer



Identifies the type of Direct3D 9 surface. Currently this value must be IID_IDirect3DSurface9.


A pointer to the IUnknown interface of the DirectX surface.


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.


Receives a pointer to the IMFMediaBuffer interface. The caller must release the buffer.

Return Value

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

Return code Description
The method succeeded.
Invalid argument.


This function creates a media buffer object that holds a pointer to the Direct3D surface specified in punkSurface. Locking the buffer gives the caller access to the surface memory. When the buffer object is destroyed, it releases the surface. For more information about media buffers, see Media Buffers.

Note  This function does not allocate the Direct3D surface itself.
The buffer object created by this function also exposes the IMF2DBuffer interface. For more information, see DirectX Surface Buffer.

This function does not support DXGI surfaces.


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

See Also

DirectX Surface Buffer

Media Buffers

Media Foundation Functions