IMFMediaSink::AddStreamSink Method

Adds a new stream sink to the media sink.

Syntax

public:
HRESULT AddStreamSink(
         DWORD dwStreamSinkIdentifier,
         IMFMediaType *pMediaType,
         IMFStreamSink **ppStreamSink
)  

Parameters

dwStreamSinkIdentifier
Type: DWORD 

Identifier for the new stream. The value is arbitrary but must be unique.

pMediaType
Type: IMFMediaType *

[in, optional]

Pointer to the IMFMediaType interface, specifying the media type for the stream. This parameter can be NULL.

ppStreamSink
Type: IMFStreamSink **

[out, optional]

Receives a pointer to the new stream sink’s IMFStreamSink interface. The caller must release the interface.

Return value

Type: HRESULT 

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

Return codes
Return code Description
S_OK The method succeeded.
MF_E_INVALIDSTREAMNUMBER The specified stream identifier is not valid.
MF_E_SHUTDOWN The media sink’s Shutdown method has been called.
MF_E_STREAMSINK_EXISTS There is already a stream sink with the same stream identifier.
MF_E_STREAMSINKS_FIXED This media sink has a fixed set of stream sinks. New stream sinks cannot be added.

Refer to Media Foundation return codes.

Remarks

Not all media sinks support this method. If the media sink does not support this method, the IMFMediaSink::GetCharacteristics method returns the MEDIASINK_FIXED_STREAMS flag.

If pMediaType is NULL, use the IMFMediaTypeHandler interface to set the media type. Call IMFStreamSink::GetMediaTypeHandler to get a pointer to the interface.

Requirements

Header: Declared in mfidl.h.

Library: Use mfuuid.lib.