[PATCH 1/3] amstream: Implement IMediaStreamFilter::GetDuration.

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


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

diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c
index 0a06e78180..ef23edfae3 100644
--- a/dlls/amstream/filter.c
+++ b/dlls/amstream/filter.c
@@ -773,9 +773,29 @@ static HRESULT WINAPI filter_seeking_SetTimeFormat(IMediaSeeking *iface, const G

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

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

 static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 8adf9db934..50b2d5a761 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -4815,6 +4815,7 @@ static void test_mediastreamfilter_set_positions(void)
     IAMMediaStream *stream2;
     IAMMediaStream *stream3;
     LONGLONG stop_position;
+    LONGLONG duration;
     IMediaSeeking *seeking;
     IGraphBuilder *graph;
     IPin *pin1;
@@ -4905,6 +4906,12 @@ static void test_mediastreamfilter_set_positions(void)
     ok(source3.stop_position == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n",
             wine_dbgstr_longlong(source3.stop_position));

+    duration = 0xdeadbeefdeadbeefULL;
+    hr = IMediaSeeking_GetDuration(seeking, &duration);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(duration == 0x8000000000000000ULL, "Got duration %s.\n",
+            wine_dbgstr_longlong(duration));
+
     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