diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 10:25:32 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 10:25:32 +0200 |
commit | 3fa72de82f04802e307085d3fce9eafea1d3dc46 (patch) | |
tree | 075119600cac0d5d61b710c51a1c669306cc291b /ffmpeg_opt.c | |
parent | 84bc317019ba5c35355592df64d152f2cff76339 (diff) | |
parent | 56ee3f9de7b9f6090d599a27d33a392890a2f7b8 (diff) | |
download | ffmpeg-3fa72de82f04802e307085d3fce9eafea1d3dc46.tar.gz |
Merge commit '56ee3f9de7b9f6090d599a27d33a392890a2f7b8'
* commit '56ee3f9de7b9f6090d599a27d33a392890a2f7b8':
avconv: distinguish between -ss 0 and -ss not being used
Conflicts:
ffmpeg.c
ffmpeg_opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r-- | ffmpeg_opt.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 6e7797f5ab..65f3df92f9 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -147,6 +147,7 @@ static void init_options(OptionsContext *o, int is_input) o->recording_time = INT64_MAX; o->stop_time = INT64_MAX; o->mux_max_delay = 0.7; + o->start_time = AV_NOPTS_VALUE; o->limit_filesize = UINT64_MAX; o->chapters_input_file = INT_MAX; } @@ -824,13 +825,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 = avformat_seek_file(ic, -1, INT64_MIN, timestamp, timestamp, 0); if (ret < 0) { av_log(NULL, AV_LOG_WARNING, "%s: could not seek to position %0.3f\n", @@ -1451,7 +1452,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); @@ -1586,11 +1588,12 @@ static int open_output_file(OptionsContext *o, const char *filename) } if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) { - if (o->stop_time <= o->start_time) { + int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : o->start_time; + if (o->stop_time <= start_time) { av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring -to.\n"); o->stop_time = INT64_MAX; } else { - o->recording_time = o->stop_time - o->start_time; + o->recording_time = o->stop_time - start_time; } } |