quartz/filtergraph: Check for AM_FILTER_MISC_FLAGS_IS_RENDERER or IMediaSeeking to count renderers.

Instead of using IPin_QueryInternalConnections().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Zebediah Figura 2018-09-25 23:30:23 -05:00 committed by Alexandre Julliard
parent d65586ea95
commit 783c2d66a4
2 changed files with 42 additions and 12 deletions

View File

@ -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);
}

View File

@ -3080,10 +3080,8 @@ static void test_ec_complete(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 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, &param1, &param2, 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);