summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);