IMFSourceReader::GetNativeMediaType method (mfreadwrite.h)

Gets a format that is supported natively by the media source.

Syntax

HRESULT GetNativeMediaType(
  [in]  DWORD        dwStreamIndex,
  [in]  DWORD        dwMediaTypeIndex,
  [out] IMFMediaType **ppMediaType
);

Parameters

[in] dwStreamIndex

Specifies which stream to query. The value can be any of the following.

Value Meaning
0–0xFFFFFFFB
The zero-based index of a stream.
MF_SOURCE_READER_FIRST_VIDEO_STREAM
0xFFFFFFFC
The first video stream.
MF_SOURCE_READER_FIRST_AUDIO_STREAM
0xFFFFFFFD
The first audio stream.

[in] dwMediaTypeIndex

Specifies which media type to query. The value can be any of the following.

Value Meaning
0–0xFFFFFFFE
The zero-based index of a media type
MF_SOURCE_READER_CURRENT_TYPE_INDEX
0xFFFFFFFF
The current native media type.

[out] ppMediaType

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

Return value

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

Return code Description
S_OK
The method succeeded.
MF_E_INVALIDSTREAMNUMBER
The dwStreamIndex parameter is invalid.
MF_E_NO_MORE_TYPES
The dwMediaTypeIndex parameter is out of range.

Remarks

This method queries the underlying media source for its native output format. Potentially, each source stream can produce more than one output format. Use the dwMediaTypeIndex parameter to loop through the available formats. Generally, file sources offer just one format per stream, but capture devices might offer several formats.

The method returns a copy of the media type, so it is safe to modify the object received in the ppMediaType parameter.

To set the output type for a stream, call the IMFSourceReader::SetCurrentMediaType method.

This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header mfreadwrite.h

See also

IMFSourceReader

Source Reader