aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobo1on1 <bob-nospam-@xbmc.org>2011-07-02 22:13:39 +0200
committerbobo1on1 <bob-nospam-@xbmc.org>2011-07-03 14:11:15 +0200
commit3443b1af6c3887ced95e63845cf5a0697edee211 (patch)
tree19d268bd363f65c12572c4478e9a523d958885ee
parente006d49f8fdbbbedbf9cd25e4622bd8e21000997 (diff)
added: option to request either interpolated or non-interpolated time from CDVDClock
-rw-r--r--xbmc/cores/dvdplayer/DVDClock.cpp23
-rw-r--r--xbmc/cores/dvdplayer/DVDClock.h4
2 files changed, 15 insertions, 12 deletions
diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp
index 47b056edcd..79aab0ab2a 100644
--- a/xbmc/cores/dvdplayer/DVDClock.cpp
+++ b/xbmc/cores/dvdplayer/DVDClock.cpp
@@ -54,7 +54,7 @@ CDVDClock::~CDVDClock()
{}
// Returns the current absolute clock in units of DVD_TIME_BASE (usually microseconds).
-double CDVDClock::GetAbsoluteClock()
+double CDVDClock::GetAbsoluteClock(bool interpolated /*= true*/)
{
CSingleLock lock(m_systemsection);
@@ -62,17 +62,20 @@ double CDVDClock::GetAbsoluteClock()
m_systemFrequency = g_VideoReferenceClock.GetFrequency();
if(!m_systemOffset)
- m_systemOffset = g_VideoReferenceClock.GetTime();
+ m_systemOffset = g_VideoReferenceClock.GetTime(interpolated);
int64_t current;
- current = g_VideoReferenceClock.GetTime();
+ current = g_VideoReferenceClock.GetTime(interpolated);
current -= m_systemOffset;
#if _DEBUG
- static int64_t old;
- if(old > current)
- CLog::Log(LOGWARNING, "CurrentHostCounter() moving backwords by %"PRId64" ticks with freq of %"PRId64, old - current, m_systemFrequency);
- old = current;
+ if (interpolated) //only compare interpolated time, clock might go backwards otherwise
+ {
+ static int64_t old;
+ if(old > current)
+ CLog::Log(LOGWARNING, "CurrentHostCounter() moving backwords by %"PRId64" ticks with freq of %"PRId64, old - current, m_systemFrequency);
+ old = current;
+ }
#endif
return DVD_TIME_BASE * (double)current / m_systemFrequency;
@@ -101,14 +104,14 @@ double CDVDClock::WaitAbsoluteClock(double target)
return (double)systemtarget / freq * DVD_TIME_BASE;
}
-double CDVDClock::GetClock()
+double CDVDClock::GetClock(bool interpolated /*= true*/)
{
CSharedLock lock(m_critSection);
int64_t current;
if (m_bReset)
{
- m_startClock = g_VideoReferenceClock.GetTime();
+ m_startClock = g_VideoReferenceClock.GetTime(interpolated);
m_systemUsed = m_systemFrequency;
m_pauseClock = 0;
m_iDisc = 0;
@@ -118,7 +121,7 @@ double CDVDClock::GetClock()
if (m_pauseClock)
current = m_pauseClock;
else
- current = g_VideoReferenceClock.GetTime();
+ current = g_VideoReferenceClock.GetTime(interpolated);
current -= m_startClock;
return DVD_TIME_BASE * (double)current / m_systemUsed + m_iDisc;
diff --git a/xbmc/cores/dvdplayer/DVDClock.h b/xbmc/cores/dvdplayer/DVDClock.h
index 5b83e6b863..ba351670de 100644
--- a/xbmc/cores/dvdplayer/DVDClock.h
+++ b/xbmc/cores/dvdplayer/DVDClock.h
@@ -42,7 +42,7 @@ public:
CDVDClock();
~CDVDClock();
- double GetClock();
+ double GetClock(bool interpolated = true);
void Discontinuity(double currentPts = 0LL);
@@ -57,7 +57,7 @@ public:
bool SetMaxSpeedAdjust(double speed);
- static double GetAbsoluteClock();
+ static double GetAbsoluteClock(bool interpolated = true);
static double GetFrequency() { return (double)m_systemFrequency ; }
static double WaitAbsoluteClock(double target);