Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/filter.c | 15 ++++++++++++--- dlls/amstream/tests/amstream.c | 23 +++++++++++------------ 2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c index 4b0951cb6a..80a885de24 100644 --- a/dlls/amstream/filter.c +++ b/dlls/amstream/filter.c @@ -474,11 +474,20 @@ static HRESULT WINAPI filter_GetMediaStream(IMediaStreamFilter *iface, REFMSPID return MS_E_NOSTREAM; }
-static HRESULT WINAPI filter_EnumMediaStreams(IMediaStreamFilter *iface, LONG Index, IMediaStream **ppMediaStream) +static HRESULT WINAPI filter_EnumMediaStreams(IMediaStreamFilter *iface, LONG index, IMediaStream **stream) { - FIXME("(%p)->(%d,%p): Stub!\n", iface, Index, ppMediaStream); + struct filter *filter = impl_from_IMediaStreamFilter(iface);
- return E_NOTIMPL; + TRACE("filter %p, index %d, stream %p.\n", filter, index, stream); + + if (index >= filter->nb_streams) + return S_FALSE; + + if (!stream) + return E_POINTER; + + IMediaStream_AddRef(*stream = (IMediaStream *)filter->streams[index]); + return S_OK; }
static HRESULT WINAPI filter_SupportSeeking(IMediaStreamFilter *iface, BOOL bRenderer) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index ef6c477843..7d38755388 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -572,19 +572,18 @@ static void check_enum_stream_(int line, IAMMultiMediaStream *mmstream, HRESULT hr;
hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, index, &stream); - todo_wine ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), + ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), "IAMMultiMediaStream::EnumMediaStreams() returned %#x.\n", hr); hr = IMediaStreamFilter_EnumMediaStreams(filter, index, &stream2); - todo_wine ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), + ok_(__FILE__, line)(hr == (expect ? S_OK : S_FALSE), "IMediaStreamFilter::EnumMediaStreams() returned %#x.\n", hr); if (hr == S_OK) { ok_(__FILE__, line)(stream == expect, "Expected stream %p, got %p.\n", expect, stream); ok_(__FILE__, line)(stream2 == expect, "Expected stream %p, got %p.\n", expect, stream2); + IMediaStream_Release(stream); + IMediaStream_Release(stream2); } - - if (stream) IMediaStream_Release(stream); - if (stream2) IMediaStream_Release(stream2); }
#define check_get_stream(a,b,c,d) check_get_stream_(__LINE__,a,b,c,d) @@ -628,9 +627,9 @@ static void test_add_stream(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 0, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetMediaStream(mmstream, &MSPID_PrimaryAudio, NULL); todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); @@ -654,13 +653,13 @@ static void test_add_stream(void) ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 0, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 1, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IMediaStreamFilter_EnumMediaStreams(stream_filter, 1, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr);
check_enum_stream(mmstream, stream_filter, 0, video_stream); check_enum_stream(mmstream, stream_filter, 1, NULL); @@ -693,7 +692,7 @@ static void test_add_stream(void)
check_enum_stream(mmstream, stream_filter, 0, video_stream); check_enum_stream(mmstream, stream_filter, 1, audio_stream); - check_enum_stream(mmstream, stream_filter, 2, (IMediaStream *)&teststream); + todo_wine check_enum_stream(mmstream, stream_filter, 2, (IMediaStream *)&teststream); check_enum_stream(mmstream, stream_filter, 3, NULL);
check_get_stream(mmstream, stream_filter, &MSPID_PrimaryVideo, video_stream);