Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/amstream_private.h | 4 ---- dlls/amstream/audiostream.c | 32 ------------------------------- dlls/amstream/ddrawstream.c | 33 -------------------------------- dlls/amstream/multimedia.c | 18 +++++++++++++---- dlls/amstream/tests/amstream.c | 2 +- 5 files changed, 15 insertions(+), 74 deletions(-)
diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index d567fe3f68..e71563cb11 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -39,9 +39,5 @@ HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT filter_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT ddraw_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT audio_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; -HRESULT ddraw_stream_create_and_initialize(IMultiMediaStream *parent, const MSPID *purpose_id, - IUnknown *stream_object, STREAM_TYPE type, IAMMediaStream **stream) DECLSPEC_HIDDEN; -HRESULT audio_stream_create_and_initialize(IMultiMediaStream *parent, const MSPID *purpose_id, - IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) DECLSPEC_HIDDEN;
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */ diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index ea6805e065..bba6c8d0a5 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1328,35 +1328,3 @@ HRESULT audio_stream_create(IUnknown *outer, void **out)
return S_OK; } - -HRESULT audio_stream_create_and_initialize(IMultiMediaStream *parent, const MSPID *purpose_id, - IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) -{ - struct audio_stream *object; - - TRACE("(%p,%s,%p,%p)\n", parent, debugstr_guid(purpose_id), stream_object, media_stream); - - 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; - - object->IAMMediaStream_iface.lpVtbl = &audio_IAMMediaStream_vtbl; - object->IAudioMediaStream_iface.lpVtbl = &audio_IAudioMediaStream_vtbl; - object->IMemInputPin_iface.lpVtbl = &audio_meminput_vtbl; - object->IPin_iface.lpVtbl = &audio_sink_vtbl; - object->ref = 1; - - InitializeCriticalSection(&object->cs); - object->parent = parent; - object->purpose_id = *purpose_id; - object->stream_type = stream_type; - list_init(&object->receive_queue); - list_init(&object->update_queue); - - *media_stream = &object->IAMMediaStream_iface; - - return S_OK; -} diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 0d98af9942..fe447a0bf1 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -980,39 +980,6 @@ HRESULT ddraw_stream_create(IUnknown *outer, void **out) return S_OK; }
-HRESULT ddraw_stream_create_and_initialize(IMultiMediaStream *parent, const MSPID *purpose_id, - IUnknown *stream_object, STREAM_TYPE stream_type, IAMMediaStream **media_stream) -{ - struct ddraw_stream *object; - HRESULT hr; - - TRACE("(%p,%s,%p,%p)\n", parent, debugstr_guid(purpose_id), stream_object, media_stream); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - return E_OUTOFMEMORY; - - object->IAMMediaStream_iface.lpVtbl = &ddraw_IAMMediaStream_vtbl; - object->IDirectDrawMediaStream_iface.lpVtbl = &ddraw_IDirectDrawMediaStream_Vtbl; - object->IMemInputPin_iface.lpVtbl = &ddraw_meminput_vtbl; - object->IPin_iface.lpVtbl = &ddraw_sink_vtbl; - object->ref = 1; - - InitializeCriticalSection(&object->cs); - - object->parent = parent; - 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; -} - typedef struct { IDirectDrawStreamSample IDirectDrawStreamSample_iface; LONG ref; diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 7e2ae9c9b2..2725a2b033 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -301,6 +301,7 @@ static HRESULT WINAPI multimedia_stream_GetFilter(IAMMultiMediaStream *iface, static void add_stream(struct multimedia_stream *mmstream, IAMMediaStream *stream, IMediaStream **ret_stream) { IMediaStreamFilter_AddMediaStream(mmstream->filter, stream); + IAMMediaStream_JoinAMMultiMediaStream(stream, &mmstream->IAMMultiMediaStream_iface); if (ret_stream) { *ret_stream = (IMediaStream *)stream; @@ -315,6 +316,7 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac HRESULT hr; IAMMediaStream* pStream; IMediaStream *stream; + const CLSID *clsid;
TRACE("mmstream %p, stream_object %p, id %s, flags %#x, ret_stream %p.\n", This, stream_object, debugstr_guid(PurposeId), dwFlags, ret_stream); @@ -377,18 +379,26 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) - hr = ddraw_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); + clsid = &CLSID_AMDirectDrawStream; else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) - hr = audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); + clsid = &CLSID_AMAudioStream; else return MS_E_PURPOSEID;
- if (SUCCEEDED(hr)) + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&pStream); + if (FAILED(hr)) + return hr; + + hr = IAMMediaStream_Initialize(pStream, stream_object, dwFlags, PurposeId, This->type); + if (FAILED(hr)) { - add_stream(This, pStream, ret_stream); IAMMediaStream_Release(pStream); + return hr; }
+ add_stream(This, pStream, ret_stream); + IAMMediaStream_Release(pStream); + return hr; }
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 95f3bc0d85..d5b90d9257 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -730,7 +730,7 @@ static void test_add_stream(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(stream == (IMediaStream *)&teststream, "Streams didn't match.\n"); if (hr == S_OK) IMediaStream_Release(stream); - todo_wine ok(teststream.mmstream == mmstream, "IAMMultiMediaStream objects didn't match.\n"); + ok(teststream.mmstream == mmstream, "IAMMultiMediaStream objects didn't match.\n"); ok(teststream.filter == stream_filter, "IMediaStreamFilter objects didn't match.\n"); todo_wine ok(!!teststream.graph, "Expected a non-NULL graph.\n");