Signed-off-by: Myah Caron qsniyg@protonmail.com --- v2: Add test case, return E_NOINTERFACE if This->media_seeking is missing (as uncovered by test case). --- dlls/amstream/multimedia.c | 7 ++-- dlls/amstream/tests/amstream.c | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 200bd5c4a5..8f978b72ff 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -177,9 +177,12 @@ static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface, { struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration); + TRACE("(%p/%p)->(%p)\n", This, iface, pDuration);
- return E_NOTIMPL; + if (!This->media_seeking) + return E_NOINTERFACE; + + return IMediaSeeking_GetDuration(This->media_seeking, pDuration); }
static HRESULT WINAPI multimedia_stream_Seek(IAMMultiMediaStream *iface, STREAM_TIME seek_time) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 48953684f9..70fc4f02d0 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -335,6 +335,65 @@ static void test_openfile(const WCHAR *test_avi_path) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_mmstream_get_duration(const WCHAR *test_avi_path) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + LONGLONG duration; + HRESULT hr; + ULONG ref; + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", + wine_dbgstr_longlong(duration)); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(duration == 0xf4240ULL, "Got duration %s.\n", + wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(duration == 0, "Got duration %s.\n", + wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); + todo_wine ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + todo_wine ok(duration == 0, "Got duration %s.\n", + wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_renderfile(const WCHAR *test_avi_path) { IAMMultiMediaStream *pams; @@ -5351,6 +5410,7 @@ START_TEST(amstream) test_avi_path = load_resource(L"test.avi");
test_openfile(test_avi_path); + test_mmstream_get_duration(test_avi_path); test_renderfile(test_avi_path);
unload_resource(test_avi_path); -- 2.27.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76111
Your paranoid android.
=== w2008s64 (32 bit report) ===
amstream: amstream.c:362: Test failed: Got hr 0x1. amstream.c:363: Test failed: Got duration 0.
=== w2008s64 (64 bit report) ===
amstream: amstream.c:362: Test failed: Got hr 0x1. amstream.c:363: Test failed: Got duration 0.