IMFMediaType::GetRepresentation method (mfobjects.h)

Retrieves an alternative representation of the media type. Currently only the DirectShow AM_MEDIA_TYPE structure is supported.


HRESULT GetRepresentation(
  [in]  GUID   guidRepresentation,
  [out] LPVOID *ppvRepresentation


[in] guidRepresentation

GUID that specifies the representation to retrieve. The following values are defined.

Value Meaning
Convert the media type to a DirectShow AM_MEDIA_TYPE structure. The method selects the most appropriate format structure (pbFormat).
Convert the media type to a DirectShow AM_MEDIA_TYPE structure with an MFVIDEOFORMAT format structure.
Convert the media type to a DirectShow AM_MEDIA_TYPE structure with a VIDEOINFOHEADER format structure.
Convert the media type to a DirectShow AM_MEDIA_TYPE structure with a VIDEOINFOHEADER2 format structure.

[out] ppvRepresentation

Receives a pointer to a structure that contains the representation. The method allocates the memory for the structure. The caller must release the memory by calling IMFMediaType::FreeRepresentation.

Return value

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

Return code Description
The method succeeded.
The details of the media type do not match the requested representation.
The media type is not valid.
The media type does not support the requested representation.


If you request a specific format structure in the guidRepresentation parameter, such as VIDEOINFOHEADER, you might lose some of the format information.

You can also use the MFInitAMMediaTypeFromMFMediaType function to convert a Media Foundation media type into a DirectShow media type.

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.


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)
Library Mfuuid.lib

See also



Media Types