Zebediah Figura : quartz: Return the stop position from GetCurrentPosition() after all filters return EC_COMPLETE.

Alexandre Julliard julliard at winehq.org
Tue Jul 21 15:40:20 CDT 2020


Module: wine
Branch: master
Commit: 8c9d60c308c20e92bbbb204008082dad7ad160c9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8c9d60c308c20e92bbbb204008082dad7ad160c9

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jul 20 17:49:10 2020 -0500

quartz: Return the stop position from GetCurrentPosition() after all filters return EC_COMPLETE.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/filtergraph.c       | 15 +++++++++++++--
 dlls/quartz/tests/filtergraph.c |  5 ++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 22d7f7b445..7d6463c1f3 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -219,10 +219,11 @@ struct filter_graph
     /* Respectively: the last timestamp at which we started streaming, and the
      * current offset within the stream. */
     REFERENCE_TIME stream_start, stream_elapsed;
-
+    REFERENCE_TIME stream_stop;
     LONGLONG current_pos;
 
     unsigned int needs_async_run : 1;
+    unsigned int got_ec_complete : 1;
 };
 
 struct enum_filters
@@ -1739,6 +1740,7 @@ static void update_render_count(struct filter_graph *graph)
 /* Perform the paused -> running transition. The caller must hold graph->cs. */
 static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start)
 {
+    REFERENCE_TIME stream_stop;
     struct filter *filter;
     HRESULT hr = S_OK;
 
@@ -1757,6 +1759,9 @@ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_sta
         stream_start += 200 * 10000;
     }
 
+    if (SUCCEEDED(IMediaSeeking_GetStopPosition(&graph->IMediaSeeking_iface, &stream_stop)))
+        graph->stream_stop = stream_stop;
+
     LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
     {
         HRESULT filter_hr = IBaseFilter_Run(filter->filter, stream_start);
@@ -2322,7 +2327,11 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
 
     EnterCriticalSection(&graph->cs);
 
-    if (graph->state == State_Running && graph->refClock)
+    if (graph->got_ec_complete)
+    {
+        ret = graph->stream_stop;
+    }
+    else if (graph->state == State_Running && graph->refClock)
     {
         REFERENCE_TIME time;
         IReferenceClock_GetTime(graph->refClock, &time);
@@ -4982,6 +4991,7 @@ static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
     graph->state = State_Stopped;
     graph->needs_async_run = 0;
     work = graph->async_run_work;
+    graph->got_ec_complete = 0;
 
     /* Update the current position, probably to synchronize multiple streams. */
     IMediaSeeking_SetPositions(&graph->IMediaSeeking_iface, &graph->current_pos,
@@ -5281,6 +5291,7 @@ static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG EventCo
                 PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance);
             }
             This->CompletionStatus = EC_COMPLETE;
+            This->got_ec_complete = 1;
             SetEvent(This->hEventCompletion);
         }
     }
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 1eecd0483b..9219b30cec 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -530,7 +530,6 @@ static void test_media_event(IFilterGraph2 *graph)
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
     ok(hr == S_OK, "GetCurrentPosition() failed: %#x\n", hr);
-todo_wine
     ok(current == stop, "expected %s, got %s\n", wine_dbgstr_longlong(stop), wine_dbgstr_longlong(current));
 
     hr = IMediaControl_Stop(control);
@@ -4512,7 +4511,7 @@ static void test_graph_seeking(void)
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
+    ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaControl_Stop(control);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -4535,7 +4534,7 @@ static void test_graph_seeking(void)
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
+    ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaControl_Stop(control);
     ok(hr == S_OK, "Got hr %#x.\n", hr);




More information about the wine-cvs mailing list