/* IMemInputPin */ static HRESULT WINAPI SampleGrabber_IMemInputPin_GetAllocator(IMemInputPin *iface, IMemAllocator **allocator) { SG_Impl *This = impl_from_IMemInputPin(iface); TRACE("(%p)->(%p) allocator = %p\n", This, allocator, This->allocator); if (!allocator) return E_POINTER; *allocator = This->allocator; if (!*allocator) return VFW_E_NO_ALLOCATOR; IMemAllocator_AddRef(*allocator); return S_OK; }
/* IMemInputPin */ static HRESULT WINAPI SampleGrabber_IMemInputPin_NotifyAllocator(IMemInputPin *iface, IMemAllocator *allocator, BOOL readOnly) { SG_Impl *This = impl_from_IMemInputPin(iface); TRACE("(%p)->(%p, %u) allocator = %p\n", This, allocator, readOnly, This->allocator); if (This->allocator == allocator) return S_OK; if (This->allocator) IMemAllocator_Release(This->allocator); This->allocator = allocator; if (allocator) IMemAllocator_AddRef(allocator); return S_OK; }
static HRESULT WINAPI QTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputPin *pPin, IMemAllocator **pAlloc) { HRESULT hr; QTOutPin *This = impl_QTOutPin_from_BaseOutputPin(iface); QTSplitter *QTfilter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter); *pAlloc = NULL; if (QTfilter->pInputPin.pAlloc) { hr = IMemInputPin_NotifyAllocator(pPin, QTfilter->pInputPin.pAlloc, FALSE); if (SUCCEEDED(hr)) { *pAlloc = QTfilter->pInputPin.pAlloc; IMemAllocator_AddRef(*pAlloc); } } else hr = VFW_E_NO_ALLOCATOR; return hr; }
static HRESULT WINAPI Parser_OutputPin_DecideAllocator(BaseOutputPin *iface, IMemInputPin *pPin, IMemAllocator **pAlloc) { Parser_OutputPin *This = (Parser_OutputPin*)iface; HRESULT hr; *pAlloc = NULL; if (This->alloc) { hr = IMemInputPin_NotifyAllocator(pPin, This->alloc, This->readonly); if (SUCCEEDED(hr)) { *pAlloc = This->alloc; IMemAllocator_AddRef(*pAlloc); } } else hr = VFW_E_NO_ALLOCATOR; return hr; }