qcap: Use the BaseOutputPin's IMemAllocator.

This commit is contained in:
Damjan Jovanovic 2013-01-15 08:46:28 +02:00 committed by Alexandre Julliard
parent 7f767bb195
commit 632d82f4ac

View File

@ -684,7 +684,6 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state)
*state = State_Running; *state = State_Running;
if (!capBox->iscommitted++) if (!capBox->iscommitted++)
{ {
IMemAllocator * pAlloc = NULL;
ALLOCATOR_PROPERTIES ap, actual; ALLOCATOR_PROPERTIES ap, actual;
BaseOutputPin *out; BaseOutputPin *out;
@ -698,16 +697,11 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state)
ap.cbPrefix = 0; ap.cbPrefix = 0;
out = (BaseOutputPin *)capBox->pOut; out = (BaseOutputPin *)capBox->pOut;
hr = IMemInputPin_GetAllocator(out->pMemInputPin, &pAlloc);
hr = IMemAllocator_SetProperties(out->pAllocator, &ap, &actual);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IMemAllocator_SetProperties(pAlloc, &ap, &actual); hr = IMemAllocator_Commit(out->pAllocator);
if (SUCCEEDED(hr))
hr = IMemAllocator_Commit(pAlloc);
if (pAlloc)
IMemAllocator_Release(pAlloc);
TRACE("Committing allocator: %x\n", hr); TRACE("Committing allocator: %x\n", hr);
} }
@ -765,32 +759,14 @@ HRESULT qcap_driver_stop(Capture *capBox, FILTER_STATE *state)
capBox->thread = 0; capBox->thread = 0;
if (capBox->iscommitted) if (capBox->iscommitted)
{ {
IMemInputPin *pMem = NULL; BaseOutputPin *out;
IMemAllocator * pAlloc = NULL;
IPin *pConnect = NULL;
HRESULT hr; HRESULT hr;
capBox->iscommitted = 0; capBox->iscommitted = 0;
hr = IPin_ConnectedTo(capBox->pOut, &pConnect); out = (BaseOutputPin*)capBox->pOut;
if (SUCCEEDED(hr)) hr = IMemAllocator_Decommit(out->pAllocator);
hr = IPin_QueryInterface(pConnect, &IID_IMemInputPin, (void **) &pMem);
if (SUCCEEDED(hr))
hr = IMemInputPin_GetAllocator(pMem, &pAlloc);
if (SUCCEEDED(hr))
hr = IMemAllocator_Decommit(pAlloc);
if (pAlloc)
IMemAllocator_Release(pAlloc);
if (pMem)
IMemInputPin_Release(pMem);
if (pConnect)
IPin_Release(pConnect);
if (hr != S_OK && hr != VFW_E_NOT_COMMITTED) if (hr != S_OK && hr != VFW_E_NOT_COMMITTED)
WARN("Decommitting allocator: %x\n", hr); WARN("Decommitting allocator: %x\n", hr);