From 51f98bcfea541de1db6e18d8e426a4d9e4a25410 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 29 Jan 2013 19:53:26 +0100 Subject: advtime: The end-time of frame n-1 needs to be < start_time of frame n --- src/advtime.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/advtime.c b/src/advtime.c index 32c675d..a928562 100644 --- a/src/advtime.c +++ b/src/advtime.c @@ -34,14 +34,14 @@ print_time(int64_t msec) { } static void -register_dts(int64_t dts) +start_new_szene(int64_t prev_szene_end, int64_t start) { - static int prev_dts = 0; + static int prev_dts_start = 0; - print_time(prev_dts); + print_time(prev_dts_start); printf(" "); - print_time(dts - prev_dts); - prev_dts = dts; + print_time(prev_szene_end - prev_dts_start); + prev_dts_start = start; } static double @@ -100,6 +100,7 @@ main(int argc, char **argv) int ret, ch; int diff_flag = 0, average_flag = 0, frame_flag = 0, showcut_flag = 0; int64_t timestamp = 0; + int64_t last_dts = 0; double diff = 0.0, old_diff = 0.0; char filename[BUFSIZ]; @@ -172,7 +173,7 @@ main(int argc, char **argv) } if (diff > 40.0) { - register_dts(vd->fmt_ctx->streams[0]->cur_dts); + start_new_szene(last_dts, vd->fmt_ctx->streams[0]->cur_dts); if (!frame_flag && !average_flag) { printf("\n"); @@ -196,10 +197,12 @@ main(int argc, char **argv) } pswap((void **)&frame_a, (void **)&frame_b); + last_dts = vd->fmt_ctx->streams[0]->cur_dts; } if (diff_flag) { - register_dts(vd->fmt_ctx->streams[0]->cur_dts); + /* acutally we just finalize the last frame here */ + start_new_szene(last_dts, 0); printf("\n"); } -- cgit