Commit cdab25b0 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz: Try to connect all source pins when autoplugging from the registry.

parent 3e0e12d5
......@@ -1327,7 +1327,6 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut,
while (IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, NULL) == S_OK)
{
VARIANT var;
IPin* ppinfilter = NULL;
IBaseFilter* pfilter = NULL;
IAMGraphBuilderCallback *callback = NULL;
......@@ -1390,35 +1389,27 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut,
goto error;
}
hr = IEnumPins_Next(penumpins, 1, &ppinfilter, NULL);
IEnumPins_Release(penumpins);
if (FAILED(hr)) {
WARN("Obtaining next pin: (%x)\n", hr);
goto error;
}
if (hr == S_FALSE) {
WARN("Cannot use this filter: no pins\n");
goto error;
}
hr = IFilterGraph2_ConnectDirect(iface, ppinOut, ppinfilter, NULL);
if (FAILED(hr)) {
TRACE("Cannot connect to filter (%x), trying next one\n", hr);
goto error;
}
TRACE("Successfully connected to filter, follow chain...\n");
if (SUCCEEDED(hr = connect_output_pin(This, pfilter, ppinIn)))
while (IEnumPins_Next(penumpins, 1, &pin, NULL) == S_OK)
{
IPin_Release(ppinfilter);
IBaseFilter_Release(pfilter);
break;
if (SUCCEEDED(IFilterGraph2_ConnectDirect(iface, ppinOut, pin, NULL)))
{
if (SUCCEEDED(hr = connect_output_pin(This, pfilter, ppinIn)))
{
IPin_Release(pin);
IEnumPins_Release(penumpins);
IBaseFilter_Release(pfilter);
IEnumMoniker_Release(pEnumMoniker);
goto out;
}
IFilterGraph2_Disconnect(iface, pin);
IFilterGraph2_Disconnect(iface, ppinOut);
}
IPin_Release(pin);
}
IEnumPins_Release(penumpins);
error:
VariantClear(&var);
if (ppinfilter) IPin_Release(ppinfilter);
if (pfilter) {
IFilterGraph2_RemoveFilter(iface, pfilter);
IBaseFilter_Release(pfilter);
......
......@@ -2136,9 +2136,9 @@ static void test_graph_builder_connect(void)
testfilter_init(&parser1, parser1_pins, 3);
parser1.pin_count = 2;
testsink_init(&parser2_pins[0]);
testsource_init(&parser2_pins[1], &sink_type, 1);
parser2_pins[1].request_mt = &sink_type;
testsource_init(&parser2_pins[0], &sink_type, 1);
testsink_init(&parser2_pins[1]);
parser2_pins[0].request_mt = &sink_type;
testfilter_init(&parser2, parser2_pins, 2);
testsink_init(&parser3_pins[0]);
......@@ -2215,8 +2215,8 @@ static void test_graph_builder_connect(void)
sink_pin.accept_mt = &sink_type;
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer);
......@@ -2227,8 +2227,8 @@ static void test_graph_builder_connect(void)
{
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x for Connect() hr %#x.\n", hr, source_pin.Connect_hr);
ok(source_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer);
......@@ -2379,9 +2379,9 @@ todo_wine
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser1_pins[0].IPin_iface
|| source_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
|| source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser1_pins[1].IPin_iface
|| sink_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
|| sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
......@@ -2417,8 +2417,8 @@ todo_wine
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment