Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/amstream_private.h | 4 ++-- dlls/amstream/audiostream.c | 2 +- dlls/amstream/ddrawstream.c | 2 +- dlls/amstream/multimedia.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index bec107f819..96b933f5bc 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -37,9 +37,9 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT filter_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; -HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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(IMultiMediaStream *parent, const MSPID *purpose_id, +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 68b8b84f50..349e657405 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1292,7 +1292,7 @@ static const IMemInputPinVtbl audio_meminput_vtbl = audio_meminput_ReceiveCanBlock, };
-HRESULT audio_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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; diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 9c552f1a03..d21bf207ef 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -940,7 +940,7 @@ static const IMemInputPinVtbl ddraw_meminput_vtbl = ddraw_meminput_ReceiveCanBlock, };
-HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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; diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index be8fd4ecbf..7e2ae9c9b2 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -377,9 +377,9 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) - hr = ddraw_stream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); + hr = ddraw_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio)) - hr = audio_stream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); + hr = audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream); else return MS_E_PURPOSEID;
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/amstream_classes.idl | 7 +++++++ dlls/amstream/amstream_private.h | 2 ++ dlls/amstream/audiostream.c | 24 ++++++++++++++++++++++++ dlls/amstream/ddrawstream.c | 22 ++++++++++++++++++++++ dlls/amstream/main.c | 3 ++- 5 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/dlls/amstream/amstream_classes.idl b/dlls/amstream/amstream_classes.idl index e6bda830b4..2251bf734e 100644 --- a/dlls/amstream/amstream_classes.idl +++ b/dlls/amstream/amstream_classes.idl @@ -34,6 +34,13 @@ coclass MediaStreamFilter { interface IMediaStreamFilter; } ] coclass AMDirectDrawStream { interface IAMMultiMediaStream; }
+[ + helpstring("AuStream Class"), + threading(both), + uuid(8496e040-af4c-11d0-8212-00c04fc32c45) +] +coclass AMAudioStream { interface IAMMediaStream; } + [ helpstring("MMStream Class"), threading(both), diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index 96b933f5bc..d567fe3f68 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -37,6 +37,8 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; 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, diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 349e657405..2379a59350 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1292,6 +1292,30 @@ static const IMemInputPinVtbl audio_meminput_vtbl = audio_meminput_ReceiveCanBlock, };
+HRESULT audio_stream_create(IUnknown *outer, void **out) +{ + struct audio_stream *object; + + 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); + list_init(&object->receive_queue); + list_init(&object->update_queue); + + TRACE("Created audio stream %p.\n", object); + *out = &object->IAMMediaStream_iface; + + 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) { diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index d21bf207ef..2b0c871d58 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -940,6 +940,28 @@ static const IMemInputPinVtbl ddraw_meminput_vtbl = ddraw_meminput_ReceiveCanBlock, };
+HRESULT ddraw_stream_create(IUnknown *outer, void **out) +{ + struct ddraw_stream *object; + + 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); + + TRACE("Created ddraw stream %p.\n", object); + *out = &object->IAMMediaStream_iface; + + 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) { diff --git a/dlls/amstream/main.c b/dlls/amstream/main.c index c718f42448..c581e516bd 100644 --- a/dlls/amstream/main.c +++ b/dlls/amstream/main.c @@ -74,7 +74,8 @@ struct object_creation_info static const struct object_creation_info object_creation[] = { { &CLSID_AMMultiMediaStream, multimedia_stream_create }, - { &CLSID_AMDirectDrawStream, multimedia_stream_create }, + { &CLSID_AMDirectDrawStream, ddraw_stream_create }, + { &CLSID_AMAudioStream, audio_stream_create }, { &CLSID_AMAudioData, AMAudioData_create }, { &CLSID_MediaStreamFilter, filter_create } };
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/audiostream.c | 16 +++++++++++--- dlls/amstream/tests/amstream.c | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 2379a59350..efa3e2aac5 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -505,11 +505,21 @@ static HRESULT WINAPI audio_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface static HRESULT WINAPI audio_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags, REFMSPID purpose_id, const STREAM_TYPE stream_type) { - struct audio_stream *This = impl_from_IAMMediaStream(iface); + struct audio_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type); + TRACE("stream %p, source_object %p, flags %x, purpose_id %s, stream_type %u.\n", stream, source_object, flags, + debugstr_guid(purpose_id), stream_type);
- return S_FALSE; + if (!purpose_id) + return E_POINTER; + + if (flags & AMMSF_CREATEPEER) + FIXME("AMMSF_CREATEPEER is not yet supported.\n"); + + stream->purpose_id = *purpose_id; + stream->stream_type = stream_type; + + return S_OK; }
static HRESULT WINAPI audio_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 073e372c94..e233337e6f 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -3046,6 +3046,44 @@ static void test_audiostream_receive(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_audiostream_initialize(void) +{ + IAMMediaStream *stream; + STREAM_TYPE type; + MSPID mspid; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Crashes on native. */ + if (0) + { + hr = IAMMediaStream_Initialize(stream, NULL, 0, NULL, STREAMTYPE_WRITE); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + } + + hr = IAMMediaStream_Initialize(stream, NULL, 0, &test_mspid, STREAMTYPE_WRITE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_GetInformation(stream, &mspid, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&mspid, &test_mspid), "Got mspid %s.\n", wine_dbgstr_guid(&mspid)); + ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type); + + hr = IAMMediaStream_Initialize(stream, NULL, 0, &MSPID_PrimaryAudio, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_GetInformation(stream, &mspid, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&mspid, &MSPID_PrimaryAudio), "Got mspid %s.\n", wine_dbgstr_guid(&mspid)); + ok(type == STREAMTYPE_READ, "Got type %u.\n", type); + + ref = IAMMediaStream_Release(stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void CALLBACK apc_func(ULONG_PTR param) { } @@ -3681,6 +3719,7 @@ START_TEST(amstream) test_audiostream_set_state(); test_audiostream_end_of_stream(); test_audiostream_receive(); + test_audiostream_initialize();
test_audiostreamsample_update(); test_audiostreamsample_completion_status();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72112
Your paranoid android.
=== debiant (32 bit report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit French report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (64 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413e18).
Report validation errors: amstream:amstream crashed (c0000005)
On 5/22/20 10:40 AM, Anton Baskanov wrote:
Signed-off-by: Anton Baskanov baskanov@gmail.com
dlls/amstream/audiostream.c | 16 +++++++++++--- dlls/amstream/tests/amstream.c | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 2379a59350..efa3e2aac5 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -505,11 +505,21 @@ static HRESULT WINAPI audio_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface static HRESULT WINAPI audio_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags, REFMSPID purpose_id, const STREAM_TYPE stream_type) {
- struct audio_stream *This = impl_from_IAMMediaStream(iface);
- struct audio_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
- TRACE("stream %p, source_object %p, flags %x, purpose_id %s, stream_type %u.\n", stream, source_object, flags,
debugstr_guid(purpose_id), stream_type);
- return S_FALSE;
- if (!purpose_id)
return E_POINTER;
- if (flags & AMMSF_CREATEPEER)
FIXME("AMMSF_CREATEPEER is not yet supported.\n");
- stream->purpose_id = *purpose_id;
- stream->stream_type = stream_type;
- return S_OK;
}
I think this deserves a FIXME for source_object.
static HRESULT WINAPI audio_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 073e372c94..e233337e6f 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -3046,6 +3046,44 @@ static void test_audiostream_receive(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_audiostream_initialize(void) +{
- IAMMediaStream *stream;
- STREAM_TYPE type;
- MSPID mspid;
- HRESULT hr;
- ULONG ref;
- hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- /* Crashes on native. */
- if (0)
- {
hr = IAMMediaStream_Initialize(stream, NULL, 0, NULL, STREAMTYPE_WRITE);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
- }
- hr = IAMMediaStream_Initialize(stream, NULL, 0, &test_mspid, STREAMTYPE_WRITE);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IAMMediaStream_GetInformation(stream, &mspid, &type);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(IsEqualGUID(&mspid, &test_mspid), "Got mspid %s.\n", wine_dbgstr_guid(&mspid));
- ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type);
- hr = IAMMediaStream_Initialize(stream, NULL, 0, &MSPID_PrimaryAudio, STREAMTYPE_READ);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = IAMMediaStream_GetInformation(stream, &mspid, &type);
- ok(hr == S_OK, "Got hr %#x.\n", hr);
- ok(IsEqualGUID(&mspid, &MSPID_PrimaryAudio), "Got mspid %s.\n", wine_dbgstr_guid(&mspid));
- ok(type == STREAMTYPE_READ, "Got type %u.\n", type);
- ref = IAMMediaStream_Release(stream);
- ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
static void CALLBACK apc_func(ULONG_PTR param) { } @@ -3681,6 +3719,7 @@ START_TEST(amstream) test_audiostream_set_state(); test_audiostream_end_of_stream(); test_audiostream_receive();
test_audiostream_initialize();
test_audiostreamsample_update(); test_audiostreamsample_completion_status();
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/ddrawstream.c | 21 +++++++++++-- dlls/amstream/tests/amstream.c | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 2b0c871d58..3bd5f46e02 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -198,11 +198,26 @@ static HRESULT WINAPI ddraw_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface static HRESULT WINAPI ddraw_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags, REFMSPID purpose_id, const STREAM_TYPE stream_type) { - struct ddraw_stream *This = impl_from_IAMMediaStream(iface); + struct ddraw_stream *stream = impl_from_IAMMediaStream(iface); + HRESULT hr;
- FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type); + TRACE("stream %p, source_object %p, flags %x, purpose_id %s, stream_type %u.\n", stream, source_object, flags, + debugstr_guid(purpose_id), stream_type);
- return S_FALSE; + if (!purpose_id) + return E_POINTER; + + if (flags & AMMSF_CREATEPEER) + FIXME("AMMSF_CREATEPEER is not yet supported.\n"); + + stream->purpose_id = *purpose_id; + stream->stream_type = stream_type; + + if (source_object + && FAILED(hr = IUnknown_QueryInterface(source_object, &IID_IDirectDraw7, (void **)&stream->ddraw))) + FIXME("Stream object doesn't implement IDirectDraw7 interface, hr %#x.\n", hr); + + return S_OK; }
static HRESULT WINAPI ddraw_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index e233337e6f..f6e9b0d992 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -3545,6 +3545,61 @@ void test_audiostreamsample_completion_status(void) CloseHandle(event); }
+static void test_ddrawstream_initialize(void) +{ + IDirectDrawMediaStream *ddraw_stream; + IAMMediaStream *stream; + IDirectDraw *ddraw2; + IDirectDraw *ddraw; + STREAM_TYPE type; + MSPID mspid; + HRESULT hr; + ULONG ref; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = CoCreateInstance(&CLSID_AMDirectDrawStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_QueryInterface(stream, &IID_IDirectDrawMediaStream, (void **)&ddraw_stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Crashes on native. */ + if (0) + { + hr = IAMMediaStream_Initialize(stream, NULL, 0, NULL, STREAMTYPE_WRITE); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + } + + hr = IAMMediaStream_Initialize(stream, NULL, 0, &test_mspid, STREAMTYPE_WRITE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_GetInformation(stream, &mspid, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&mspid, &test_mspid), "Got mspid %s.\n", wine_dbgstr_guid(&mspid)); + ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type); + + hr = IAMMediaStream_Initialize(stream, (IUnknown *)ddraw, 0, &MSPID_PrimaryAudio, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_GetInformation(stream, &mspid, &type); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&mspid, &MSPID_PrimaryAudio), "Got mspid %s.\n", wine_dbgstr_guid(&mspid)); + ok(type == STREAMTYPE_READ, "Got type %u.\n", type); + + hr = IDirectDrawMediaStream_GetDirectDraw(ddraw_stream, &ddraw2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ddraw2 == ddraw, "Expected ddraw %p, got %p.\n", ddraw, ddraw2); + + IDirectDrawMediaStream_Release(ddraw_stream); + ref = IAMMediaStream_Release(stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IDirectDraw_Release(ddraw2); + ref = IDirectDraw_Release(ddraw); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + void test_mediastreamfilter_get_state(void) { IAMMultiMediaStream *mmstream = create_ammultimediastream(); @@ -3724,6 +3779,8 @@ START_TEST(amstream) test_audiostreamsample_update(); test_audiostreamsample_completion_status();
+ test_ddrawstream_initialize(); + test_mediastreamfilter_get_state(); test_mediastreamfilter_stop_pause_run();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72113
Your paranoid android.
=== debiant (32 bit report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit French report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (64 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/audiostream.c | 3 ++- dlls/amstream/ddrawstream.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index efa3e2aac5..d2a0c146ed 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -441,7 +441,8 @@ static HRESULT WINAPI audio_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *i if (!multi_media_stream) return E_POINTER;
- IMultiMediaStream_AddRef(This->parent); + if (This->parent) + IMultiMediaStream_AddRef(This->parent); *multi_media_stream = This->parent;
return S_OK; diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 3bd5f46e02..966fdc6023 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -134,7 +134,8 @@ static HRESULT WINAPI ddraw_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *i if (!multi_media_stream) return E_POINTER;
- IMultiMediaStream_AddRef(This->parent); + if (This->parent) + IMultiMediaStream_AddRef(This->parent); *multi_media_stream = This->parent;
return S_OK;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72114
Your paranoid android.
=== debiant (32 bit report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (64 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00413d5e).
Report validation errors: amstream:amstream crashed (c0000005)
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/audiostream.c | 8 +++--- dlls/amstream/ddrawstream.c | 8 +++--- dlls/amstream/tests/amstream.c | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index d2a0c146ed..ea6805e065 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -546,11 +546,13 @@ static HRESULT WINAPI audio_IAMMediaStream_SetState(IAMMediaStream *iface, FILTE static HRESULT WINAPI audio_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream) { - struct audio_stream *This = impl_from_IAMMediaStream(iface); + struct audio_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream); + TRACE("stream %p, am_multi_media_stream %p.\n", stream, am_multi_media_stream);
- return S_FALSE; + stream->parent = (IMultiMediaStream *)am_multi_media_stream; + + return S_OK; }
static HRESULT WINAPI audio_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 966fdc6023..0d98af9942 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -232,11 +232,13 @@ static HRESULT WINAPI ddraw_IAMMediaStream_SetState(IAMMediaStream *iface, FILTE
static HRESULT WINAPI ddraw_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream) { - struct ddraw_stream *This = impl_from_IAMMediaStream(iface); + struct ddraw_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream); + TRACE("stream %p, am_multi_media_stream %p.\n", stream, am_multi_media_stream);
- return S_FALSE; + stream->parent = (IMultiMediaStream *)am_multi_media_stream; + + return S_OK; }
static HRESULT WINAPI ddraw_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *filter) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index f6e9b0d992..95f3bc0d85 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -3600,6 +3600,51 @@ static void test_ddrawstream_initialize(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void check_ammediastream_join_am_multi_media_stream(const CLSID *clsid) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IMultiMediaStream *mmstream2; + IAMMediaStream *stream; + HRESULT hr; + ULONG mmstream_ref; + ULONG ref; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mmstream_ref = get_refcount(mmstream); + + hr = IAMMediaStream_JoinAMMultiMediaStream(stream, mmstream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ref = get_refcount(mmstream); + ok(ref == mmstream_ref, "Expected outstanding refcount %d, got %d.\n", mmstream_ref, ref); + + hr = IAMMediaStream_GetMultiMediaStream(stream, &mmstream2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(mmstream2 == (IMultiMediaStream *)mmstream, "Expected mmstream %p, got %p.\n", mmstream, mmstream2); + + IMultiMediaStream_Release(mmstream2); + + hr = IAMMediaStream_JoinAMMultiMediaStream(stream, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMediaStream_GetMultiMediaStream(stream, &mmstream2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(mmstream2 == NULL, "Got mmstream %p.\n", mmstream2); + + ref = IAMMediaStream_Release(stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_ammediastream_join_am_multi_media_stream(void) +{ + check_ammediastream_join_am_multi_media_stream(&CLSID_AMAudioStream); + check_ammediastream_join_am_multi_media_stream(&CLSID_AMDirectDrawStream); +} + void test_mediastreamfilter_get_state(void) { IAMMultiMediaStream *mmstream = create_ammultimediastream(); @@ -3781,6 +3826,8 @@ START_TEST(amstream)
test_ddrawstream_initialize();
+ test_ammediastream_join_am_multi_media_stream(); + test_mediastreamfilter_get_state(); test_mediastreamfilter_stop_pause_run();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72115
Your paranoid android.
=== debiant (32 bit report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit French report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (64 bit WoW report) ===
amstream: amstream.c:3058: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0041403e).
Report validation errors: amstream:amstream crashed (c0000005)
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");
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72116
Your paranoid android.
=== debiant (32 bit report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit French report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (32 bit WoW report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
=== debiant (64 bit WoW report) ===
amstream: amstream.c:165: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004015ee).
Report validation errors: amstream:amstream crashed (c0000005)
On 5/22/20 10:40 AM, Anton Baskanov wrote:
@@ -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);
else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))clsid = &CLSID_AMDirectDrawStream;
hr = audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);
else return MS_E_PURPOSEID;clsid = &CLSID_AMAudioStream;
- 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;
}
I guess I'm not very opposed to this, but it'd be nice to know at least if there's an application that depends on this structure.
On Saturday, 23 May 2020 04:11:17 +07 you wrote:
On 5/22/20 10:40 AM, Anton Baskanov wrote:
@@ -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;
}
I guess I'm not very opposed to this, but it'd be nice to know at least if there's an application that depends on this structure.
I don't know any such application, I just wanted to use this in my seeking tests, so that I can add more than 2 streams.
On 5/23/20 8:57 AM, Anton Baskanov wrote:
On Saturday, 23 May 2020 04:11:17 +07 you wrote:
On 5/22/20 10:40 AM, Anton Baskanov wrote:
@@ -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;
}
I guess I'm not very opposed to this, but it'd be nice to know at least if there's an application that depends on this structure.
I don't know any such application, I just wanted to use this in my seeking tests, so that I can add more than 2 streams.
Okay, thanks.
I don't think it makes a lot of sense to use CoCreateInstance() internally—we'd just be introducing overhead by making COM look up a class we already know the location of. But the rest of these patches are reasonable enough.
On 5/22/20 10:40 AM, Anton Baskanov wrote:
Signed-off-by: Anton Baskanov baskanov@gmail.com
dlls/amstream/amstream_private.h | 4 ++-- dlls/amstream/audiostream.c | 2 +- dlls/amstream/ddrawstream.c | 2 +- dlls/amstream/multimedia.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index bec107f819..96b933f5bc 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -37,9 +37,9 @@ HRESULT multimedia_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT filter_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; -HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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(IMultiMediaStream *parent, const MSPID *purpose_id, +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 68b8b84f50..349e657405 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1292,7 +1292,7 @@ static const IMemInputPinVtbl audio_meminput_vtbl = audio_meminput_ReceiveCanBlock, };
-HRESULT audio_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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; diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 9c552f1a03..d21bf207ef 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -940,7 +940,7 @@ static const IMemInputPinVtbl ddraw_meminput_vtbl = ddraw_meminput_ReceiveCanBlock, };
-HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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; diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index be8fd4ecbf..7e2ae9c9b2 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -377,9 +377,9 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
hr = ddraw_stream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);
else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))hr = ddraw_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);
hr = audio_stream_create((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);
else return MS_E_PURPOSEID;hr = audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);
Sorry for the late review.
This function, and the duplicates essentially introduced in 2/7, seem awkward. While they're temporary, I think we can easily get around that awkwardness by just reordering the patches. I'd first move initialization out of _create() and into ::Initialize() and ::JoinAMMultiMediaStream(), then hook up the class vending.
On Tuesday, 26 May 2020 02:03:13 +07 you wrote:
On 5/22/20 10:40 AM, Anton Baskanov wrote:
Signed-off-by: Anton Baskanov baskanov@gmail.com
dlls/amstream/amstream_private.h | 4 ++-- dlls/amstream/audiostream.c | 2 +- dlls/amstream/ddrawstream.c | 2 +- dlls/amstream/multimedia.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index bec107f819..96b933f5bc 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -37,9 +37,9 @@
HRESULT multimedia_stream_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN; HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT filter_create(IUnknown *outer, void **out) DECLSPEC_HIDDEN;> -HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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(IMultiMediaStream *parent, const MSPID *purpose_id, +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 68b8b84f50..349e657405 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1292,7 +1292,7 @@ static const IMemInputPinVtbl audio_meminput_vtbl =
audio_meminput_ReceiveCanBlock,
};
-HRESULT audio_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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;
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 9c552f1a03..d21bf207ef 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -940,7 +940,7 @@ static const IMemInputPinVtbl ddraw_meminput_vtbl =
ddraw_meminput_ReceiveCanBlock,
};
-HRESULT ddraw_stream_create(IMultiMediaStream *parent, const MSPID *purpose_id, +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;
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index be8fd4ecbf..7e2ae9c9b2 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -377,9 +377,9 @@ static HRESULT WINAPI multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac> }
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
hr = ddraw_stream_create((IMultiMediaStream*)iface, PurposeId,
stream_object, This->type, &pStream); + hr = ddraw_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);> else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
hr = audio_stream_create((IMultiMediaStream*)iface, PurposeId,
stream_object, This->type, &pStream); + hr = audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId, stream_object, This->type, &pStream);> else
return MS_E_PURPOSEID;
Sorry for the late review.
This function, and the duplicates essentially introduced in 2/7, seem awkward. While they're temporary, I think we can easily get around that awkwardness by just reordering the patches. I'd first move initialization out of _create() and into ::Initialize() and
::JoinAMMultiMediaStream(), then hook up the class vending.
Thanks for the review. I've addressed your comments and sent the updated patches.