From dfa4c07941322dbcad54507cd0acf271a6c719ab Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 2 Nov 2020 12:25:17 -0600 Subject: [PATCH] quartz: Treat a filter as supporting IMediaSeeking only if it supports TIME_FORMAT_MEDIA_TIME. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48715 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/filtergraph.c | 11 +++++++++-- dlls/quartz/tests/filtergraph.c | 10 +++++----- dlls/quartz/tests/videorenderer.c | 8 ++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index e5ae12d9452..0f22bb5888c 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -585,6 +585,8 @@ static BOOL has_output_pins(IBaseFilter *filter) static void update_seeking(struct filter *filter) { + IMediaSeeking *seeking; + if (!filter->seeking) { /* The Legend of Heroes: Trails of Cold Steel II destroys its filter when @@ -593,8 +595,13 @@ static void update_seeking(struct filter *filter) * Some filters (e.g. MediaStreamFilter) can become seekable when they are * already in the graph, so always try to query IMediaSeeking if it's not * cached yet. */ - if (FAILED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&filter->seeking))) - filter->seeking = NULL; + if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking))) + { + if (IMediaSeeking_IsFormatSupported(seeking, &TIME_FORMAT_MEDIA_TIME) == S_OK) + filter->seeking = seeking; + else + IMediaSeeking_Release(seeking); + } } } diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index ba63853ec7b..20a730f6aa0 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -3914,9 +3914,9 @@ static void test_ec_complete(void) IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL); hr = check_ec_complete(graph, &filter1.IBaseFilter_iface); - todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + ok(hr == E_ABORT, "Got hr %#x.\n", hr); - todo_wine ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref); + ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref); IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface); filter1.IMediaSeeking_iface.lpVtbl = NULL; @@ -4157,7 +4157,7 @@ static void test_graph_seeking(void) filter1.support_testguid = TRUE; hr = IMediaSeeking_GetDuration(seeking, &time); - todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); hr = IMediaSeeking_SetTimeFormat(seeking, &testguid); todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); @@ -4269,8 +4269,8 @@ static void test_graph_seeking(void) hr = IMediaSeeking_GetCapabilities(seeking, &caps); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(caps == (AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps); - todo_wine ok(!filter1.seeking_ref, "Unexpected seeking refcount %d.\n", filter1.seeking_ref); + ok(caps == (AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps); + ok(!filter1.seeking_ref, "Unexpected seeking refcount %d.\n", filter1.seeking_ref); ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref); filter1.support_media_time = TRUE; diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 448efe501b6..ed2639d2736 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -1156,7 +1156,7 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); ret = check_ec_complete(eventsrc, 0); - todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n"); + ok(!ret, "Got unexpected EC_COMPLETE.\n"); hr = join_thread(send_frame(input)); todo_wine ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr); @@ -1186,7 +1186,7 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) hr = IPin_EndOfStream(pin); ok(hr == S_OK, "Got hr %#x.\n", hr); ret = check_ec_complete(eventsrc, 0); - todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n"); + ok(!ret, "Got unexpected EC_COMPLETE.\n"); ret = check_ec_complete(eventsrc, 1600); todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n"); @@ -1212,7 +1212,7 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); ret = check_ec_complete(eventsrc, 0); - todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n"); + ok(!ret, "Got unexpected EC_COMPLETE.\n"); /* Test sending EOS and then flushing or stopping. */ @@ -1226,7 +1226,7 @@ static void test_eos(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) hr = IPin_EndOfStream(pin); ok(hr == S_OK, "Got hr %#x.\n", hr); ret = check_ec_complete(eventsrc, 0); - todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n"); + ok(!ret, "Got unexpected EC_COMPLETE.\n"); hr = IPin_BeginFlush(pin); ok(hr == S_OK, "Got hr %#x.\n", hr);