quartz/filtergraph: Try filters in the graph first in FilterGraph2_Connect().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-09-20 10:36:19 -05:00 committed by Alexandre Julliard
parent 6eb05abf5f
commit a638c32753
2 changed files with 33 additions and 13 deletions

View File

@ -1089,7 +1089,9 @@ static HRESULT connect_output_pin(IFilterGraphImpl *graph, IBaseFilter *filter,
static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, IPin *ppinIn) static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut, IPin *ppinIn)
{ {
IFilterGraphImpl *This = impl_from_IFilterGraph2(iface); IFilterGraphImpl *This = impl_from_IFilterGraph2(iface);
struct filter *filter;
HRESULT hr; HRESULT hr;
IPin *pin;
AM_MEDIA_TYPE* mt = NULL; AM_MEDIA_TYPE* mt = NULL;
IEnumMediaTypes* penummt = NULL; IEnumMediaTypes* penummt = NULL;
ULONG nbmt; ULONG nbmt;
@ -1097,7 +1099,6 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut,
IEnumMoniker* pEnumMoniker; IEnumMoniker* pEnumMoniker;
GUID tab[2]; GUID tab[2];
IMoniker* pMoniker; IMoniker* pMoniker;
ULONG pin;
PIN_INFO PinInfo; PIN_INFO PinInfo;
CLSID FilterCLSID; CLSID FilterCLSID;
PIN_DIRECTION dir; PIN_DIRECTION dir;
@ -1160,6 +1161,34 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut,
TRACE("Direct connection failed, trying to render using extra filters\n"); TRACE("Direct connection failed, trying to render using extra filters\n");
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
{
hr = IBaseFilter_EnumPins(filter->filter, &penumpins);
if (FAILED(hr))
goto out;
while (IEnumPins_Next(penumpins, 1, &pin, NULL) == S_OK)
{
IPin_QueryDirection(pin, &dir);
if (dir == PINDIR_INPUT && SUCCEEDED(IFilterGraph2_ConnectDirect(iface,
ppinOut, pin, NULL)))
{
if (SUCCEEDED(hr = connect_output_pin(This, filter->filter, ppinIn)))
{
IPin_Release(pin);
IEnumPins_Release(penumpins);
goto out;
}
IFilterGraph2_Disconnect(iface, pin);
IFilterGraph2_Disconnect(iface, ppinOut);
}
IPin_Release(pin);
}
IEnumPins_Release(penumpins);
}
hr = IPin_QueryPinInfo(ppinIn, &PinInfo); hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
if (FAILED(hr)) if (FAILED(hr))
goto out; goto out;
@ -1290,14 +1319,14 @@ static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *ppinOut,
goto error; goto error;
} }
hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin); hr = IEnumPins_Next(penumpins, 1, &ppinfilter, NULL);
IEnumPins_Release(penumpins); IEnumPins_Release(penumpins);
if (FAILED(hr)) { if (FAILED(hr)) {
WARN("Obtaining next pin: (%x)\n", hr); WARN("Obtaining next pin: (%x)\n", hr);
goto error; goto error;
} }
if (pin == 0) { if (hr == S_FALSE) {
WARN("Cannot use this filter: no pins\n"); WARN("Cannot use this filter: no pins\n");
goto error; goto error;
} }

View File

@ -1701,11 +1701,9 @@ todo_wine
sink_pin.accept_mt = &sink_type; sink_pin.accept_mt = &sink_type;
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface); hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
todo_wine {
ok(hr == S_OK, "Got hr %#x.\n", hr); 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(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(sink_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
}
IFilterGraph2_Disconnect(graph, source_pin.peer); IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer); IFilterGraph2_Disconnect(graph, sink_pin.peer);
@ -1715,11 +1713,9 @@ todo_wine {
IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL); IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL);
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface); hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
todo_wine {
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer); ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer); ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
}
IFilterGraph2_Disconnect(graph, source_pin.peer); IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer); IFilterGraph2_Disconnect(graph, sink_pin.peer);
@ -1729,12 +1725,10 @@ todo_wine {
IFilterGraph2_AddFilter(graph, &parser3.IBaseFilter_iface, NULL); IFilterGraph2_AddFilter(graph, &parser3.IBaseFilter_iface, NULL);
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface); hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
todo_wine {
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser3_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer); ok(source_pin.peer == &parser3_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(parser3_pins[1].peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", parser3_pins[1].peer); ok(parser3_pins[1].peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", parser3_pins[1].peer);
ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer); ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
}
IFilterGraph2_Disconnect(graph, source_pin.peer); IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, parser3_pins[0].peer); IFilterGraph2_Disconnect(graph, parser3_pins[0].peer);
@ -1753,11 +1747,10 @@ todo_wine {
IFilterGraph2_AddFilter(graph, &sink2.IBaseFilter_iface, NULL); IFilterGraph2_AddFilter(graph, &sink2.IBaseFilter_iface, NULL);
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface); hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
todo_wine { todo_wine
ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#x.\n", hr); ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer); ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer); ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
}
ok(!parser1_pins[2].peer, "Got peer %p.\n", parser1_pins[2].peer); ok(!parser1_pins[2].peer, "Got peer %p.\n", parser1_pins[2].peer);
IFilterGraph2_Disconnect(graph, source_pin.peer); IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
@ -1769,11 +1762,9 @@ todo_wine {
parser1_pins[1].QueryInternalConnections_hr = S_OK; parser1_pins[1].QueryInternalConnections_hr = S_OK;
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface); hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
todo_wine {
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer); ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer); ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
}
IFilterGraph2_Disconnect(graph, source_pin.peer); IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer); IFilterGraph2_Disconnect(graph, sink_pin.peer);