[PATCH 5/6] mf: Forward GetTime() calls to time source.
Nikolay Sivov
nsivov at codeweavers.com
Fri May 31 05:11:32 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mf/session.c | 27 +++++++++++++++++++--------
dlls/mf/tests/mf.c | 28 +++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 14aac77470..be5ea642d4 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -842,15 +842,13 @@ static ULONG WINAPI present_clock_Release(IMFPresentationClock *iface)
static HRESULT WINAPI present_clock_GetClockCharacteristics(IMFPresentationClock *iface, DWORD *flags)
{
struct presentation_clock *clock = impl_from_IMFPresentationClock(iface);
- HRESULT hr;
+ HRESULT hr = MF_E_CLOCK_NO_TIME_SOURCE;
TRACE("%p, %p.\n", iface, flags);
EnterCriticalSection(&clock->cs);
if (clock->time_source)
hr = IMFPresentationTimeSource_GetClockCharacteristics(clock->time_source, flags);
- else
- hr = MF_E_CLOCK_NO_TIME_SOURCE;
LeaveCriticalSection(&clock->cs);
return hr;
@@ -889,15 +887,13 @@ static HRESULT WINAPI present_clock_GetState(IMFPresentationClock *iface, DWORD
static HRESULT WINAPI present_clock_GetProperties(IMFPresentationClock *iface, MFCLOCK_PROPERTIES *props)
{
struct presentation_clock *clock = impl_from_IMFPresentationClock(iface);
- HRESULT hr;
+ HRESULT hr = MF_E_CLOCK_NO_TIME_SOURCE;
TRACE("%p, %p.\n", iface, props);
EnterCriticalSection(&clock->cs);
if (clock->time_source)
hr = IMFPresentationTimeSource_GetProperties(clock->time_source, props);
- else
- hr = MF_E_CLOCK_NO_TIME_SOURCE;
LeaveCriticalSection(&clock->cs);
return hr;
@@ -939,6 +935,9 @@ static HRESULT WINAPI present_clock_GetTimeSource(IMFPresentationClock *iface,
TRACE("%p, %p.\n", iface, time_source);
+ if (!time_source)
+ return E_INVALIDARG;
+
EnterCriticalSection(&clock->cs);
if (clock->time_source)
{
@@ -954,9 +953,21 @@ static HRESULT WINAPI present_clock_GetTimeSource(IMFPresentationClock *iface,
static HRESULT WINAPI present_clock_GetTime(IMFPresentationClock *iface, MFTIME *time)
{
- FIXME("%p, %p.\n", iface, time);
+ struct presentation_clock *clock = impl_from_IMFPresentationClock(iface);
+ HRESULT hr = MF_E_CLOCK_NO_TIME_SOURCE;
+ MFTIME systime;
- return E_NOTIMPL;
+ TRACE("%p, %p.\n", iface, time);
+
+ if (!time)
+ return E_POINTER;
+
+ EnterCriticalSection(&clock->cs);
+ if (clock->time_source)
+ hr = IMFPresentationTimeSource_GetCorrelatedTime(clock->time_source, 0, time, &systime);
+ LeaveCriticalSection(&clock->cs);
+
+ return hr;
}
static HRESULT WINAPI present_clock_AddClockStateSink(IMFPresentationClock *iface, IMFClockStateSink *state_sink)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index b710d0a13d..dc58dc1efd 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -1431,10 +1431,10 @@ static void test_presentation_clock(void)
IMFRateControl *rate_control;
IMFPresentationClock *clock;
IMFShutdown *shutdown;
+ MFTIME systime, time;
LONGLONG clock_time;
MFCLOCK_STATE state;
IMFTimer *timer;
- MFTIME systime;
unsigned int i;
DWORD value;
HRESULT hr;
@@ -1448,9 +1448,21 @@ static void test_presentation_clock(void)
hr = IMFPresentationClock_GetTimeSource(clock, &time_source);
ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+ hr = IMFPresentationClock_GetTimeSource(clock, NULL);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
hr = IMFPresentationClock_GetClockCharacteristics(clock, &value);
ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+ hr = IMFPresentationClock_GetClockCharacteristics(clock, NULL);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_GetTime(clock, &time);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_GetTime(clock, NULL);
+ ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
+
value = 1;
hr = IMFPresentationClock_GetContinuityKey(clock, &value);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -1538,6 +1550,20 @@ todo_wine
ok(state == clock_state_change[i].clock_state, "%u: unexpected state %d.\n", i, state);
}
+ /* Clock time stamps. */
+ hr = IMFPresentationClock_Start(clock, 10);
+ ok(hr == S_OK, "Failed to start presentation clock, hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_Pause(clock);
+ ok(hr == S_OK, "Failed to pause presentation clock, hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_GetTime(clock, &time);
+ ok(hr == S_OK, "Failed to get clock time, hr %#x.\n", hr);
+
+ hr = IMFPresentationTimeSource_GetCorrelatedTime(time_source, 0, &clock_time, &systime);
+ ok(hr == S_OK, "Failed to get time source time, hr %#x.\n", hr);
+ ok(time == clock_time, "Unexpected clock time.\n");
+
IMFPresentationTimeSource_Release(time_source);
hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFRateControl, (void **)&rate_control);
--
2.20.1
More information about the wine-devel
mailing list