From fba94d328c9c0aab1f75cab10542d214074c5054 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sat, 2 Feb 2013 20:30:01 +0100 Subject: findcut: Add range flag So that we get the start time and end time. --- src/findcut.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/findcut.c b/src/findcut.c index ebb18e5..b5b0976 100644 --- a/src/findcut.c +++ b/src/findcut.c @@ -29,12 +29,12 @@ main(int argc, char **argv) struct video_decode *cut_vd; struct video_frame *cur_frame = NULL, *cut_frame = NULL; int ret, ch; - int diff_flag = 0, time_flag = 0; + int diff_flag = 0, time_flag = 0, range_flag = 0; int64_t timestamp = 0; int64_t threshold = 10; double diff = 0.0; - while ((ch = getopt(argc, argv, "dtTh")) != -1) { + while ((ch = getopt(argc, argv, "dtThr")) != -1) { switch (ch) { case 'd': diff_flag = 1; /* print diff of every frame */ @@ -45,6 +45,9 @@ main(int argc, char **argv) case 'T': time_flag = 1; break; + case 'r': + range_flag = 1; + break; case 'h': default: usage(); @@ -77,7 +80,17 @@ main(int argc, char **argv) else print_time(cur_frame->dts); - printf(" %f\n", diff); + if (range_flag) { + printf(" "); + if (time_flag) + printf("%" PRId64, cur_frame->dts+cut_vd->duration); + else + print_time(cur_frame->dts+cut_vd->duration); + + printf("\n"); + } else + printf(" %f\n", diff); + fflush(stdout); } } -- cgit