summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-03-05 17:34:10 +0100
committerJohns <johns98@gmx.net>2012-03-05 17:34:10 +0100
commit4cc98d7937de1d3594209e34136515619a6b87f8 (patch)
tree466c6fe6285f91f0201910972fde97105eb87618
parent3812fa8d38d0fea3ec2f629c90e5fe943c70a926 (diff)
downloadvdr-plugin-softhddevice-4cc98d7937de1d3594209e34136515619a6b87f8.tar.gz
vdr-plugin-softhddevice-4cc98d7937de1d3594209e34136515619a6b87f8.tar.bz2
Move time-stamp printing to misc.h.
-rw-r--r--misc.h25
-rw-r--r--softhddevice.cpp2
-rw-r--r--video.c32
3 files changed, 28 insertions, 31 deletions
diff --git a/misc.h b/misc.h
index 1cfa88d..5e32e39 100644
--- a/misc.h
+++ b/misc.h
@@ -107,6 +107,31 @@ static inline void Syslog(const int level, const char *format, ...)
#define Debug(level, fmt...) /* disabled */
#endif
+#ifdef AV_NOPTS_VALUE
+
+/**
+** Nice time-stamp string.
+**
+** @param ts dvb time stamp
+*/
+static inline const char *Timestamp2String(int64_t ts)
+{
+ static char buf[4][16];
+ static int idx;
+
+ if (ts == (int64_t) AV_NOPTS_VALUE) {
+ return "--:--:--.---";
+ }
+ idx = (idx + 1) % 3;
+ snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d",
+ (int)(ts / (90 * 3600000)), (int)((ts / (90 * 60000)) % 60),
+ (int)((ts / (90 * 1000)) % 60), (int)((ts / 90) % 1000));
+
+ return buf[idx];
+}
+
+#endif
+
/**
** Get ticks in ms.
**
diff --git a/softhddevice.cpp b/softhddevice.cpp
index 1355a6c..ef35fa0 100644
--- a/softhddevice.cpp
+++ b/softhddevice.cpp
@@ -43,7 +43,7 @@ extern "C"
//////////////////////////////////////////////////////////////////////////////
-static const char *const VERSION = "0.4.9"
+static const char *const VERSION = "0.5.0"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif
diff --git a/video.c b/video.c
index 434fc1e..ef1b70d 100644
--- a/video.c
+++ b/video.c
@@ -369,34 +369,6 @@ static void VideoThreadLock(void); ///< lock video thread
static void VideoThreadUnlock(void); ///< unlock video thread
static void VideoThreadExit(void); ///< exit/kill video thread
-#if defined(DEBUG) || defined(AV_INFO)
-///
-/// Nice time-stamp string.
-///
-static const char *VideoTimeStampString(int64_t ts)
-{
- static char buf[2][32];
- static int idx;
- int hh;
- int mm;
- int ss;
- int uu;
-
- if (ts == (int64_t) AV_NOPTS_VALUE) {
- return "--:--:--.---";
- }
- idx ^= 1; // support two static buffers
- ts = ts / 90;
- uu = ts % 1000;
- ss = (ts / 1000) % 60;
- mm = (ts / 60000) % 60;
- hh = ts / 3600000;
- snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d", hh, mm, ss, uu);
-
- return buf[idx];
-}
-#endif
-
///
/// Update video pts.
///
@@ -4422,7 +4394,7 @@ static void VaapiSyncDisplayFrame(VaapiDecoder * decoder)
if (decoder->DupNextFrame || decoder->DropNextFrame
|| !(decoder->FramesDisplayed % AV_INFO_TIME)) {
Info("video: %s%+5" PRId64 " %4" PRId64 " %3d/\\ms %3d v-buf\n",
- VideoTimeStampString(video_clock),
+ Timestamp2String(video_clock),
abs((video_clock - audio_clock) / 90) <
9999 ? ((video_clock - audio_clock) / 90) : 88888,
AudioGetDelay() / 90, (int)VideoDeltaPTS / 90, VideoGetBuffers());
@@ -7479,7 +7451,7 @@ static void VdpauSyncDisplayFrame(VdpauDecoder * decoder)
if (decoder->DupNextFrame || decoder->DropNextFrame
|| !(decoder->FramesDisplayed % AV_INFO_TIME)) {
Info("video: %s%+5" PRId64 " %4" PRId64 " %3d/\\ms %3d v-buf\n",
- VideoTimeStampString(video_clock),
+ Timestamp2String(video_clock),
abs((video_clock - audio_clock) / 90) <
9999 ? ((video_clock - audio_clock) / 90) : 88888,
AudioGetDelay() / 90, (int)VideoDeltaPTS / 90, VideoGetBuffers());