Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45382 Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/amstream/amstream.c | 7 ++----- dlls/amstream/amstream_private.h | 4 ++-- dlls/amstream/mediastream.c | 19 +++++++++++++------ dlls/amstream/tests/amstream.c | 7 ++++--- 4 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/dlls/amstream/amstream.c b/dlls/amstream/amstream.c index 463cba690b39..3b2f71add5ba 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/amstream.c @@ -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*)); diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index 64a376f0588c..8f25b8e248e6 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -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__ */ diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 4971bf166c6d..bc6159750228 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -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;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 1a14572c8a2d..97111d6b85f3 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -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);