summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/VideoPlayer/DVDClock.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/cores/VideoPlayer/DVDClock.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/cores/VideoPlayer/DVDClock.h')
-rw-r--r--xbmc/cores/VideoPlayer/DVDClock.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDClock.h b/xbmc/cores/VideoPlayer/DVDClock.h
new file mode 100644
index 0000000..3c3f673
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/DVDClock.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "threads/CriticalSection.h"
+
+#include <memory>
+#include <stdint.h>
+
+class CVideoReferenceClock;
+
+class CDVDClock
+{
+public:
+
+ CDVDClock();
+ ~CDVDClock();
+
+ double GetClock(bool interpolated = true);
+ double GetClock(double& absolute, bool interpolated = true);
+
+ double ErrorAdjust(double error, const char* log);
+ void Discontinuity(double clock, double absolute);
+ void Discontinuity(double clock = 0LL)
+ {
+ Discontinuity(clock, GetAbsoluteClock());
+ }
+
+ void Reset() { m_bReset = true; }
+ void SetSpeed(int iSpeed);
+ void SetSpeedAdjust(double adjust);
+ double GetSpeedAdjust();
+
+ double GetClockSpeed(); /**< get the current speed of the clock relative normal system time */
+
+ /* tells clock at what framerate video is, to *
+ * allow it to adjust speed for a better match */
+ int UpdateFramerate(double fps, double* interval = NULL);
+
+ void SetMaxSpeedAdjust(double speed);
+
+ double GetAbsoluteClock(bool interpolated = true);
+ double GetFrequency() { return (double)m_systemFrequency ; }
+
+ bool GetClockInfo(int& MissedVblanks, double& ClockSpeed, double& RefreshRate) const;
+ void SetVsyncAdjust(double adjustment);
+ double GetVsyncAdjust();
+
+ void Pause(bool pause);
+ void Advance(double time);
+
+protected:
+ double SystemToAbsolute(int64_t system);
+ int64_t AbsoluteToSystem(double absolute);
+ double SystemToPlaying(int64_t system);
+
+ CCriticalSection m_critSection;
+ int64_t m_systemUsed;
+ int64_t m_startClock;
+ int64_t m_pauseClock;
+ double m_iDisc;
+ bool m_bReset;
+ bool m_paused;
+ int m_speedAfterPause;
+ std::unique_ptr<CVideoReferenceClock> m_videoRefClock;
+
+ int64_t m_systemFrequency;
+ int64_t m_systemOffset;
+ CCriticalSection m_systemsection;
+
+ int64_t m_systemAdjust;
+ int64_t m_lastSystemTime;
+ double m_speedAdjust;
+ double m_vSyncAdjust;
+ double m_frameTime;
+
+ double m_maxspeedadjust;
+ CCriticalSection m_speedsection;
+};