[PATCH v2 08/13] qedit: Implement MediaDet_put_Filter.

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Apr 16 10:25:00 CDT 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/qedit/mediadet.c | 44 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c
index 046994f..3b4369d 100644
--- a/dlls/qedit/mediadet.c
+++ b/dlls/qedit/mediadet.c
@@ -333,8 +333,48 @@ static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal)
 static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)
 {
     MediaDetImpl *This = impl_from_IMediaDet(iface);
-    FIXME("(%p)->(%p): not implemented!\n", This, newVal);
-    return E_NOTIMPL;
+    IGraphBuilder *gb;
+    IBaseFilter *bf;
+    HRESULT hr;
+
+    TRACE("(%p)->(%p)\n", This, newVal);
+
+    if (!newVal)
+        return E_POINTER;
+
+    hr = IUnknown_QueryInterface(newVal, &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)
-- 
2.21.0




More information about the wine-devel mailing list