Commit 39d177b8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Use presentation clock interface from the session.

parent be3bab5e
...@@ -126,7 +126,7 @@ struct media_engine ...@@ -126,7 +126,7 @@ struct media_engine
MF_MEDIA_ENGINE_READY ready_state; MF_MEDIA_ENGINE_READY ready_state;
MF_MEDIA_ENGINE_PRELOAD preload; MF_MEDIA_ENGINE_PRELOAD preload;
IMFMediaSession *session; IMFMediaSession *session;
IMFClock *clock; IMFPresentationClock *clock;
IMFSourceResolver *resolver; IMFSourceResolver *resolver;
BSTR current_source; BSTR current_source;
struct video_frame video_frame; struct video_frame video_frame;
...@@ -982,7 +982,7 @@ static void free_media_engine(struct media_engine *engine) ...@@ -982,7 +982,7 @@ static void free_media_engine(struct media_engine *engine)
if (engine->callback) if (engine->callback)
IMFMediaEngineNotify_Release(engine->callback); IMFMediaEngineNotify_Release(engine->callback);
if (engine->clock) if (engine->clock)
IMFClock_Release(engine->clock); IMFPresentationClock_Release(engine->clock);
if (engine->session) if (engine->session)
IMFMediaSession_Release(engine->session); IMFMediaSession_Release(engine->session);
if (engine->attributes) if (engine->attributes)
...@@ -1208,16 +1208,14 @@ static BOOL WINAPI media_engine_IsSeeking(IMFMediaEngine *iface) ...@@ -1208,16 +1208,14 @@ static BOOL WINAPI media_engine_IsSeeking(IMFMediaEngine *iface)
static double WINAPI media_engine_GetCurrentTime(IMFMediaEngine *iface) static double WINAPI media_engine_GetCurrentTime(IMFMediaEngine *iface)
{ {
struct media_engine *engine = impl_from_IMFMediaEngine(iface); struct media_engine *engine = impl_from_IMFMediaEngine(iface);
LONGLONG clocktime;
double ret = 0.0; double ret = 0.0;
MFTIME systime; MFTIME clocktime;
TRACE("%p.\n", iface); TRACE("%p.\n", iface);
EnterCriticalSection(&engine->cs); EnterCriticalSection(&engine->cs);
if (SUCCEEDED(IMFClock_GetCorrelatedTime(engine->clock, 0, &clocktime, &systime))) if (SUCCEEDED(IMFPresentationClock_GetTime(engine->clock, &clocktime)))
{ {
/* Assume 100ns clock. */
ret = (double)clocktime / 10000000.0; ret = (double)clocktime / 10000000.0;
} }
LeaveCriticalSection(&engine->cs); LeaveCriticalSection(&engine->cs);
...@@ -1854,6 +1852,7 @@ static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct ...@@ -1854,6 +1852,7 @@ static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct
{ {
DXGI_FORMAT output_format; DXGI_FORMAT output_format;
UINT64 playback_hwnd; UINT64 playback_hwnd;
IMFClock *clock;
HRESULT hr; HRESULT hr;
engine->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl; engine->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl;
...@@ -1877,7 +1876,12 @@ static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct ...@@ -1877,7 +1876,12 @@ static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct
if (FAILED(hr = MFCreateMediaSession(NULL, &engine->session))) if (FAILED(hr = MFCreateMediaSession(NULL, &engine->session)))
return hr; return hr;
if (FAILED(hr = IMFMediaSession_GetClock(engine->session, &engine->clock))) if (FAILED(hr = IMFMediaSession_GetClock(engine->session, &clock)))
return hr;
hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&engine->clock);
IMFClock_Release(clock);
if (FAILED(hr))
return hr; return hr;
if (FAILED(hr = IMFMediaSession_BeginGetEvent(engine->session, &engine->session_events, NULL))) if (FAILED(hr = IMFMediaSession_BeginGetEvent(engine->session, &engine->session_events, NULL)))
......
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