Commit 3e6eaaa2 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

amstream: Allow AMMSF_ADDDEFAULTRENDERER only with MSPID_PrimaryAudio.

parent c6d436f7
......@@ -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))
......
......@@ -841,6 +841,9 @@ static void test_add_stream(void)
}
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);
......
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