Windows Dev Center

IMFCaptureSink::AddStream method

Connects a stream from the capture source to this capture sink.

Syntax


HRESULT AddStream(
  [in]  DWORD         dwSourceStreamIndex,
  [in]  IMFMediaType  *pMediaType,
  [in]  IMFAttributes *pAttributes,
  [out] DWORD         *pdwSinkStreamIndex
);

Parameters

dwSourceStreamIndex [in]

The source stream to connect. The value can be any of the following.

ValueMeaning
0–0xFFFFFFFB

The zero-based index of a stream. To get the number of streams, call IMFCaptureSource::GetDeviceStreamCount.

MF_CAPTURE_ENGINE_FIRST_SOURCE_PHOTO_STREAM
0xFFFFFFFB

The first image stream.

MF_CAPTURE_ENGINE_FIRST_SOURCE_VIDEO_STREAM
0xFFFFFFFC

The first video stream.

MF_CAPTURE_ENGINE_FIRST_SOURCE_AUDIO_STREAM
0xFFFFFFFD

The first audio stream.

 

pMediaType [in]

An IMFMediaType pointer that specifies the desired format of the output stream. The details of the format will depend on the capture sink.

  • Photo sink: A still image format compatible with Windows Imaging Component (WIC).
  • Preview sink: An uncompressed audio or video format.
  • Record sink: The audio or video format that will be written to the output file.
pAttributes [in]

A pointer to the IMFAttributes interface. For compressed streams, you can use this parameter to configure the encoder. This parameter can also be NULL. For the preview sink, set this parameter to NULL.

pdwSinkStreamIndex [out]

Receives the index of the new stream on the capture sink. Note that this index will not necessarily match the value of dwSourceStreamIndex.

Return value

This method can return one of these values.

Return codeDescription
S_OK

Success.

MF_E_INVALIDMEDIATYPE

The format specified in pMediaType is not valid for this capture sink.

MF_E_INVALIDSTREAMNUMBER

The dwSourceStreamIndex parameter is invalid, or the specified source stream was already connected to this sink.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Mfcaptureengine.h

See also

IMFCaptureSink

 

 

Community Additions

ADD
Show:
© 2015 Microsoft