Export (0) Print
Expand All

IMFSourceReader::SetCurrentMediaType method

Sets the media type for a stream.

This media type defines that format that the Source Reader produces as output. It can differ from the native format provided by the media source. See Remarks for more information.

Syntax


HRESULT SetCurrentMediaType(
  [in]       DWORD dwStreamIndex,
  [in, out]  DWORD *pdwReserved,
  [in]       IMFMediaType *pMediaType
);

Parameters

dwStreamIndex [in]

The stream to configure. The value can be any of the following.

ValueMeaning
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.

 

pdwReserved [in, out]

Reserved. Set to NULL.

pMediaType [in]

A pointer to the IMFMediaType interface of the media type.

Return value

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

Return codeDescription
S_OK

The method succeeded.

MF_E_INVALIDMEDIATYPE

At least one decoder was found for the native stream type, but the type specified by pMediaType was rejected.

MF_E_INVALIDREQUEST

One or more sample requests are still pending.

MF_E_INVALIDSTREAMNUMBER

The dwStreamIndex parameter is invalid.

MF_E_TOPO_CODEC_NOT_FOUND

Could not find a decoder for the native stream type.

 

Remarks

For each stream, you can set the media type to any of the following:

  • One of the native types offered by the media source. To enumerate the native types, call IMFSourceReader::GetNativeMediaType.
  • If the native media type is compressed, you can specify a corresponding uncompressed format. The Source Reader will search for a decoder that can decode from the native format to the specified uncompressed format.

Audio resampling support was added to the source reader with Windows 8. In versions of Windows prior to Windows 8, the source reader does not support audio resampling. If you need to resample the audio in versions of Windows earlier than Windows 8, you can use the Audio Resampler DSP.

If you set the MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING attribute to TRUE when you create the Source Reader, the Source Reader will convert YUV video to RGB-32. This conversion is not optimized for real-time video playback.

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

Requirements

Minimum supported client

Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

Mfreadwrite.h

See also

Source Reader
IMFSourceReader

 

 

Community Additions

ADD
Show:
© 2014 Microsoft