diff options
-rw-r--r-- | tools/time_pts.c | 14 | ||||
-rw-r--r-- | tools/time_pts.h | 5 |
2 files changed, 15 insertions, 4 deletions
diff --git a/tools/time_pts.c b/tools/time_pts.c index 23d1ce29..7bf410ce 100644 --- a/tools/time_pts.c +++ b/tools/time_pts.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: time_pts.c,v 1.2 2008-04-20 17:51:45 phintuka Exp $ + * $Id: time_pts.c,v 1.3 2008-04-20 21:29:29 phintuka Exp $ * */ @@ -61,6 +61,7 @@ void cTimePts::Init(void) cTimePts::cTimePts(void) { m_Paused = false; + m_ScrSpeed = 90000; m_Multiplier = 90000; Init(); @@ -106,8 +107,9 @@ int64_t cTimePts::Now(void) t.tv_usec -= tbegin.tv_usec; int64_t pts = 0; - pts += ((int64_t)t.tv_sec) * INT64_C(90000); - pts += ((int64_t)t.tv_usec) * INT64_C(90) / INT64_C(1000); + pts += (int64_t)t.tv_sec * (int64_t)m_ScrSpeed; + pts += (int64_t)t.tv_usec * (int64_t)m_ScrSpeed / INT64_C(1000000); + if(m_Multiplier != 90000) pts = pts * m_Multiplier / INT64_C(90000); @@ -162,3 +164,9 @@ void cTimePts::TrickSpeed(int Multiplier) LOGERR("cTimePts::SetSpeed: Multiplier=%d", Multiplier); } +void cTimePts::SetScrSpeed(int ScrSpeed) +{ + Set(Now()); + + m_ScrSpeed = ScrSpeed; +} diff --git a/tools/time_pts.h b/tools/time_pts.h index 7c224a7a..bf958190 100644 --- a/tools/time_pts.h +++ b/tools/time_pts.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: time_pts.h,v 1.2 2008-04-20 17:51:45 phintuka Exp $ + * $Id: time_pts.h,v 1.3 2008-04-20 21:29:29 phintuka Exp $ * */ @@ -22,6 +22,7 @@ class cTimePts struct timeval tbegin; /* Start time (real time) */ bool m_Paused; int m_Multiplier; + int m_ScrSpeed; static int m_Monotonic; static void Init(void); @@ -35,6 +36,8 @@ class cTimePts void Pause(void); void Resume(void); void TrickSpeed(int Multiplier); + + void SetScrSpeed(int ScrSpeed = 90000); }; #endif // __TIME_PTS_H |