Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/tests/amstream.c | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 2d9f3e35f2..a0876d6242 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -4328,6 +4328,89 @@ static void test_ammediastream_join_filter(void) check_ammediastream_join_filter(&CLSID_AMDirectDrawStream); }
+static void check_ammediastream_join_filter_graph(const MSPID *id) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IGraphBuilder *builder, *builder2; + IMediaStreamFilter *filter; + IAMMediaStream *stream; + IFilterGraph *graph; + FILTER_INFO info; + HRESULT hr; + ULONG ref; + + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!filter, "Expected non-null filter.\n"); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, id, 0, (IMediaStream **)&stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &builder); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!builder, "Expected non-null graph.\n"); + EXPECT_REF(builder, 4); + + hr = IMediaStreamFilter_QueryFilterInfo(filter, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pGraph == (IFilterGraph *)builder, "Expected graph %p, got %p.\n", (IFilterGraph *)builder, info.pGraph); + EXPECT_REF(builder, 5); + IFilterGraph_Release(info.pGraph); + EXPECT_REF(builder, 4); + + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph, (void **)&graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + EXPECT_REF(builder, 4); + EXPECT_REF(graph, 1); + + /* Crashes on native. */ + if (0) + { + hr = IAMMediaStream_JoinFilterGraph(stream, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + } + + hr = IAMMediaStream_JoinFilterGraph(stream, graph); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + EXPECT_REF(builder, 4); + EXPECT_REF(graph, 1); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &builder2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(builder2 == builder, "Expected graph %p, got %p.\n", builder, builder2); + EXPECT_REF(builder, 5); + EXPECT_REF(graph, 1); + IGraphBuilder_Release(builder2); + EXPECT_REF(builder, 4); + EXPECT_REF(graph, 1); + + hr = IMediaStreamFilter_QueryFilterInfo(filter, &info); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(info.pGraph == (IFilterGraph *)builder, "Expected graph %p, got %p.\n", (IFilterGraph *)builder, info.pGraph); + EXPECT_REF(builder, 5); + EXPECT_REF(graph, 1); + IFilterGraph_Release(info.pGraph); + EXPECT_REF(builder, 4); + EXPECT_REF(graph, 1); + + ref = IFilterGraph_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IGraphBuilder_Release(builder); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStreamFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IAMMediaStream_Release(stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_ammediastream_join_filter_graph(void) +{ + check_ammediastream_join_filter_graph(&MSPID_PrimaryAudio); + check_ammediastream_join_filter_graph(&MSPID_PrimaryVideo); +} + void test_mediastreamfilter_get_state(void) { IAMMultiMediaStream *mmstream = create_ammultimediastream(); @@ -5023,6 +5106,7 @@ START_TEST(amstream)
test_ammediastream_join_am_multi_media_stream(); test_ammediastream_join_filter(); + test_ammediastream_join_filter_graph();
test_mediastreamfilter_get_state(); test_mediastreamfilter_stop_pause_run();
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/audiostream.c | 6 +++--- dlls/amstream/ddrawstream.c | 6 +++--- dlls/amstream/tests/amstream.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index 60a2572b3b..112891eeb7 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -593,11 +593,11 @@ static HRESULT WINAPI audio_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMe
static HRESULT WINAPI audio_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) { - struct audio_stream *This = impl_from_IAMMediaStream(iface); + struct audio_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); + TRACE("stream %p, filtergraph %p.\n", stream, filtergraph);
- return S_FALSE; + return S_OK; }
static const struct IAMMediaStreamVtbl audio_IAMMediaStream_vtbl = diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 5530603f7a..9f74eaf91a 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -261,11 +261,11 @@ static HRESULT WINAPI ddraw_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMe
static HRESULT WINAPI ddraw_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph) { - struct ddraw_stream *This = impl_from_IAMMediaStream(iface); + struct ddraw_stream *stream = impl_from_IAMMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph); + TRACE("stream %p, filtergraph %p.\n", stream, filtergraph);
- return S_FALSE; + return S_OK; }
static const struct IAMMediaStreamVtbl ddraw_IAMMediaStream_vtbl = diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index a0876d6242..a81cdba3f3 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -4371,7 +4371,7 @@ static void check_ammediastream_join_filter_graph(const MSPID *id) }
hr = IAMMediaStream_JoinFilterGraph(stream, graph); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); EXPECT_REF(builder, 4); EXPECT_REF(graph, 1);
Signed-off-by: Zebediah Figura z.figura12@gmail.com