static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin); ok(mpin == NULL, "IMemInputPin found!\n"); if (mpin) IMemInputPin_Release(mpin); /* TODO */ }
HRESULT qcap_driver_stop(Capture *capBox, FILTER_STATE *state) { TRACE("%p -> (%p)\n", capBox, state); if (*state == State_Stopped) return S_OK; EnterCriticalSection(&capBox->CritSect); if (capBox->thread) { if (*state == State_Paused) ResumeThread(capBox->thread); capBox->stopped = 1; capBox->thread = 0; if (capBox->iscommitted) { IMemInputPin *pMem = NULL; IMemAllocator * pAlloc = NULL; IPin *pConnect = NULL; HRESULT hr; capBox->iscommitted = 0; hr = IPin_ConnectedTo(capBox->pOut, &pConnect); if (SUCCEEDED(hr)) 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) WARN("Decommitting allocator: %x\n", hr); } V4l_Unprepare(capBox); } *state = State_Stopped; LeaveCriticalSection(&capBox->CritSect); return S_OK; }
static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin); ok(mpin != NULL, "No IMemInputPin found!\n"); if (mpin) { ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n"); ok(IMemInputPin_NotifyAllocator(mpin, NULL, 0) == E_POINTER, "NotifyAllocator likes a NULL pointer argument\n"); IMemInputPin_Release(mpin); } /* TODO */ }
/* IPin - output pin */ static HRESULT WINAPI SampleGrabber_Out_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE *type) { SG_Pin *This = impl_from_IPin(iface); HRESULT hr; TRACE("(%p)->(%p, %p)\n", This, receiver, type); if (!receiver) return E_POINTER; if (This->pair) return VFW_E_ALREADY_CONNECTED; if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (type) { TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n", debugstr_guid(&type->majortype), debugstr_guid(&type->subtype), type->lSampleSize, debugstr_guid(&type->formattype), type->cbFormat); if (!IsEqualGUID(&This->sg->mtype.majortype,&GUID_NULL) && !IsEqualGUID(&This->sg->mtype.majortype,&type->majortype)) return VFW_E_TYPE_NOT_ACCEPTED; if (!IsEqualGUID(&This->sg->mtype.subtype,&MEDIASUBTYPE_None) && !IsEqualGUID(&This->sg->mtype.subtype,&type->subtype)) return VFW_E_TYPE_NOT_ACCEPTED; if (!IsEqualGUID(&This->sg->mtype.formattype,&GUID_NULL) && !IsEqualGUID(&This->sg->mtype.formattype,&FORMAT_None) && !IsEqualGUID(&This->sg->mtype.formattype,&type->formattype)) return VFW_E_TYPE_NOT_ACCEPTED; } else type = &This->sg->mtype; if (!IsEqualGUID(&type->formattype, &FORMAT_None) && !IsEqualGUID(&type->formattype, &GUID_NULL) && !type->pbFormat) return VFW_E_TYPE_NOT_ACCEPTED; hr = IPin_ReceiveConnection(receiver, &This->IPin_iface, type); if (FAILED(hr)) return hr; This->pair = receiver; if (This->sg->memOutput) { IMemInputPin_Release(This->sg->memOutput); This->sg->memOutput = NULL; } IPin_QueryInterface(receiver,&IID_IMemInputPin,(void **)&(This->sg->memOutput)); TRACE("(%p) Accepted IPin %p, IMemInputPin %p\n", This, receiver, This->sg->memOutput); return S_OK; }
/* IPin - output pin */ static HRESULT WINAPI SampleGrabber_Out_IPin_Disconnect(IPin *iface) { SG_Pin *This = impl_from_IPin(iface); TRACE("(%p)->() pair = %p\n", This, This->pair); if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (This->pair) { This->pair = NULL; if (This->sg->memOutput) { IMemInputPin_Release(This->sg->memOutput); This->sg->memOutput = NULL; } return S_OK; } return S_FALSE; }
/* Cleanup at end of life */ static void SampleGrabber_cleanup(SG_Impl *This) { TRACE("(%p)\n", This); if (This->filter.filterInfo.pGraph) WARN("(%p) still joined to filter graph %p\n", This, This->filter.filterInfo.pGraph); if (This->allocator) IMemAllocator_Release(This->allocator); if (This->memOutput) IMemInputPin_Release(This->memOutput); if (This->grabberIface) ISampleGrabberCB_Release(This->grabberIface); if (This->mtype.pbFormat) CoTaskMemFree(This->mtype.pbFormat); if (This->bufferData) CoTaskMemFree(This->bufferData); if(This->seekthru_unk) IUnknown_Release(This->seekthru_unk); }
/* Cleanup at end of life */ static void SampleGrabber_cleanup(SG_Impl *This) { TRACE("(%p)\n", This); if (This->info.pGraph) WARN("(%p) still joined to filter graph %p\n", This, This->info.pGraph); if (This->allocator) IMemAllocator_Release(This->allocator); if (This->refClock) IReferenceClock_Release(This->refClock); if (This->memOutput) IMemInputPin_Release(This->memOutput); if (This->grabberIface) ISampleGrabberCB_Release(This->grabberIface); if (This->mtype.pbFormat) CoTaskMemFree(This->mtype.pbFormat); if (This->bufferData) CoTaskMemFree(This->bufferData); if(This->seekthru_unk) IUnknown_Release(This->seekthru_unk); This->critSect.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->critSect); }