diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-01-29 19:53:26 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-01-29 19:57:40 +0100 |
commit | 51f98bcfea541de1db6e18d8e426a4d9e4a25410 (patch) | |
tree | bcd32dd065658e76ec0b307fa8b34dd13c38c85b | |
parent | 7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1 (diff) | |
download | advtime-51f98bcfea541de1db6e18d8e426a4d9e4a25410.tar.gz advtime-51f98bcfea541de1db6e18d8e426a4d9e4a25410.tar.bz2 advtime-51f98bcfea541de1db6e18d8e426a4d9e4a25410.zip |
advtime: The end-time of frame n-1 needs to be < start_time of frame n
-rw-r--r-- | src/advtime.c | 17 |
1 files changed, 10 insertions, 7 deletions
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"); } |