From: Aidan Thornton Subject: quartz: implement IFilterGraph2::AddSourceFilterForMoniker (try 2) Message-Id: Date: Tue, 16 Dec 2014 18:49:34 +0000 Needed for webcam capture in some applications, such as FaceRig. Couple of style fixes compared to the previous patch. --- dlls/quartz/filtergraph.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 3d495db..fcdd05b 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1737,8 +1737,27 @@ static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *ifac IMoniker *pMoniker, IBindCtx *pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter **ppFilter) { IFilterGraphImpl *This = impl_from_IFilterGraph2(iface); + HRESULT hr; + IBaseFilter* pfilter; + + TRACE("(%p/%p)->(%p %p %s %p)\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter); + + hr = IMoniker_BindToObject(pMoniker, pCtx, NULL, &IID_IBaseFilter, (void**)&pfilter); + if(FAILED(hr)) { + WARN("Unable to bind moniker to filter object (%x)\n", hr); + return hr; + } + + hr = IFilterGraph2_AddFilter(iface, pfilter, lpcwstrFilterName); + if (FAILED(hr)) { + WARN("Unable to add filter (%x)\n", hr); + IBaseFilter_Release(pfilter); + return hr; + } - TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter); + if(ppFilter) + *ppFilter = pfilter; + else IBaseFilter_Release(pfilter); return S_OK; }