Maarten Lankhorst : qcap: Implement a stubby CaptureGraphBuilder2:: RenderStream.

Alexandre Julliard julliard at winehq.org
Fri Mar 14 08:29:26 CDT 2008


Module: wine
Branch: master
Commit: 950d3443e768550062f2d0ca506b4d6ee00367cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=950d3443e768550062f2d0ca506b4d6ee00367cd

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Wed Mar 12 17:18:12 2008 -0700

qcap: Implement a stubby CaptureGraphBuilder2::RenderStream.

This just uses enumeratepins to find 2 non-connected pins and connects
them using the filtergraph.

---

 dlls/qcap/capturegraph.c |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c
index 6dec92a..f439f3b 100644
--- a/dlls/qcap/capturegraph.c
+++ b/dlls/qcap/capturegraph.c
@@ -270,12 +270,38 @@ fnCaptureGraphBuilder2_RenderStream(ICaptureGraphBuilder2 * iface,
                                     IBaseFilter *pfRenderer)
 {
     CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
+    IPin *pin_in = NULL;
+    IPin *pin_out = NULL;
+    HRESULT hr;
 
     FIXME("(%p/%p)->(%s, %s, %p, %p, %p) Stub!\n", This, iface,
           debugstr_guid(pCategory), debugstr_guid(pType),
           pSource, pfCompressor, pfRenderer);
 
-    return E_NOTIMPL;
+    if (pfCompressor)
+        FIXME("Intermediate streams not supported yet\n");
+
+    if (!This->mygraph)
+    {
+        FIXME("Need a capture graph\n");
+        return E_UNEXPECTED;
+    }
+
+    ICaptureGraphBuilder2_FindPin(iface, pSource, PINDIR_OUTPUT, pCategory, pType, TRUE, 0, &pin_in);
+    if (!pin_in)
+        return E_FAIL;
+    ICaptureGraphBuilder2_FindPin(iface, (IUnknown*)pfRenderer, PINDIR_INPUT, pCategory, pType, TRUE, 0, &pin_out);
+    if (!pin_out)
+    {
+        IPin_Release(pin_in);
+        return E_FAIL;
+    }
+
+    /* Uses 'Intelligent Connect', so Connect, not ConnectDirect here */
+    hr = IFilterGraph2_Connect(This->mygraph, pin_in, pin_out);
+    IPin_Release(pin_in);
+    IPin_Release(pin_out);
+    return hr;
 }
 
 static HRESULT WINAPI
@@ -333,17 +359,23 @@ static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, con
 
     IPin_QueryDirection(pin, &pindir);
     if (pindir != direction)
+    {
+        TRACE("No match, wrong direction\n");
         return FALSE;
+    }
 
     if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK)
     {
         IPin_Release(partner);
+        TRACE("No match, %p already connected to %p\n", pin, partner);
         return FALSE;
     }
 
     if (cat || type)
         FIXME("Ignoring category/type\n");
 
+    TRACE("Match made in heaven\n");
+
     return TRUE;
 }
 
@@ -403,6 +435,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
 
             if (hr != S_OK)
                 break;
+            TRACE("Testing match\n");
             if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num)
                 break;
             IPin_Release(pin);
@@ -412,7 +445,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
 
         if (hr != S_OK)
         {
-            WARN("Could not find pin # %d\n", numcurrent);
+            WARN("Could not find %s pin # %d\n", (pindir == PINDIR_OUTPUT ? "output" : "input"), numcurrent);
             return E_FAIL;
         }
     }




More information about the wine-cvs mailing list