From 7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 29 Jan 2013 19:15:39 +0100 Subject: advtime: Also print the range for the last frame --- src/advtime.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/advtime.c b/src/advtime.c index d118f33..32c675d 100644 --- a/src/advtime.c +++ b/src/advtime.c @@ -33,6 +33,17 @@ print_time(int64_t msec) { printf("%02d:%02d:%02d.%03jd", hh, mm, ss, msec); } +static void +register_dts(int64_t dts) +{ + static int prev_dts = 0; + + print_time(prev_dts); + printf(" "); + print_time(dts - prev_dts); + prev_dts = dts; +} + static double frame_diff(struct video_frame *frame_a, struct video_frame *frame_b) { @@ -90,7 +101,6 @@ main(int argc, char **argv) int diff_flag = 0, average_flag = 0, frame_flag = 0, showcut_flag = 0; int64_t timestamp = 0; double diff = 0.0, old_diff = 0.0; - uint64_t dts = 0, prev_dts = 0; /* decoding time stamp */ char filename[BUFSIZ]; while ((ch = getopt(argc, argv, "adfs")) != -1) { @@ -162,12 +172,7 @@ main(int argc, char **argv) } if (diff > 40.0) { - dts = vd->fmt_ctx->streams[0]->cur_dts; - - print_time(prev_dts); - printf(" "); - print_time(dts - prev_dts); - prev_dts = dts; + register_dts(vd->fmt_ctx->streams[0]->cur_dts); if (!frame_flag && !average_flag) { printf("\n"); @@ -193,6 +198,11 @@ main(int argc, char **argv) pswap((void **)&frame_a, (void **)&frame_b); } + if (diff_flag) { + register_dts(vd->fmt_ctx->streams[0]->cur_dts); + printf("\n"); + } + video_decode_free_frame(&frame_a); video_decode_free_frame(&frame_b); video_decode_uninit(&vd); -- cgit