From d9003a04646087f1ca92391ef705f0598974dc9b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 8 Apr 2020 15:58:56 -0500 Subject: [PATCH] qcap: Search downstream pins regardless of whether the category and major type match. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48766 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/qcap/capturegraph.c | 30 ++++++++++++++++++++---------- dlls/qcap/tests/capturegraph.c | 6 +++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c index a5b00df90b2..822f68754e0 100644 --- a/dlls/qcap/capturegraph.c +++ b/dlls/qcap/capturegraph.c @@ -505,28 +505,38 @@ static HRESULT find_unconnected_source_from_filter(CaptureGraphImpl *capture_gra static HRESULT find_unconnected_source_from_pin(CaptureGraphImpl *capture_graph, const GUID *category, const GUID *majortype, IPin *pin, IPin **ret) { + PIN_DIRECTION dir; PIN_INFO info; HRESULT hr; IPin *peer; + IPin_QueryDirection(pin, &dir); + if (dir != PINDIR_OUTPUT) + return VFW_E_INVALID_DIRECTION; + if (category && (IsEqualGUID(category, &PIN_CATEGORY_CAPTURE) || IsEqualGUID(category, &PIN_CATEGORY_PREVIEW))) { if (FAILED(hr = match_smart_tee_pin(capture_graph, category, majortype, (IUnknown *)pin, &pin))) return hr; - } - else if (pin_matches(pin, PINDIR_OUTPUT, category, majortype, FALSE)) - { - IPin_AddRef(pin); - hr = S_OK; + + if (FAILED(IPin_ConnectedTo(pin, &peer))) + { + *ret = pin; + return S_OK; + } } else - return E_FAIL; - - if (FAILED(IPin_ConnectedTo(pin, &peer))) { - *ret = pin; - return hr; + if (FAILED(IPin_ConnectedTo(pin, &peer))) + { + if (!pin_matches(pin, PINDIR_OUTPUT, category, majortype, FALSE)) + return E_FAIL; + + IPin_AddRef(*ret = pin); + return S_OK; + } + IPin_AddRef(pin); } IPin_QueryPinInfo(peer, &info); diff --git a/dlls/qcap/tests/capturegraph.c b/dlls/qcap/tests/capturegraph.c index 629bc92d895..49b4f8c6b9f 100644 --- a/dlls/qcap/tests/capturegraph.c +++ b/dlls/qcap/tests/capturegraph.c @@ -874,15 +874,15 @@ static void test_render_stream(void) hr = ICaptureGraphBuilder2_RenderStream(capture_graph, NULL, &sink1_type, (IUnknown *)&source.filter.IBaseFilter_iface, NULL, &sink.filter.IBaseFilter_iface); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); ok(source.source1.pin.pin.peer == &transform.sink1.pin.pin.IPin_iface, "Got wrong connection.\n"); ok(transform.source1.pin.pin.peer == &sink.sink1.pin.pin.IPin_iface, "Got wrong connection.\n"); - todo_wine ok(transform.source2.pin.pin.peer == &sink.sink2.pin.pin.IPin_iface, "Got wrong connection.\n"); + ok(transform.source2.pin.pin.peer == &sink.sink2.pin.pin.IPin_iface, "Got wrong connection.\n"); ok(!source.source2.pin.pin.peer, "Pin should not be connected.\n"); disconnect_pins(graph, &source.source1); disconnect_pins(graph, &transform.source1); - todo_wine disconnect_pins(graph, &transform.source2); + disconnect_pins(graph, &transform.source2); /* Test categories. */