[PATCH 3/4] quartz/filtergraph: Don't recursively render pins whose names begin with ~.

Zebediah Figura z.figura12 at gmail.com
Thu Sep 20 23:34:14 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/filtergraph.c       | 16 +++++++++++-----
 dlls/quartz/tests/filtergraph.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 8d52177..0468cb5 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -1401,16 +1401,22 @@ static HRESULT render_output_pins(IFilterGraphImpl *graph, IBaseFilter *filter)
     BOOL renderall = TRUE;
     IEnumPins *enumpins;
     IPin *pin, *peer;
+    PIN_INFO info;
 
     IBaseFilter_EnumPins(filter, &enumpins);
     while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
     {
-        PIN_DIRECTION dir = PINDIR_INPUT;
-
-        IPin_QueryDirection(pin, &dir);
-
-        if (dir == PINDIR_OUTPUT)
+        IPin_QueryPinInfo(pin, &info);
+        IBaseFilter_Release(info.pFilter);
+        if (info.dir == PINDIR_OUTPUT)
         {
+            if (info.achName[0] == '~')
+            {
+                TRACE("Skipping non-rendered pin %s.\n", debugstr_w(info.achName));
+                IPin_Release(pin);
+                continue;
+            }
+
             if (IPin_ConnectedTo(pin, &peer) == VFW_E_NOT_CONNECTED)
             {
                 HRESULT hr;
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 30bf0cc..6c8b9fa 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -1485,6 +1485,8 @@ static void test_graph_builder_render(void)
     ok(parser_pins[1].peer == &sink1_pin.IPin_iface, "Got peer %p.\n", parser_pins[1].peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+    IFilterGraph2_Disconnect(graph, parser_pins[0].peer);
+    IFilterGraph2_Disconnect(graph, &parser_pins[0].IPin_iface);
 
     IFilterGraph2_RemoveFilter(graph, &sink1.IBaseFilter_iface);
     IFilterGraph2_AddFilter(graph, &sink1.IBaseFilter_iface, NULL);
@@ -1492,6 +1494,32 @@ static void test_graph_builder_render(void)
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(source_pin.peer == &sink1_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
+    IFilterGraph2_Disconnect(graph, source_pin.peer);
+    IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+
+    /* A pin whose name (not ID) begins with a tilde is not rendered. */
+
+    IFilterGraph2_RemoveFilter(graph, &sink2.IBaseFilter_iface);
+    IFilterGraph2_RemoveFilter(graph, &parser.IBaseFilter_iface);
+    IFilterGraph2_AddFilter(graph, &parser.IBaseFilter_iface, NULL);
+
+    parser_pins[1].name[0] = '~';
+    hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(source_pin.peer == &parser_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
+    ok(!parser_pins[1].peer, "Got peer %p.\n", parser_pins[1].peer);
+    ok(!sink1_pin.peer, "Got peer %p.\n", sink1_pin.peer);
+    IFilterGraph2_Disconnect(graph, source_pin.peer);
+    IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+
+    parser_pins[1].name[0] = 0;
+    parser_pins[1].id[0] = '~';
+    hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(source_pin.peer == &parser_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
+    ok(parser_pins[1].peer == &sink1_pin.IPin_iface, "Got peer %p.\n", parser_pins[1].peer);
+    IFilterGraph2_Disconnect(graph, source_pin.peer);
+    IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
 
     ref = IFilterGraph2_Release(graph);
     ok(!ref, "Got outstanding refcount %d.\n", ref);
-- 
2.7.4




More information about the wine-devel mailing list