00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00024 #ifndef AVUTIL_TIMESTAMP_H
00025 #define AVUTIL_TIMESTAMP_H
00026 
00027 #include "common.h"
00028 
00029 #define AV_TS_MAX_STRING_SIZE 32
00030 #define AV_TS_MAX_STRING_SIZE 32
00031 
00040 static inline char *av_ts_make_string(char *buf, int64_t ts)
00041 {
00042     if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
00043     else                      snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64"", ts);
00044     return buf;
00045 }
00046 
00051 #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
00052 
00062 static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb)
00063 {
00064     if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
00065     else                      snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts);
00066     return buf;
00067 }
00068 
00073 #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
00074 
00075 #endif