amstream: Implement AMMultiMediaStream::GetTime.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Baskanov 2020-11-18 00:48:24 +07:00 committed by Alexandre Julliard
parent 23cbd7f591
commit a103368917
2 changed files with 49 additions and 17 deletions

View file

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

View file

@ -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));
hr = IMediaStreamFilter_Run(filter, 23456789);
ok(hr == S_OK, "Got hr %#x.\n", hr);
time = 0xdeadbeefdeadbeef;
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &time);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(time == 0xdeadbeefdd47d2da, "Got time %s.\n", wine_dbgstr_longlong(time));
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));
clock.time = 34567890;
clock.time = 23456789;
clock.get_time_hr = S_OK;
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaStreamFilter_GetCurrentStreamTime(filter, &filter_start_time);
ok(hr == S_OK, "Got hr %#x.\n", hr);
clock.time = 34567890;
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);
}