summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-02-02 20:30:01 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-02-02 20:56:27 +0100
commitfba94d328c9c0aab1f75cab10542d214074c5054 (patch)
tree04d5f99dddb2c1c6511b9f756c95611a50c3d3ce
parentee08432b170b942c8b08ae99ddc15585a9037049 (diff)
downloadadvtime-fba94d328c9c0aab1f75cab10542d214074c5054.tar.gz
advtime-fba94d328c9c0aab1f75cab10542d214074c5054.tar.bz2
advtime-fba94d328c9c0aab1f75cab10542d214074c5054.zip
findcut: Add range flag
So that we get the start time and end time.
-rw-r--r--src/findcut.c19
1 files changed, 16 insertions, 3 deletions
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);
}
}