CBaseOutputPin.DecideAllocator 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 DecideAllocator method selects a memory allocator.

Syntax

virtual HRESULT DecideAllocator(
   IMemInputPin  *pPin,
   IMemAllocator **pAlloc
);

Parameters

pPin

Pointer to the input pin's IMemInputPin interface.

pAlloc

Address of a variable that receives a pointer to the allocator's IMemAllocator interface.

Return value

Returns S_OK if successful, or an HRESULT value indicating the cause of the error.

Remarks

This method is called at the end of the pin connection process. It performs the following steps:

  1. Calls the IMemInputPin::GetAllocatorRequirements method to retrieve the input pin's buffer requirements, if any.
  2. Calls the IMemInputPin::GetAllocator method to request an allocator from the input pin. If the input pin does not provide an allocator, the output pin creates one by calling the CBaseOutputPin::InitAllocator class method.
  3. Calls the CBaseOutputPin::DecideBufferSize class method, which sets the allocator properties. This is a pure virtual method; the derived class must implement it.
  4. Calls the IMemInputPin::NotifyAllocator method, which notifies the input pin of the allocator being used.

Requirements

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

See also

CBaseOutputPin Class