Share via


CBaseOutputPin::GetDeliveryBuffer

Retrieves an IMediaSample buffer suitable for passing across the connection.

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

Parameters

  • ppSample
    IMediaSample buffer 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.
    Value Description
    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::GetBuffer method.

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::Receive call; 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::Stop command, a two-tier locking scheme (such as that implemented in CTransformFilter) is required. Only the second-level lock is acquired here. The IBaseFilter base class implementation of IMediaFilter::Stop first gets the first-level lock and then calls IMemAllocator::Decommit on the allocator. This has the effect of making GetDeliveryBuffer return with a failure code. The Stop member function then gets the second-level lock and completes the command by calling Inactive for this pin.

No lock is needed when calling CBaseOutputPin::GetDeliveryBuffer when passing on samples using a worker thread. In this case, the CBaseFilter::Stop base class implementation acquires its filter-level lock and just calls IMemAllocator::Decommit on 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::GetDeliveryBuffer for the next. (You cannot reuse it directly.)

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header:

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.