Commit a1033689 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

amstream: Implement AMMultiMediaStream::GetTime.

parent 23cbd7f5
......@@ -174,13 +174,13 @@ static HRESULT WINAPI multimedia_stream_SetState(IAMMultiMediaStream *iface, STR
return hr;
}
static HRESULT WINAPI multimedia_stream_GetTime(IAMMultiMediaStream *iface, STREAM_TIME *pCurrentTime)
static HRESULT WINAPI multimedia_stream_GetTime(IAMMultiMediaStream *iface, STREAM_TIME *time)
{
struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
struct multimedia_stream *stream = impl_from_IAMMultiMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime);
TRACE("stream %p, time %p.\n", stream, time);
return E_NOTIMPL;
return IMediaStreamFilter_GetCurrentStreamTime(stream->filter, time);
}
static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface, STREAM_TIME *duration)
......
......@@ -6487,14 +6487,27 @@ static void test_mediastreamfilter_seeking(void)
static void test_mediastreamfilter_get_current_stream_time(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
STREAM_TIME filter_start_time;
IMediaStreamFilter *filter;
IMediaFilter *media_filter;
struct testclock clock;
REFERENCE_TIME time;
IGraphBuilder *graph;
STREAM_TIME time;
HRESULT hr;
ULONG ref;
hr = CoCreateInstance(&CLSID_MediaStreamFilter, NULL, CLSCTX_INPROC_SERVER,
&IID_IMediaStreamFilter, (void **)&filter);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
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, &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 != NULL, "Expected non-NULL graph.\n");
hr = IGraphBuilder_QueryInterface(graph, &IID_IMediaFilter, (void **)&media_filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
testclock_init(&clock);
......@@ -6503,14 +6516,20 @@ static void test_mediastreamfilter_get_current_stream_time(void)
{
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetTime(mmstream, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
}
time = 0xdeadbeefdeadbeef;
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &time);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(time == 0, "Got time %s.\n", wine_dbgstr_longlong(time));
time = 0xdeadbeefdeadbeef;
hr = IAMMultiMediaStream_GetTime(mmstream, &time);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(time == 0, "Got time %s.\n", wine_dbgstr_longlong(time));
hr = IMediaStreamFilter_SetSyncSource(filter, &clock.IReferenceClock_iface);
hr = IMediaFilter_SetSyncSource(media_filter, &clock.IReferenceClock_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr);
clock.get_time_hr = E_FAIL;
......@@ -6519,23 +6538,36 @@ static void test_mediastreamfilter_get_current_stream_time(void)
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &time);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(time == 0, "Got time %s.\n", wine_dbgstr_longlong(time));
time = 0xdeadbeefdeadbeef;
hr = IAMMultiMediaStream_GetTime(mmstream, &time);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(time == 0, "Got time %s.\n", wine_dbgstr_longlong(time));
hr = IMediaStreamFilter_Run(filter, 23456789);
clock.time = 23456789;
clock.get_time_hr = S_OK;
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
time = 0xdeadbeefdeadbeef;
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &time);
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &filter_start_time);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(time == 0xdeadbeefdd47d2da, "Got time %s.\n", wine_dbgstr_longlong(time));
clock.time = 34567890;
clock.get_time_hr = S_OK;
time = 0xdeadbeefdeadbeef;
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &time);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(time == 11111101, "Got time %s.\n", wine_dbgstr_longlong(time));
ok(time == 11111101 + filter_start_time, "Got time %s.\n", wine_dbgstr_longlong(time));
time = 0xdeadbeefdeadbeef;
hr = IAMMultiMediaStream_GetTime(mmstream, &time);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(time == 11111101 + filter_start_time, "Got time %s.\n", wine_dbgstr_longlong(time));
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);
}
......
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