]> git.sesse.net Git - ffmpeg/commitdiff
avformat/dump: Fix sign bug in reported "start" time
authorBryan Huh <bryan@box.com>
Wed, 13 Apr 2016 04:49:27 +0000 (21:49 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 13 Apr 2016 22:13:15 +0000 (00:13 +0200)
Previously, the bug was that if -1 < start_time < 0, the reported
"start" time would lose the negative-sign.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/dump.c

index 3d117f6fdfb18d7cb0389c11b194f6d571b2521e..d6a324972875915d78f44d76a129b49f9f3dab26 100644 (file)
@@ -559,10 +559,12 @@ void av_dump_format(AVFormatContext *ic, int index,
         if (ic->start_time != AV_NOPTS_VALUE) {
             int secs, us;
             av_log(NULL, AV_LOG_INFO, ", start: ");
-            secs = ic->start_time / AV_TIME_BASE;
+            secs = llabs(ic->start_time / AV_TIME_BASE);
             us   = llabs(ic->start_time % AV_TIME_BASE);
-            av_log(NULL, AV_LOG_INFO, "%d.%06d",
-                   secs, (int) av_rescale(us, 1000000, AV_TIME_BASE));
+            av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
+                   ic->start_time >= 0 ? "" : "-",
+                   secs,
+                   (int) av_rescale(us, 1000000, AV_TIME_BASE));
         }
         av_log(NULL, AV_LOG_INFO, ", bitrate: ");
         if (ic->bit_rate)