2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "threads/CriticalSection.h"
16 class CVideoReferenceClock
;
25 double GetClock(bool interpolated
= true);
26 double GetClock(double& absolute
, bool interpolated
= true);
28 double ErrorAdjust(double error
, const char* log
);
29 void Discontinuity(double clock
, double absolute
);
30 void Discontinuity(double clock
= 0LL)
32 Discontinuity(clock
, GetAbsoluteClock());
35 void Reset() { m_bReset
= true; }
36 void SetSpeed(int iSpeed
);
37 void SetSpeedAdjust(double adjust
);
38 double GetSpeedAdjust();
40 double GetClockSpeed(); /**< get the current speed of the clock relative normal system time */
42 /* tells clock at what framerate video is, to *
43 * allow it to adjust speed for a better match */
44 int UpdateFramerate(double fps
, double* interval
= NULL
);
46 void SetMaxSpeedAdjust(double speed
);
48 double GetAbsoluteClock(bool interpolated
= true);
49 double GetFrequency() { return (double)m_systemFrequency
; }
51 bool GetClockInfo(int& MissedVblanks
, double& ClockSpeed
, double& RefreshRate
) const;
52 void SetVsyncAdjust(double adjustment
);
53 double GetVsyncAdjust();
55 void Pause(bool pause
);
56 void Advance(double time
);
59 double SystemToAbsolute(int64_t system
);
60 int64_t AbsoluteToSystem(double absolute
);
61 double SystemToPlaying(int64_t system
);
63 CCriticalSection m_critSection
;
70 int m_speedAfterPause
;
71 std::unique_ptr
<CVideoReferenceClock
> m_videoRefClock
;
73 int64_t m_systemFrequency
;
74 int64_t m_systemOffset
;
75 CCriticalSection m_systemsection
;
77 int64_t m_systemAdjust
;
78 int64_t m_lastSystemTime
;
83 double m_maxspeedadjust
;
84 CCriticalSection m_speedsection
;