MFCreateWaveFormatExFromMFMediaType

Converts a Media Foundation audio media type to a WAVEFORMATEX structure.

Syntax

HRESULT MFCreateWaveFormatExFromMFMediaType(
         IMFMediaType *pMFType,
         WAVEFORMATEX **ppWF,
         UINT32 *pcbSize,
         UINT32 Flags
)  

Parameters

pMFType
Type: IMFMediaType *

[in]

Pointer to the IMFMediaType interface of the media type.

ppWF
Type: WAVEFORMATEX **

[out]

Receives a pointer to the WAVEFORMATEX structure. The caller must release the memory allocated for the structure by calling CoTaskMemFree.

pcbSize
Type: UINT32 *

[out, optional]

Receives the size of the WAVEFORMATEX structure.

Flags
Type: UINT32 

[in]

Contains a flag from the MFWaveFormatExConvertFlags enumeration.

Return value

Type: HRESULT 

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

Return codes
Return code Description
S_OK The function succeeded.

Refer to Media Foundation return codes.

Remarks

If the wFormatTag member of the returned structure is WAVE_FORMAT_EXTENSIBLE, you can cast the pointer to a WAVEFORMATEXTENSIBLE structure.

Requirements

Header: Declared in mfapi.h.

Library: Use mfplat.lib.