CBaseOutputPin.Deliver 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 Deliver method delivers a media sample to the connected input pin.

Syntax

virtual HRESULT Deliver(
   IMediaSample *pSample
);

Parameters

pSample

Pointer to the sample's IMediaSample interface.

Return value

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

Return code Description
S_OK
Success.
VFW_E_NOT_CONNECTED
Pin is not connected.

Remarks

This method calls the IMemInputPin::Receive method on the input pin. Receive can block if the IMemInputPin::ReceiveCanBlock method returns S_OK.

Release the sample after calling this method. The input pin might hold a reference count on the sample, so do not reuse the sample. Always call the CBaseOutputPin::GetDeliveryBuffer method to obtain a new sample.

Hold the filter's critical section before calling this method. Otherwise, the pin might get disconnected during the method call. If the filter uses a worker thread to deliver samples, hold the critical section when the filter is ready to deliver a sample. Otherwise, you can hold the critical section in the filter's IMemInputPin::Receive method, where the filter processes samples.

Worker threads can create a potential deadlock. When the thread holds the critical section, it might wait on a state change in the filter. At the same time, the state change might be waiting for the thread to complete. To prevent this, the state-change code should signal an event that terminates the thread, and then wait for the thread to signal completion.

Requirements

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

See also

CBaseOutputPin Class