IMFCaptureSink::AddStream method (mfcaptureengine.h)
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
[in] dwSourceStreamIndex
The source stream to connect. The value can be any of the following.
Value | Meaning |
---|---|
|
The zero-based index of a stream. To get the number of streams, call IMFCaptureSource::GetDeviceStreamCount. |
|
The first image stream. |
|
The first video stream. |
|
The first audio stream. |
[in] pMediaType
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.
[in] pAttributes
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.
[out] pdwSinkStreamIndex
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 code | Description |
---|---|
|
Success. |
|
The format specified in pMediaType is not valid for this capture sink. |
|
The dwSourceStreamIndex parameter is invalid, or the specified source stream was already connected to this sink. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps only] |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | mfcaptureengine.h |