Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/qedit/mediadet.c | 46 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index 52090b8..56ecc2f 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -305,11 +305,51 @@ static HRESULT WINAPI MediaDet_get_Filter(IMediaDet *iface, IUnknown **filter) return S_OK; }
-static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal) +static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *filter) { MediaDetImpl *This = impl_from_IMediaDet(iface); - FIXME("(%p)->(%p): not implemented!\n", This, newVal); - return E_NOTIMPL; + IGraphBuilder *gb; + IBaseFilter *bf; + HRESULT hr; + + TRACE("detector %p, filter %p.\n", This, filter); + + if (!filter) + return E_POINTER; + + hr = IUnknown_QueryInterface(filter, &IID_IBaseFilter, (void **) &bf); + if (FAILED(hr)) + return hr; + + if (This->graph) + MD_cleanup(This); + + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IGraphBuilder, (void **) &gb); + if (FAILED(hr)) + { + IBaseFilter_Release(bf); + return hr; + } + + if (FAILED(hr = IGraphBuilder_AddFilter(gb, bf, L"Source"))) + { + IGraphBuilder_Release(gb); + IBaseFilter_Release(bf); + return hr; + } + + This->graph = gb; + This->source = bf; + hr = get_splitter(This); + if (FAILED(hr)) + { + /* No splitter found, use the source directly */ + This->splitter = This->source; + IBaseFilter_AddRef(This->splitter); + } + + return IMediaDet_put_CurrentStream(&This->IMediaDet_iface, 0); }
static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, LONG *pVal)