summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-29 19:15:39 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-29 19:15:39 +0100
commit7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1 (patch)
treee47f39de6f29df171f3a1438a228dfb528829282 /src
parent9bb72a11a532a10cfb813d001f4ab3fb3eeb3434 (diff)
downloadadvtime-7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1.tar.gz
advtime-7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1.tar.bz2
advtime-7f8f138c78aa1802da5c3bb6d0e06f51ac546ee1.zip
advtime: Also print the range for the last frame
Diffstat (limited to 'src')
-rw-r--r--src/advtime.c24
1 files changed, 17 insertions, 7 deletions
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);