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();