Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/multimedia.c | 17 ++++++++++++++- dlls/amstream/tests/amstream.c | 38 ++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 414a903cf2..5425ef42a3 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -447,7 +447,22 @@ static HRESULT WINAPI multimedia_stream_OpenFile(IAMMultiMediaStream *iface, }
if (SUCCEEDED(ret) && !(flags & AMMSF_NORENDER)) - ret = IGraphBuilder_Render(This->graph, This->ipin); + { + IFilterGraph2 *graph; + + if (SUCCEEDED(ret = IGraphBuilder_QueryInterface(This->graph, &IID_IFilterGraph2, (void **)&graph))) + { + ret = IFilterGraph2_RenderEx(graph, This->ipin, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, NULL); + if (ret == VFW_E_CANNOT_RENDER) ret = VFW_E_CANNOT_CONNECT; + else if (ret == VFW_S_PARTIAL_RENDER) ret = S_OK; + IFilterGraph2_Release(graph); + } + else + { + FIXME("Failed to get IFilterGraph2 interface, hr %#x.\n", ret); + ret = IGraphBuilder_Render(This->graph, This->ipin); + } + }
IMediaStreamFilter_SupportSeeking(This->filter, This->type == STREAMTYPE_READ);
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 910ab11f52..6a72f3ed89 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -283,13 +283,47 @@ static void test_openfile(const WCHAR *test_avi_path) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!graph, "Expected NULL graph.\n");
+ hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(!!filter, "Expected non-NULL filter.\n"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_interface(filter, &IID_IMediaSeeking, FALSE); + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NORENDER); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ check_interface(filter, &IID_IMediaSeeking, FALSE); + + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!graph, "Expected non-NULL graph.\n"); + IGraphBuilder_Release(graph); + IMediaStreamFilter_Release(filter); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!graph, "Expected NULL graph.\n"); + + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(!!filter, "Expected non-NULL filter.\n"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + check_interface(filter, &IID_IMediaSeeking, FALSE); + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); + ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr); + + check_interface(filter, &IID_IMediaSeeking, FALSE); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!!graph, "Expected non-NULL graph.\n"); IGraphBuilder_Release(graph); + IMediaStreamFilter_Release(filter);
ref = IAMMultiMediaStream_Release(mmstream); ok(!ref, "Got outstanding refcount %d.\n", ref); @@ -389,12 +423,12 @@ static void test_mmstream_get_duration(const WCHAR *test_avi_path) mmstream = create_ammultimediastream();
hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); - todo_wine ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr); + ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
duration = 0xdeadbeefdeadbeefULL; hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); - todo_wine ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
ref = IAMMultiMediaStream_Release(mmstream); ok(!ref, "Got outstanding refcount %d.\n", ref);
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/multimedia.c | 6 +++++- dlls/amstream/tests/amstream.c | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 5425ef42a3..82ef482234 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -181,7 +181,11 @@ static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface,
if (!mmstream->media_seeking) return E_NOINTERFACE; - return IMediaSeeking_GetDuration(mmstream->media_seeking, duration); + + if (IMediaSeeking_GetDuration(mmstream->media_seeking, duration) != S_OK) + return S_FALSE; + + return S_OK; }
static HRESULT WINAPI multimedia_stream_Seek(IAMMultiMediaStream *iface, STREAM_TIME seek_time) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 6a72f3ed89..a25ae42a31 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -414,7 +414,7 @@ static void test_mmstream_get_duration(const WCHAR *test_avi_path)
duration = 0xdeadbeefdeadbeefULL; hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
ref = IAMMultiMediaStream_Release(mmstream); @@ -427,7 +427,7 @@ static void test_mmstream_get_duration(const WCHAR *test_avi_path)
duration = 0xdeadbeefdeadbeefULL; hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
ref = IAMMultiMediaStream_Release(mmstream); @@ -442,7 +442,7 @@ static void test_mmstream_get_duration(const WCHAR *test_avi_path)
duration = 0xdeadbeefdeadbeefULL; hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
ref = IAMMultiMediaStream_Release(mmstream);
Signed-off-by: Zebediah Figura z.figura12@gmail.com