CDynamicOutputPin.StartUsingOutputPin method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The StartUsingOutputPin method obtains access to the pin for a streaming operation.

Syntax

virtual HRESULT StartUsingOutputPin();

Parameters

This method has no parameters.

Return value

Returns an HRESULT value. Possible values include those shown in the following table.

Return code Description
S_OK
Success.
E_UNEXPECTED
Unexpected error.
VFW_E_STATE_CHANGED
The filter was stopped, or the pin has begun flushing.

Remarks

Call this method before calling any methods that deliver data to the connected input pin or that change the connection's media type. For example, this rule applies to the following methods:

Afterward, call the CDynamicOutputPin::StopUsingOutputPin method to release the access to the pin.

If the pin is blocked, StartUsingOutputPin waits for the pin to become unblocked. If the filter stops while the method is waiting, the method immediately returns VFW_E_STATE_CHANGED. The pin maintains a count of how many times StartUsingOutputPin has been called without a corresponding call to StopUsingOutputPin. If another thread tries to block the pin while this count is non-zero, the pin sets its blocking status to "pending." The pin becomes blocked once all of the streaming operations have completed, in the final call to StopUsingOutputPin.

Do not hold the CDynamicOutputPin::m_BlockStateLock critical section when you call this method. Otherwise, if the pin is blocked, it can never become unblocked, causing a deadlock.

Requirements

Requirement Value
Header
Amfilter.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CDynamicOutputPin Class