amstream: Return VFW_E_CANNOT_CONNECT in IAMMultiMediaStream::OpenFile() when no renderers are present and AMMSF_NORENDER is not specified.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-08-06 20:32:30 +02:00 committed by Alexandre Julliard
parent 77fbf3a9fd
commit bdf8600338
2 changed files with 52 additions and 3 deletions

View File

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

View File

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