Browse code

ffmpeg: Print negative times like "-00:05:01.22" instead of "00:-5:-1.-22"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/02/11 06:09:29
Showing 1 changed files
... ...
@@ -1528,8 +1528,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
1528 1528
             nb_frames_drop += ost->last_droped;
1529 1529
     }
1530 1530
 
1531
-    secs = pts / AV_TIME_BASE;
1532
-    us = pts % AV_TIME_BASE;
1531
+    secs = FFABS(pts) / AV_TIME_BASE;
1532
+    us = FFABS(pts) % AV_TIME_BASE;
1533 1533
     mins = secs / 60;
1534 1534
     secs %= 60;
1535 1535
     hours = mins / 60;
... ...
@@ -1541,6 +1541,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
1541 1541
                                  "size=N/A time=");
1542 1542
     else                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1543 1543
                                  "size=%8.0fkB time=", total_size / 1024.0);
1544
+    if (pts < 0)
1545
+        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-");
1544 1546
     snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1545 1547
              "%02d:%02d:%02d.%02d ", hours, mins, secs,
1546 1548
              (100 * us) / AV_TIME_BASE);