سؤال

CTransInPlaceFilter do not seem to implement GetAllocatorRequirements in their input pin. Because I get a E_NOTIMPL error when trying to call this method on a upstream filter.

I know that CTransInPlace Filter only have one buffer instead of a input and a output buffer.

But how do I handle this in my upstream filter?

How do I implmement DecideAllocator to support CTransInPlaceFilters? This is my DecideAllocator function in the upstream filter:

HRESULT MCMyOutputPin::DecideAllocator(IMemInputPin *pPin, IMemAllocator **ppAlloc)
{
    ALLOCATOR_PROPERTIES *pprops = new ALLOCATOR_PROPERTIES;
    HRESULT hr = pPin->GetAllocatorRequirements(pprops); //returns E_NOTIMPL
    if (FAILED(hr))
        return hr;
     hr = pPin->GetAllocator(ppAlloc);
    if (hr == VFW_E_NO_ALLOCATOR)
    {
        hr = InitAllocator(ppAlloc);
        if (FAILED(hr))
            return hr;
    }
    hr = DecideBufferSize(*ppAlloc, pprops);
    if (FAILED(hr))
        return hr;

     hr = pPin->NotifyAllocator(*ppAlloc, TRUE);

    if (FAILED(hr))
    {
        return hr;
    }

    *ppAlloc = m_pAllocator;
    //m_pAllocator = *ppAlloc;

    m_pAllocator->Commit();
    m_pAllocator->AddRef();
    return hr;

}

Or did I miss something and the reason for the error is something different?

هل كانت مفيدة؟

المحلول

The part about inplace transofrmations is irrelevant to the question and redundant. You are asking how to deal with peer filters/pin that don't implement IMemInputPin::GetAllocatorRequirements. From MSDN:

The input pin is not required to implement this method. If the filter has specific alignment or prefix requirements, it should implement this method.

Implementation of this method is not mandatory. This means that on your output pin you are free to configure the memory allocator at your own discretion, no need to consider peer pin opinion on the allocator properties.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top