amstream: No media stream is created when the defaut renderer is used.

This commit is contained in:
Christian Costa 2012-03-26 10:10:05 +02:00 committed by Alexandre Julliard
parent 5512d8e700
commit aae32fd4fd
2 changed files with 24 additions and 28 deletions

View File

@ -329,8 +329,29 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
return MS_E_PURPOSEID;
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && (dwFlags & AMMSF_ADDDEFAULTRENDERER))
if (dwFlags & AMMSF_ADDDEFAULTRENDERER)
{
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
{
/* Default renderer not supported by video stream */
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;
}
}
hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr))
@ -345,31 +366,6 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
This->pStreams[This->nbStreams] = pStream;
This->nbStreams++;
if (dwFlags & AMMSF_ADDDEFAULTRENDERER)
{
if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
{
IBaseFilter* dsoundrender_filter;
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);
}
if (FAILED(hr))
{
IMediaStream_Release(pStream);
pStream = NULL;
This->nbStreams--;
}
}
else
{
FIXME("Default renderer only supported for audio\n");
}
}
if (ppNewStream)
*ppNewStream = pStream;
}

View File

@ -212,7 +212,7 @@ static void test_media_streams(void)
hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL);
ok((hr == S_OK) || (hr == VFW_E_NO_AUDIO_HARDWARE), "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr);
hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryAudio, &audio_stream);
todo_wine ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr);
ok(hr == MS_E_NOSTREAM, "IAMMultiMediaStream_GetMediaStream returned: %x\n", hr);
/* Verify a stream is created when no default renderer is used */
hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, 0, NULL);