IMFSourceReader::SetStreamSelection method

Selects or deselects one or more streams.

Syntax


HRESULT SetStreamSelection(
  [in] DWORD dwStreamIndex,
  [in] BOOL  fSelected
);

Parameters

dwStreamIndex [in]

The stream to set. 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.

MF_SOURCE_READER_ALL_STREAMS
0xFFFFFFFE

All streams.

 

fSelected [in]

Specify TRUE to select streams or FALSE to deselect streams. If a stream is deselected, it will not generate data.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

There are two common uses for this method:

  • To change the default stream selection. Some media files contain multiple streams of the same type. For example, a file might include audio streams for multiple languages. You can use this method to change which of the streams is selected. To get information about each stream, call IMFSourceReader::GetPresentationAttribute or IMFSourceReader::GetNativeMediaType.
  • If you will not need data from one of the streams, it is a good idea to deselect that stream. If the stream is selected, the media source might hold onto a queue of unread data, and the queue might grow indefinitely, consuming memory.

For an example of deselecting a stream, see Tutorial: Decoding Audio.

If a stream is deselected, the IMFSourceReader::ReadSample method returns MF_E_INVALIDREQUEST for that stream. Other IMFSourceReader methods are valid for deselected streams.

Stream selection does not affect how the source reader loads or unloads decoders in memory. In particular, deselecting a stream does not force the source reader to unload the decoder for that stream.

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 | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]

Header

Mfreadwrite.h

See also

Source Reader
IMFSourceReader

 

 

Show: