MFCreateMediaTypeFromRepresentation function (mfapi.h)

Creates a Media Foundation media type from another format representation.

Syntax

HRESULT MFCreateMediaTypeFromRepresentation(
  [in]  GUID         guidRepresentation,
  [in]  LPVOID       pvRepresentation,
  [out] IMFMediaType **ppIMediaType
);

Parameters

[in] guidRepresentation

GUID that specifies which format representation to convert. The following value is defined.

GUID Description
AM_MEDIA_TYPE_REPRESENTATION Convert a DirectShow AM_MEDIA_TYPE structure.

[in] pvRepresentation

Pointer to a buffer that contains the format representation to convert. The layout of the buffer depends on the value of guidRepresentation.

[out] ppIMediaType

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

Return value

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

Return code Description
S_OK
The function succeeded.
MF_E_UNSUPPORTED_REPRESENTATION
The GUID specified in guidRepresentation is not supported.

Remarks

If the original format is a DirectShow audio media type, and the format type is not recognized, the function sets the following attributes on the converted media type.

Attribute Description
MF_MT_AM_FORMAT_TYPE Contains the format type GUID.
MF_MT_USER_DATA Contains the format block.

Requirements

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

See also

Media Foundation Functions