aboutsummaryrefslogtreecommitdiffstats
path: root/avconv_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-06-15 09:35:10 +0200
committerAnton Khirnov <anton@khirnov.net>2013-08-05 10:53:12 +0200
commit56ee3f9de7b9f6090d599a27d33a392890a2f7b8 (patch)
tree258b51993ad04a6a4cede741022b1d19f5a7b2f4 /avconv_opt.c
parent2e661f26f8b12195f75ae3b07d9591e395135bc7 (diff)
downloadffmpeg-56ee3f9de7b9f6090d599a27d33a392890a2f7b8.tar.gz
avconv: distinguish between -ss 0 and -ss not being used
Using -ss 0 to drop frames with negative timestamps is a perfectly valid use case.
Diffstat (limited to 'avconv_opt.c')
-rw-r--r--avconv_opt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/avconv_opt.c b/avconv_opt.c
index f96feced9a..c8d917638b 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -113,6 +113,7 @@ static void init_options(OptionsContext *o)
memset(o, 0, sizeof(*o));
o->mux_max_delay = 0.7;
+ o->start_time = AV_NOPTS_VALUE;
o->recording_time = INT64_MAX;
o->limit_filesize = UINT64_MAX;
o->chapters_input_file = INT_MAX;
@@ -658,13 +659,13 @@ static int open_input_file(OptionsContext *o, const char *filename)
exit_program(1);
}
- timestamp = o->start_time;
+ timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time;
/* add the stream start time */
if (ic->start_time != AV_NOPTS_VALUE)
timestamp += ic->start_time;
/* if seeking requested, we execute it */
- if (o->start_time != 0) {
+ if (o->start_time != AV_NOPTS_VALUE) {
ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
if (ret < 0) {
av_log(NULL, AV_LOG_WARNING, "%s: could not seek to position %0.3f\n",
@@ -1212,7 +1213,8 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
for (i = 0; i < is->nb_chapters; i++) {
AVChapter *in_ch = is->chapters[i], *out_ch;
- int64_t ts_off = av_rescale_q(ofile->start_time - ifile->ts_offset,
+ int64_t start_time = (ofile->start_time == AV_NOPTS_VALUE) ? 0 : ofile->start_time;
+ int64_t ts_off = av_rescale_q(start_time - ifile->ts_offset,
AV_TIME_BASE_Q, in_ch->time_base);
int64_t rt = (ofile->recording_time == INT64_MAX) ? INT64_MAX :
av_rescale_q(ofile->recording_time, AV_TIME_BASE_Q, in_ch->time_base);