Commit ca4f624e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

amstream: Check for an existing stream in IAMMultiMediaStream::AddMediaStream().

parent 6b04ca02
...@@ -289,6 +289,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac ...@@ -289,6 +289,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr; HRESULT hr;
IAMMediaStream* pStream; IAMMediaStream* pStream;
IMediaStream *stream;
TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n", TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n",
This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream); This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream);
...@@ -296,6 +297,12 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac ...@@ -296,6 +297,12 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
return MS_E_PURPOSEID; 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 (dwFlags & AMMSF_ADDDEFAULTRENDERER)
{ {
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
......
...@@ -652,7 +652,7 @@ static void test_add_stream(void) ...@@ -652,7 +652,7 @@ static void test_add_stream(void)
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); 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); hr = IAMMultiMediaStream_EnumMediaStreams(mmstream, 0, NULL);
todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
...@@ -702,7 +702,7 @@ static void test_add_stream(void) ...@@ -702,7 +702,7 @@ static void test_add_stream(void)
todo_wine check_get_stream(mmstream, stream_filter, &test_mspid, (IMediaStream *)&teststream); todo_wine check_get_stream(mmstream, stream_filter, &test_mspid, (IMediaStream *)&teststream);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); 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); hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment