diff options
author | Johns <johns98@gmx.net> | 2012-03-05 17:34:10 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-03-05 17:34:10 +0100 |
commit | 4cc98d7937de1d3594209e34136515619a6b87f8 (patch) | |
tree | 466c6fe6285f91f0201910972fde97105eb87618 /misc.h | |
parent | 3812fa8d38d0fea3ec2f629c90e5fe943c70a926 (diff) | |
download | vdr-plugin-softhddevice-4cc98d7937de1d3594209e34136515619a6b87f8.tar.gz vdr-plugin-softhddevice-4cc98d7937de1d3594209e34136515619a6b87f8.tar.bz2 |
Move time-stamp printing to misc.h.
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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. ** |