Commit a2eec346 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

mfmediaengine: Use a mftime_to_seconds() helper to convert time.

parent 613d7b09
...@@ -63,6 +63,12 @@ static BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, si ...@@ -63,6 +63,12 @@ static BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, si
return TRUE; return TRUE;
} }
/* Convert 100ns to seconds */
static double mftime_to_seconds(MFTIME time)
{
return (double)time / 10000000.0;
}
enum media_engine_mode enum media_engine_mode
{ {
MEDIA_ENGINE_INVALID, MEDIA_ENGINE_INVALID,
...@@ -1248,10 +1254,7 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi ...@@ -1248,10 +1254,7 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi
/* Assume live source if duration was not provided. */ /* Assume live source if duration was not provided. */
if (SUCCEEDED(IMFPresentationDescriptor_GetUINT64(pd, &MF_PD_DURATION, &duration))) if (SUCCEEDED(IMFPresentationDescriptor_GetUINT64(pd, &MF_PD_DURATION, &duration)))
{ engine->duration = mftime_to_seconds(duration);
/* Convert 100ns to seconds. */
engine->duration = duration / 10000000;
}
else else
engine->duration = INFINITY; engine->duration = INFINITY;
...@@ -1749,7 +1752,7 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) ...@@ -1749,7 +1752,7 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface)
} }
else if (SUCCEEDED(IMFPresentationClock_GetTime(engine->clock, &clocktime))) else if (SUCCEEDED(IMFPresentationClock_GetTime(engine->clock, &clocktime)))
{ {
ret = (double)clocktime / 10000000.0; ret = mftime_to_seconds(clocktime);
} }
LeaveCriticalSection(&engine->cs); LeaveCriticalSection(&engine->cs);
......
...@@ -1961,7 +1961,6 @@ static void test_GetDuration(void) ...@@ -1961,7 +1961,6 @@ static void test_GetDuration(void)
ok(!res, "Unexpected res %#lx.\n", res); ok(!res, "Unexpected res %#lx.\n", res);
duration = IMFMediaEngineEx_GetDuration(media_engine); duration = IMFMediaEngineEx_GetDuration(media_engine);
todo_wine
ok(compare_double(duration, 0.133467, allowed_error), "Got unexpected duration %lf.\n", duration); ok(compare_double(duration, 0.133467, allowed_error), "Got unexpected duration %lf.\n", duration);
SysFreeString(url); SysFreeString(url);
......
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