Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/amstream/multimedia.c | 2 ++ dlls/amstream/tests/amstream.c | 38 ++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 414a903cf2..72af67f36f 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -428,6 +428,8 @@ static HRESULT WINAPI multimedia_stream_OpenFile(IAMMultiMediaStream *iface, ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL); if (SUCCEEDED(ret)) ret = create_graph(This, NULL); + if (!(flags & AMMSF_NORENDER)) + return SUCCEEDED(ret) ? VFW_E_CANNOT_CONNECT : ret; }
if (SUCCEEDED(ret)) 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 72af67f36f..d6ce1a55ce 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);
On 8/6/20 4:29 AM, Gijs Vermeulen wrote:
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com
dlls/amstream/multimedia.c | 2 ++ dlls/amstream/tests/amstream.c | 38 ++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 414a903cf2..72af67f36f 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -428,6 +428,8 @@ static HRESULT WINAPI multimedia_stream_OpenFile(IAMMultiMediaStream *iface, ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL); if (SUCCEEDED(ret)) ret = create_graph(This, NULL);
if (!(flags & AMMSF_NORENDER))
return SUCCEEDED(ret) ? VFW_E_CANNOT_CONNECT : ret;
}
if (SUCCEEDED(ret))
This seems suspicious. In particular, if I add a call to IAMMultiMediaStream::Initialize() in the relevant test, it still returns VFW_E_CANNOT_CONNECT.
I suspect that what is happening instead is that amstream ensures that only its own renderers are used, probably with something like AM_RENDEREX_RENDERTOEXISTINGRENDERERS.
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);