diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 4dfe5c081d7..c8595646a03 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2084,8 +2084,34 @@ static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID dispIdMem typedef HRESULT(WINAPI *fnFoundFilter)(IBaseFilter *, DWORD_PTR data); +static BOOL has_output_pins(IBaseFilter *filter) +{ + IEnumPins *enumpins; + PIN_DIRECTION dir; + IPin *pin; + + if (FAILED(IBaseFilter_EnumPins(filter, &enumpins))) + return FALSE; + + while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK) + { + IPin_QueryDirection(pin, &dir); + IPin_Release(pin); + if (dir == PINDIR_OUTPUT) + { + IEnumPins_Release(enumpins); + return TRUE; + } + } + + IEnumPins_Release(enumpins); + return FALSE; +} + static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundFilter FoundFilter, DWORD_PTR data) { + IAMFilterMiscFlags *flags; + IMediaSeeking *seeking; HRESULT hr; IPin* pInputPin; IPin** ppPins; @@ -2108,13 +2134,7 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF if (SUCCEEDED(hr)) { - if (nb == 0) - { - TRACE("Reached a renderer\n"); - /* Count renderers for end of stream notification */ - pGraph->nRenderers++; - } - else + if (nb) { for(i = 0; i < nb; i++) { @@ -2129,6 +2149,21 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF } TRACE("Doing stuff with filter %p\n", PinInfo.pFilter); + if (SUCCEEDED(IBaseFilter_QueryInterface(PinInfo.pFilter, + &IID_IAMFilterMiscFlags, (void **)&flags))) + { + if (IAMFilterMiscFlags_GetMiscFlags(flags) & AM_FILTER_MISC_FLAGS_IS_RENDERER) + pGraph->nRenderers++; + IAMFilterMiscFlags_Release(flags); + } + else if (SUCCEEDED(IBaseFilter_QueryInterface(PinInfo.pFilter, + &IID_IMediaSeeking, (void **)&seeking))) + { + if (!has_output_pins(PinInfo.pFilter)) + pGraph->nRenderers++; + IMediaSeeking_Release(seeking); + } + FoundFilter(PinInfo.pFilter, data); } diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 1345e4180fd..74a3b68e436 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -3080,10 +3080,8 @@ static void test_ec_complete(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMediaEvent_GetEvent(eventsrc, &code, ¶m1, ¶m2, 0); -todo_wine { ok(hr == S_OK, "Got hr %#x.\n", hr); ok(code == EC_COMPLETE, "Got code %#x.\n", code); -} ok(param1 == S_OK, "Got param1 %#lx.\n", param1); ok(!param2, "Got param2 %#lx.\n", param2); hr = IMediaEvent_FreeEventParams(eventsrc, code, param1, param2); @@ -3096,7 +3094,6 @@ todo_wine { ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMediaEvent_GetEvent(eventsrc, &code, ¶m1, ¶m2, 50); -todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); IMediaControl_Stop(control); @@ -3156,7 +3153,6 @@ todo_wine IFilterGraph2_ConnectDirect(graph, &source_pins[0].IPin_iface, &filter1_pin.IPin_iface, NULL); hr = check_ec_complete(graph, &filter1.IBaseFilter_iface); -todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface); @@ -3185,7 +3181,6 @@ todo_wine IFilterGraph2_ConnectDirect(graph, &source_pins[0].IPin_iface, &filter1_pin.IPin_iface, NULL); hr = check_ec_complete(graph, &filter1.IBaseFilter_iface); -todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); IMediaControl_Release(control);