Commit 7cdfafe0 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

amstream: Handle AMMSF_NOCLOCK flag in AMMultiMediaStream::OpenFile.

parent a73460bc
......@@ -472,6 +472,17 @@ static HRESULT WINAPI multimedia_stream_OpenFile(IAMMultiMediaStream *iface,
}
}
if (SUCCEEDED(ret) && (flags & AMMSF_NOCLOCK))
{
IMediaFilter *media_filter;
if (SUCCEEDED(ret = IGraphBuilder_QueryInterface(This->graph, &IID_IMediaFilter, (void **)&media_filter)))
{
ret = IMediaFilter_SetSyncSource(media_filter, NULL);
IMediaFilter_Release(media_filter);
}
}
IMediaStreamFilter_SupportSeeking(This->filter, This->type == STREAMTYPE_READ);
if (SUCCEEDED(ret) && (flags & AMMSF_RUN))
......
......@@ -418,6 +418,8 @@ static void test_openfile(const WCHAR *test_avi_path)
IAMMultiMediaStream *mmstream = create_ammultimediastream();
IMediaControl *media_control;
IMediaStreamFilter *filter;
IMediaFilter *media_filter;
IReferenceClock *clock;
IGraphBuilder *graph;
OAFilterState state;
HRESULT hr;
......@@ -475,6 +477,11 @@ static void test_openfile(const WCHAR *test_avi_path)
mmstream = create_ammultimediastream();
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!!graph, "Expected non-NULL graph.\n");
hr = IGraphBuilder_QueryInterface(graph, &IID_IMediaFilter, (void **)&media_filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilter(mmstream, &filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......@@ -485,10 +492,25 @@ static void test_openfile(const WCHAR *test_avi_path)
check_interface(filter, &IID_IMediaSeeking, TRUE);
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
clock = NULL;
IMediaFilter_GetSyncSource(media_filter, &clock);
ok(!!clock, "Expected non-NULL clock.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = IAMMultiMediaStream_Release(mmstream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMediaFilter_Release(media_filter);
ref = IGraphBuilder_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IMediaStreamFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IReferenceClock_Release(clock);
ok(!ref, "Got outstanding refcount %d.\n", ref);
mmstream = create_ammultimediastream();
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL);
......@@ -512,6 +534,34 @@ static void test_openfile(const WCHAR *test_avi_path)
IMediaControl_Release(media_control);
ref = IGraphBuilder_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
mmstream = create_ammultimediastream();
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!!graph, "Expected non-NULL graph.\n");
hr = IGraphBuilder_QueryInterface(graph, &IID_IMediaFilter, (void **)&media_filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NOCLOCK);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
clock = (IReferenceClock *)0xdeadbeef;
IMediaFilter_GetSyncSource(media_filter, &clock);
ok(!clock, "Got clock %p.\n", clock);
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = IAMMultiMediaStream_Release(mmstream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
IMediaFilter_Release(media_filter);
ref = IGraphBuilder_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_mmstream_get_duration(const WCHAR *test_avi_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment