CTransInPlaceFilter 似乎没有在其输入引脚中实现 GetAllocatorRequirements
。因为尝试在上游过滤器上调用此方法时出现 E_NOTIMPL 错误。
我知道 CTransInPlace Filter 只有一个缓冲区,而不是输入和输出缓冲区。
但是我该如何在我的上游过滤器中处理这个问题呢?
如何实现 DecideAllocator 以支持 CTransInPlaceFilters? 这是我在上游过滤器中的 DecideAllocator 函数:
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;
}
还是我错过了什么,错误的原因不同?
最佳答案
关于就地转换的部分与问题无关并且是多余的。您在询问如何处理未实现 IMemInputPin::GetAllocatorRequirements
的对等过滤器/pin .来自 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.
此方法的实现不是强制性的。这意味着在您的输出引脚上,您可以自行决定配置内存分配器,无需考虑对分配器属性的同行引脚意见。
关于c++ - 使用 transinplacefilter 决定分配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22958655/