summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/advtime.c17
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");
}