Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 515c713b32..c3c806b36f 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -125,13 +125,13 @@ static HRESULT WINAPI multimedia_stream_GetMediaStream(IAMMultiMediaStream *ifac }
static HRESULT WINAPI multimedia_stream_EnumMediaStreams(IAMMultiMediaStream *iface, - LONG Index, IMediaStream **ppMediaStream) + LONG index, IMediaStream **stream) { - struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *mmstream = impl_from_IAMMultiMediaStream(iface);
- FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, Index, ppMediaStream); + TRACE("mmstream %p, index %d, stream %p.\n", mmstream, index, stream);
- return E_NOTIMPL; + return IMediaStreamFilter_EnumMediaStreams(mmstream->filter, index, stream); }
static HRESULT WINAPI multimedia_stream_GetState(IAMMultiMediaStream *iface, STREAM_STATE *pCurrentState)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 7 +++++++ dlls/amstream/tests/amstream.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index c3c806b36f..6643d5d141 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -289,6 +289,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); HRESULT hr; IAMMediaStream* pStream; + IMediaStream *stream;
TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n", This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream); @@ -296,6 +297,12 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) return MS_E_PURPOSEID;
+ if (IMediaStreamFilter_GetMediaStream(This->filter, PurposeId, &stream) == S_OK) + { + IMediaStream_Release(stream); + return MS_E_PURPOSEID; + } + if (dwFlags & AMMSF_ADDDEFAULTRENDERER) { if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 6497dde91c..ef6c477843 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -651,7 +651,7 @@ static void test_add_stream(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); - todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + 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); @@ -701,7 +701,7 @@ static void test_add_stream(void) todo_wine check_get_stream(mmstream, stream_filter, &test_mspid, (IMediaStream *)&teststream);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); - todo_wine ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); ok(hr == S_OK, "Got hr %#x.\n", hr);
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);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 25 ++++++++++--------------- dlls/amstream/tests/amstream.c | 3 +++ 2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 6643d5d141..48abcaf8b4 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -305,26 +305,21 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
if (dwFlags & AMMSF_ADDDEFAULTRENDERER) { - if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) + IBaseFilter *dsound_render; + + if (!IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) { - /* Default renderer not supported by video stream */ + WARN("AMMSF_ADDDEFAULTRENDERER requested with id %s, returning MS_E_PURPOSEID.\n", debugstr_guid(PurposeId)); return MS_E_PURPOSEID; } - else - { - IBaseFilter* dsoundrender_filter;
- /* Create the default renderer for audio */ - hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&dsoundrender_filter); - if (SUCCEEDED(hr)) - { - hr = IGraphBuilder_AddFilter(This->pFilterGraph, dsoundrender_filter, NULL); - IBaseFilter_Release(dsoundrender_filter); - } - - /* No media stream created when the default renderer is used */ - return hr; + if (SUCCEEDED(hr = CoCreateInstance(&CLSID_DSoundRender, NULL, + CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&dsound_render))) + { + hr = IGraphBuilder_AddFilter(This->pFilterGraph, dsound_render, NULL); + IBaseFilter_Release(dsound_render); } + return hr; }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 7d38755388..67b504fd3f 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -839,6 +839,9 @@ static void test_add_stream(void) IGraphBuilder_Release(graph); }
+ hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, + AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == MS_E_PURPOSEID, "Got hr %#x.\n", hr); hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &test_mspid, AMMSF_ADDDEFAULTRENDERER, &audio_stream); todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/amstream/multimedia.c | 3 +++ dlls/amstream/tests/amstream.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 48abcaf8b4..6fb3ebd17c 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -307,6 +307,9 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac { IBaseFilter *dsound_render;
+ if (ret_stream) + return E_INVALIDARG; + if (!IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) { WARN("AMMSF_ADDDEFAULTRENDERER requested with id %s, returning MS_E_PURPOSEID.\n", debugstr_guid(PurposeId)); diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 67b504fd3f..a961b982cc 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -797,7 +797,7 @@ static void test_add_stream(void)
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, AMMSF_ADDDEFAULTRENDERER, &video_stream); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, AMMSF_ADDDEFAULTRENDERER, NULL); @@ -805,7 +805,7 @@ static void test_add_stream(void)
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, &audio_stream); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); @@ -826,9 +826,9 @@ static void test_add_stream(void) hr = IGraphBuilder_EnumFilters(graph, &enum_filters); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumFilters_Next(enum_filters, 3, filters, &count); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); - todo_wine ok(count == 2, "Got count %u.\n", count); - todo_wine ok(filters[1] == (IBaseFilter *)stream_filter, + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + ok(filters[1] == (IBaseFilter *)stream_filter, "Expected filter %p, got %p.\n", stream_filter, filters[1]); hr = IBaseFilter_GetClassID(filters[0], &clsid); ok(hr == S_OK, "Got hr %#x.\n", hr);