double OMXClock::WaitAbsoluteClock(double target) { Lock(); CheckSystemClock(); int64_t systemtarget, freq, offset; freq = m_systemFrequency; offset = m_systemOffset; UnLock(); systemtarget = (int64_t)(target / DVD_TIME_BASE * (double)freq); systemtarget += offset; systemtarget = g_VideoReferenceClock.Wait(systemtarget); systemtarget -= offset; return (double)systemtarget / freq * DVD_TIME_BASE; }
CDVDClock::CDVDClock() { CSingleLock lock(m_systemsection); CheckSystemClock(); m_systemUsed = m_systemFrequency; m_pauseClock = 0; m_bReset = true; m_iDisc = 0; m_maxspeedadjust = 0.0; m_lastSystemTime = g_VideoReferenceClock.GetTime(); m_systemAdjust = 0; m_speedAdjust = 0; m_startClock = 0; }
CDVDClock::CDVDClock() : m_master(MASTER_CLOCK_NONE) { CSingleLock lock(m_systemsection); CheckSystemClock(); m_systemUsed = m_systemFrequency; m_pauseClock = 0; m_bReset = true; m_iDisc = 0; m_maxspeedadjust = 0.0; m_startClock = 0; m_playerclock = this; }
double CDVDClock::WaitAbsoluteClock(double target) { CSingleLock lock(m_systemsection); CheckSystemClock(); int64_t systemtarget, freq, offset; freq = m_systemFrequency; offset = m_systemOffset; lock.Leave(); systemtarget = (int64_t)(target / DVD_TIME_BASE * (double)freq); systemtarget += offset; systemtarget = g_VideoReferenceClock.Wait(systemtarget); systemtarget -= offset; return (double)systemtarget / freq * DVD_TIME_BASE; }
// Returns the current absolute clock in units of DVD_TIME_BASE (usually microseconds). double CDVDClock::GetAbsoluteClock(bool interpolated /*= true*/) { CSingleLock lock(m_systemsection); CheckSystemClock(); int64_t current; current = g_VideoReferenceClock.GetTime(interpolated); #if _DEBUG 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 SystemToAbsolute(current); }