IMFMediaSink::RemoveStreamSink Method

Removes a stream sink from the media sink.

Syntax

public:
HRESULT RemoveStreamSink(
         DWORD dwStreamSinkIdentifier
)  

Parameters

dwStreamSinkIdentifier
Type: DWORD 

Identifier of the stream to remove. The stream identifier is defined when you call IMFMediaSink::AddStreamSink to add the stream sink.

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.
E_INVALIDARG This particular stream sink cannot be removed.
MF_E_INVALIDSTREAMNUMBER The stream number is not valid.
MF_E_NOT_INITIALIZED The media sink has not been initialized.
MF_E_SHUTDOWN The media sink’s Shutdown method has been called.
MF_E_STREAMSINKS_FIXED This media sink has a fixed set of stream sinks. Stream sinks cannot be removed.

Refer to Media Foundation return codes.

Remarks

After this method is called, the corresponding stream sink object is no longer valid. The IMFMediaSink::GetStreamSinkByIndex and IMFMediaSink::GetStreamSinkById methods will no longer return that stream sink. You can re-use the stream identifier if you add another stream (by calling AddStreamSink).

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.

In some cases, the media sink supports this method but does not allow every stream sink to be removed. (For example, it might not allow stream 0 to be removed.)

Requirements

Header: Declared in mfidl.h.

Library: Use mfuuid.lib.