Export (0) Print
Expand All
Expand Minimize

MFCreateMediaBufferFromMediaType function

Allocates a system-memory buffer that is optimal for a specified media type.

Syntax


HRESULT MFCreateMediaBufferFromMediaType(
  _In_   IMFMediaType *pMediaType,
  _In_   LONGLONG llDuration,
  _In_   DWORD dwMinLength,
  _In_   DWORD dwMinAlignment,
  _Out_  IMFMediaBuffer **ppBuffer
);

Parameters

pMediaType [in]

A pointer to the IMFMediaType interface of the media type.

llDuration [in]

The sample duration. This value is required for audio formats.

dwMinLength [in]

The minimum size of the buffer, in bytes. The actual buffer size might be larger. Specify zero to allocate the default buffer size for the media type.

dwMinAlignment [in]

The minimum memory alignment for the buffer. Specify zero to use the default memory alignment.

ppBuffer [out]

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

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

For video formats, if the format is recognized, the function creates a 2-D buffer that implements the IMF2DBuffer2 interface. Otherwise it creates a linear buffer. To get the IMF2DBuffer2 interface, call QueryInterface on the pointer returned in ppBuffer. If the QueryInterface method fails, use the IMFMediaBuffer interface to access the buffer memory.

For audio formats, the function allocates a buffer that is large enough to contain llDuration audio samples, or dwMinLength, whichever is larger.

This function always allocates system memory. For Direct3D surfaces, use the MFCreateDXGISurfaceBuffer or MFCreateDXSurfaceBuffer function.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

Mfapi.h

DLL

Mfplat.lib

 

 

Community Additions

ADD
Show:
© 2014 Microsoft