From 69c69143be02ce2e421fc6db384b47daa6060e7b Mon Sep 17 00:00:00 2001 From: Gijs Vermeulen Date: Tue, 23 Jun 2020 11:18:02 -0500 Subject: [PATCH] amstream: Implement IDirectDrawStreamSample::GetMediaStream(). Signed-off-by: Gijs Vermeulen Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/amstream/ddrawstream.c | 12 ++++++++++-- dlls/amstream/tests/amstream.c | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 0bfbe653e7e..ca6a910f3f9 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -1023,9 +1023,17 @@ static ULONG WINAPI ddraw_sample_Release(IDirectDrawStreamSample *iface) /*** IStreamSample methods ***/ static HRESULT WINAPI ddraw_sample_GetMediaStream(IDirectDrawStreamSample *iface, IMediaStream **media_stream) { - FIXME("(%p)->(%p): stub\n", iface, media_stream); + struct ddraw_sample *sample = impl_from_IDirectDrawStreamSample(iface); - return E_NOTIMPL; + TRACE("sample %p, media_stream %p.\n", sample, media_stream); + + if (!media_stream) + return E_POINTER; + + IAMMediaStream_AddRef(&sample->parent->IAMMediaStream_iface); + *media_stream = (IMediaStream *)&sample->parent->IAMMediaStream_iface; + + return S_OK; } static HRESULT WINAPI ddraw_sample_GetSampleTimes(IDirectDrawStreamSample *iface, STREAM_TIME *start_time, diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 1259de927df..03c8660a424 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -2050,13 +2050,13 @@ static void test_IDirectDrawStreamSample(void) if (0) { hr = IDirectDrawStreamSample_GetMediaStream(sample, NULL); - ok(hr == E_POINTER, "got 0x%08x\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); } hr = IDirectDrawStreamSample_GetMediaStream(sample, &stream2); - todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); - todo_wine ok(stream2 == stream, "Expected stream %p, got %p.\n", stream, stream2); - if (hr == S_OK) IMediaStream_Release(stream2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(stream2 == stream, "Expected stream %p, got %p.\n", stream, stream2); + IMediaStream_Release(stream2); hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface7, (void **)&surface7); ok(hr == S_OK, "got 0x%08x\n", hr);