CBaseOutputPin::Deliver
Microsoft DirectShow 9.0 |
CBaseOutputPin::Deliver
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.
Value | 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
** Header:** Declared in Amfilter.h; include Streams.h.
** Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
See Also