Commit 554e2641 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

amstream: Handle stream object parameter for IDirectDrawMediaStream.

parent a7059847
......@@ -339,9 +339,6 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
return MS_E_PURPOSEID;
if (stream_object)
FIXME("Specifying a stream object in params is not yet supported\n");
if (dwFlags & AMMSF_ADDDEFAULTRENDERER)
{
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
......@@ -367,9 +364,9 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
}
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream);
else
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->StreamType, &pStream);
if (SUCCEEDED(hr))
{
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IAMMediaStream*));
......
......@@ -37,8 +37,8 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
STREAM_TYPE StreamType, IAMMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
IUnknown *stream_object, STREAM_TYPE StreamType, IAMMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IAMMediaStream **media_stream) DECLSPEC_HIDDEN;
IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) DECLSPEC_HIDDEN;
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
......@@ -599,15 +599,15 @@ static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable =
};
HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream)
{
DirectDrawMediaStreamImpl *object;
PIN_INFO pin_info;
HRESULT hr;
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
TRACE("(%p,%s,%p,%p)\n", parent, debugstr_guid(purpose_id), stream_object, media_stream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl));
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......@@ -633,6 +633,10 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->purpose_id = *purpose_id;
object->stream_type = stream_type;
if (stream_object
&& FAILED(hr = IUnknown_QueryInterface(stream_object, &IID_IDirectDraw7, (void **)&object->ddraw)))
FIXME("Stream object doesn't implement IDirectDraw7 interface, hr %#x.\n", hr);
*media_stream = &object->IAMMediaStream_iface;
return S_OK;
......@@ -1139,15 +1143,18 @@ static const BaseInputPinFuncTable AudioMediaStreamInputPin_FuncTable =
};
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream)
{
AudioMediaStreamImpl *object;
PIN_INFO pin_info;
HRESULT hr;
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
TRACE("(%p,%s,%p,%p)\n", parent, debugstr_guid(purpose_id), stream_object, media_stream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl));
if (stream_object)
FIXME("Specifying a stream object is not yet supported.\n");
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
......
......@@ -551,8 +551,9 @@ static void test_IDirectDrawStreamSample(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(ddraw == ddraw2, "got %p, %p\n", ddraw, ddraw2);
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw7, (void**)&ddraw7);
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw7, (void **)&ddraw7);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(ddraw7 == pdd7, "Got IDirectDraw instance %p, expected %p.\n", ddraw7, pdd7);
IDirectDraw7_Release(ddraw7);
IDirectDraw_Release(ddraw2);
......@@ -566,7 +567,7 @@ static void test_IDirectDrawStreamSample(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(surface != NULL, "got %p\n", surface);
hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface7, (void**)&surface7);
hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface7, (void **)&surface7);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDirectDrawSurface7_Release(surface7);
......@@ -579,7 +580,7 @@ static void test_IDirectDrawStreamSample(void)
IDirectDrawSurface_Release(surface);
IDirectDrawStreamSample_Release(pddsample);
hr = IDirectDrawSurface7_QueryInterface(pdds7, &IID_IDirectDrawSurface, (void**)&surface);
hr = IDirectDrawSurface7_QueryInterface(pdds7, &IID_IDirectDrawSurface, (void **)&surface);
ok(hr == S_OK, "got 0x%08x\n", hr);
EXPECT_REF(surface, 1);
......
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