Microsoft Windows CE 3.0  

CBaseOutputPin::GetDeliveryBuffer

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Retrieves an IMediaSamplebuffer suitable for passing across the connection.

virtual HRESULT GetDeliveryBuffer(
IMediaSample **
ppSample
,
REFERENCE_TIME *
pStartTime
,
REFERENCE_TIME *
pEndTime
,
DWORD
dwFlags
);

Parameters

ppSample
IMediaSamplebuffer to be provided.
pStartTime
Start time of the media sample (optional and can be NULL).
pEndTime
Stop time of the media sample (optional and can be NULL).
dwFlags
The following flags are supported.
AM_GBF_NOTASYNCPOINT Dynamic format changes are not allowed on this buffer because it is not a key frame.
AM_GBF_PREVFRAMESKIPPED Buffer returned will not be filled with data contiguous with any previous data sent.

Return Values

Returns E_NOINTERFACE if an allocator is not found; otherwise, returns the value returned from calling the IMemAllocator::GetBuffermethod.

Remarks

The pin object must lock itself before calling this member function; otherwise, the filter graph could disconnect this pin from the input pin midway through the process. If the filter has no worker threads, the lock is best applied on the IMemInputPin::Receivecall; otherwise, it should be done when the worker thread is ready to deliver the sample.

This call can block; therefore, to avoid deadlocking with an IMediaFilter::Stopcommand, a two-tier locking scheme (such as that implemented in CTransformFilter) is required. Only the second-level lock is acquired here. The IBaseFilterbase class implementation of IMediaFilter::Stopfirst gets the first-level lock and then calls IMemAllocator::Decommiton the allocator. This has the effect of making GetDeliveryBufferreturn with a failure code. The Stopmember function then gets the second-level lock and completes the command by calling Inactivefor this pin.

No lock is needed when calling CBaseOutputPin::GetDeliveryBufferwhen passing on samples using a worker thread. In this case, the CBaseFilter::Stopbase class implementation acquires its filter-level lock and just calls IMemAllocator::Decommiton the allocator, at which point the worker thread is freed up to listen for a command to stop.

You must release the sample yourself after this function. If the connected input pin needs to hold on to the sample beyond the function, it will add the reference for the sample itself through IUnknown::AddRef. You must release this one and call CBaseOutputPin::GetDeliveryBufferfor the next. (You cannot reuse it directly.)