From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/tests/filtergraph.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index bd086445a3b..98f7b30717d 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -98,23 +98,30 @@ static void test_interfaces(void) IFilterGraph2 *graph = create_graph();
check_interface(graph, &IID_IBasicAudio, TRUE); + check_interface(graph, &IID_IBasicVideo, TRUE); check_interface(graph, &IID_IBasicVideo2, TRUE); + check_interface(graph, &IID_IFilterGraph, TRUE); check_interface(graph, &IID_IFilterGraph2, TRUE); check_interface(graph, &IID_IFilterMapper, TRUE); + check_interface(graph, &IID_IFilterMapper2, TRUE); check_interface(graph, &IID_IFilterMapper3, TRUE); + check_interface(graph, &IID_IGraphBuilder, TRUE); check_interface(graph, &IID_IGraphConfig, TRUE); check_interface(graph, &IID_IGraphVersion, TRUE); check_interface(graph, &IID_IMediaControl, TRUE); check_interface(graph, &IID_IMediaEvent, TRUE); - check_interface(graph, &IID_IMediaFilter, TRUE); + check_interface(graph, &IID_IMediaEventEx, TRUE); check_interface(graph, &IID_IMediaEventSink, TRUE); + check_interface(graph, &IID_IMediaFilter, TRUE); check_interface(graph, &IID_IMediaPosition, TRUE); check_interface(graph, &IID_IMediaSeeking, TRUE); check_interface(graph, &IID_IObjectWithSite, TRUE); check_interface(graph, &IID_IVideoFrameStep, TRUE); check_interface(graph, &IID_IVideoWindow, TRUE); + check_interface(graph, &IID_IUnknown, TRUE);
check_interface(graph, &IID_IBaseFilter, FALSE); + check_interface(graph, &IID_IDispatch, FALSE);
IFilterGraph2_Release(graph); }
Cycle detection is done by native quartz.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 4132ffa5b2f..aa646615428 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -776,7 +776,6 @@ static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface, */ static HRESULT CheckCircularConnection(struct filter_graph *This, IPin *out, IPin *in) { -#if 1 HRESULT hr; PIN_INFO info_out, info_in;
@@ -841,10 +840,6 @@ out: if (FAILED(hr)) ERR("Checking filtergraph returned %08x, something's not right!\n", hr); return hr; -#else - /* Debugging filtergraphs not enabled */ - return S_OK; -#endif }
static struct filter *find_sorted_filter(struct filter_graph *graph, IBaseFilter *iface)
These are already checked in the callers.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index aa646615428..74f1adcb665 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -782,22 +782,12 @@ static HRESULT CheckCircularConnection(struct filter_graph *This, IPin *out, IPi hr = IPin_QueryPinInfo(out, &info_out); if (FAILED(hr)) return hr; - if (info_out.dir != PINDIR_OUTPUT) - { - IBaseFilter_Release(info_out.pFilter); - return VFW_E_CANNOT_CONNECT; - }
hr = IPin_QueryPinInfo(in, &info_in); if (SUCCEEDED(hr)) IBaseFilter_Release(info_in.pFilter); if (FAILED(hr)) goto out; - if (info_in.dir != PINDIR_INPUT) - { - hr = VFW_E_CANNOT_CONNECT; - goto out; - }
if (info_out.pFilter == info_in.pFilter) hr = VFW_E_CIRCULAR_GRAPH;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=106911
Your paranoid android.
=== debian11 (build log) ===
WineRunWineTest.pl:error: The previous 1 run(s) terminated abnormally
Use clearer variable names, and simplify the error handling.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/filtergraph.c | 107 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 53 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 74f1adcb665..0dccf2b7fb4 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -771,65 +771,66 @@ static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface, return VFW_E_NOT_FOUND; }
-/* Don't allow a circular connection to form, return VFW_E_CIRCULAR_GRAPH if this would be the case. - * A circular connection will be formed if from the filter of the output pin, the input pin can be reached - */ -static HRESULT CheckCircularConnection(struct filter_graph *This, IPin *out, IPin *in) +static HRESULT check_cyclic_connection(IPin *source, IPin *sink) { + IPin *upstream_source, *upstream_sink; + PIN_INFO source_info, sink_info; + IEnumPins *enumpins; HRESULT hr; - PIN_INFO info_out, info_in;
- hr = IPin_QueryPinInfo(out, &info_out); + hr = IPin_QueryPinInfo(sink, &sink_info); if (FAILED(hr)) - return hr; - - hr = IPin_QueryPinInfo(in, &info_in); - if (SUCCEEDED(hr)) - IBaseFilter_Release(info_in.pFilter); - if (FAILED(hr)) - goto out; - - if (info_out.pFilter == info_in.pFilter) - hr = VFW_E_CIRCULAR_GRAPH; - else { - IEnumPins *enumpins; - IPin *test; + ERR("Failed to query pin, hr %#x.\n", hr); + return hr; + } + IBaseFilter_Release(sink_info.pFilter);
- hr = IBaseFilter_EnumPins(info_out.pFilter, &enumpins); - if (FAILED(hr)) - goto out; - - IEnumPins_Reset(enumpins); - while ((hr = IEnumPins_Next(enumpins, 1, &test, NULL)) == S_OK) - { - PIN_DIRECTION dir = PINDIR_OUTPUT; - IPin_QueryDirection(test, &dir); - if (dir == PINDIR_INPUT) - { - IPin *victim = NULL; - IPin_ConnectedTo(test, &victim); - if (victim) - { - hr = CheckCircularConnection(This, victim, in); - IPin_Release(victim); - if (FAILED(hr)) - { - IPin_Release(test); - break; - } - } - } - IPin_Release(test); - } - IEnumPins_Release(enumpins); + hr = IPin_QueryPinInfo(source, &source_info); + if (FAILED(hr)) + { + ERR("Failed to query pin, hr %#x.\n", hr); + return hr; }
-out: - IBaseFilter_Release(info_out.pFilter); + if (sink_info.pFilter == source_info.pFilter) + { + WARN("Cyclic connection detected; returning VFW_E_CIRCULAR_GRAPH.\n"); + IBaseFilter_Release(source_info.pFilter); + return VFW_E_CIRCULAR_GRAPH; + } + + hr = IBaseFilter_EnumPins(source_info.pFilter, &enumpins); if (FAILED(hr)) - ERR("Checking filtergraph returned %08x, something's not right!\n", hr); - return hr; + { + ERR("Failed to enumerate pins, hr %#x.\n", hr); + IBaseFilter_Release(source_info.pFilter); + return hr; + } + + while ((hr = IEnumPins_Next(enumpins, 1, &upstream_sink, NULL)) == S_OK) + { + PIN_DIRECTION dir = PINDIR_OUTPUT; + + IPin_QueryDirection(upstream_sink, &dir); + if (dir == PINDIR_INPUT && IPin_ConnectedTo(upstream_sink, &upstream_source) == S_OK) + { + hr = check_cyclic_connection(upstream_source, sink); + IPin_Release(upstream_source); + if (FAILED(hr)) + { + IPin_Release(upstream_sink); + IEnumPins_Release(enumpins); + IBaseFilter_Release(source_info.pFilter); + return hr; + } + } + IPin_Release(upstream_sink); + } + IEnumPins_Release(enumpins); + + IBaseFilter_Release(source_info.pFilter); + return S_OK; }
static struct filter *find_sorted_filter(struct filter_graph *graph, IBaseFilter *iface) @@ -855,7 +856,7 @@ static void sort_filter_recurse(struct filter_graph *graph, struct filter *filte
TRACE("Sorting filter %p.\n", filter->filter);
- /* Cyclic connections should be caught by CheckCircularConnection(). */ + /* Cyclic connections should be caught by check_cyclic_connection(). */ assert(!filter->sorting);
filter->sorting = TRUE; @@ -935,13 +936,13 @@ static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface, IPin *ppi { if (dir == PINDIR_INPUT) { - hr = CheckCircularConnection(This, ppinOut, ppinIn); + hr = check_cyclic_connection(ppinOut, ppinIn); if (SUCCEEDED(hr)) hr = IPin_Connect(ppinOut, ppinIn, pmt); } else { - hr = CheckCircularConnection(This, ppinIn, ppinOut); + hr = check_cyclic_connection(ppinIn, ppinOut); if (SUCCEEDED(hr)) hr = IPin_Connect(ppinIn, ppinOut, pmt); }