[PATCH 3/3] amstream: Implement IMediaStreamFilter::GetStopPosition.

Myah Caron qsniyg at protonmail.com
Fri Jul 24 01:24:42 CDT 2020


Signed-off-by: Myah Caron <qsniyg at protonmail.com>
---
 dlls/amstream/filter.c         | 24 ++++++++++++++++++++++--
 dlls/amstream/tests/amstream.c | 15 ++++++++++++---
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c
index ef23edfae3..6d1b107df5 100644
--- a/dlls/amstream/filter.c
+++ b/dlls/amstream/filter.c
@@ -800,9 +800,29 @@ static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG

 static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
 {
-    FIXME("iface %p, stop %p, stub!\n", iface, stop);
+    struct filter *filter = impl_from_IMediaSeeking(iface);
+    IMediaSeeking *seeking;
+    HRESULT hr;

-    return E_NOTIMPL;
+    TRACE("iface %p, stop %p\n", iface, stop);
+
+    EnterCriticalSection(&filter->cs);
+
+    seeking = get_seeking(filter->seekable_stream);
+
+    if (!seeking)
+    {
+        LeaveCriticalSection(&filter->cs);
+        return E_NOTIMPL;
+    }
+
+    hr = IMediaSeeking_GetStopPosition(seeking, stop);
+
+    IMediaSeeking_Release(seeking);
+
+    LeaveCriticalSection(&filter->cs);
+
+    return hr;
 }

 static HRESULT WINAPI filter_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 50b2d5a761..d9c982948d 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -917,8 +917,11 @@ static HRESULT WINAPI testsource_seeking_GetDuration(IMediaSeeking *iface, LONGL

 static HRESULT WINAPI testsource_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
 {
-    ok(0, "Unexpected call.\n");
-    return E_NOTIMPL;
+    struct testfilter *filter = impl_from_IMediaSeeking(iface);
+
+    *stop = 0x8000000000000000ULL;
+
+    return S_OK;
 }

 static HRESULT WINAPI testsource_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
@@ -4814,7 +4817,7 @@ static void test_mediastreamfilter_set_positions(void)
     IAMMediaStream *stream1;
     IAMMediaStream *stream2;
     IAMMediaStream *stream3;
-    LONGLONG stop_position;
+    LONGLONG stop_position, in_stop_position;
     LONGLONG duration;
     IMediaSeeking *seeking;
     IGraphBuilder *graph;
@@ -4912,6 +4915,12 @@ static void test_mediastreamfilter_set_positions(void)
     ok(duration == 0x8000000000000000ULL, "Got duration %s.\n",
             wine_dbgstr_longlong(duration));

+    in_stop_position = 0xdeadbeefdeadbeefULL;
+    hr = IMediaSeeking_GetStopPosition(seeking, &in_stop_position);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(in_stop_position == 0x8000000000000000ULL, "Got stop position %s.\n",
+            wine_dbgstr_longlong(in_stop_position));
+
     source2.set_positions_hr = E_FAIL;
     source1.current_position = 0xdeadbeefdeadbeefULL;
     source1.stop_position = 0xdeadbeefdeadbeefULL;
--
2.27.0





More information about the wine-devel mailing list