diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-08-11 11:50:32 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-08-18 08:48:30 +0200 |
commit | 3c0df9058438b68925be2fc6f5af2a05086ad99e (patch) | |
tree | bc1a2ace6271700af353e68bf7519ff2b852e1b1 | |
parent | 91e59fea30f57af7abd1ad6a68a8f6663805ee44 (diff) | |
download | ffmpeg-3c0df9058438b68925be2fc6f5af2a05086ad99e.tar.gz |
avconv: make -shortest a per-output file option.
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | avconv.c | 15 | ||||
-rw-r--r-- | avconv.h | 4 | ||||
-rw-r--r-- | avconv_opt.c | 3 | ||||
-rw-r--r-- | doc/avconv.texi | 2 |
5 files changed, 15 insertions, 10 deletions
@@ -42,6 +42,7 @@ version <next>: - RTMPE protocol support - RTMPTE protocol support - Canopus Lossless Codec decoder +- avconv -shortest option is now per-output file version 0.8: @@ -719,7 +719,7 @@ static int poll_filter(OutputStream *ost) */ static int poll_filters(void) { - int i, ret = 0; + int i, j, ret = 0; while (ret >= 0 && !received_sigterm) { OutputStream *ost = NULL; @@ -746,10 +746,14 @@ static int poll_filters(void) ret = poll_filter(ost); if (ret == AVERROR_EOF) { + OutputFile *of = output_files[ost->file_index]; + ost->finished = 1; - if (opt_shortest) - return ret; + if (of->shortest) { + for (j = 0; j < of->ctx->nb_streams; j++) + output_streams[of->ost_index + j]->finished = 1; + } ret = 0; } else if (ret == AVERROR(EAGAIN)) @@ -2170,10 +2174,7 @@ static int process_input(void) } } - if (opt_shortest) - return AVERROR_EOF; - else - return AVERROR(EAGAIN); + return AVERROR(EAGAIN); } reset_eagain(); @@ -113,6 +113,7 @@ typedef struct OptionsContext { uint64_t limit_filesize; float mux_preload; float mux_max_delay; + int shortest; int video_disable; int audio_disable; @@ -303,6 +304,8 @@ typedef struct OutputFile { int64_t recording_time; /* desired length of the resulting file in microseconds */ int64_t start_time; /* start time in microseconds */ uint64_t limit_filesize; + + int shortest; } OutputFile; extern InputStream **input_streams; @@ -333,7 +336,6 @@ extern int do_hex_dump; extern int do_pkt_dump; extern int copy_ts; extern int copy_tb; -extern int opt_shortest; extern int exit_on_error; extern int print_stats; extern int qp_hist; diff --git a/avconv_opt.c b/avconv_opt.c index 7b86d7613c..dc44986e68 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1352,6 +1352,7 @@ loop_end: oc->duration = o->recording_time; output_files[nb_output_files - 1]->start_time = o->start_time; output_files[nb_output_files - 1]->limit_filesize = o->limit_filesize; + output_files[nb_output_files - 1]->shortest = o->shortest; av_dict_copy(&output_files[nb_output_files - 1]->opts, format_opts, 0); /* check filename in case of an image number is expected */ @@ -1836,7 +1837,7 @@ const OptionDef options[] = { { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" }, { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)©_ts}, "copy timestamps" }, { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)©_tb}, "copy input stream time base when stream copying" }, - { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, // + { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(shortest)}, "finish encoding within shortest input" }, { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" }, { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" }, { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC, {.off = OFFSET(copy_initial_nonkeyframes)}, "copy initial non-keyframes" }, diff --git a/doc/avconv.texi b/doc/avconv.texi index ff5bb5297c..fc6402820b 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -752,7 +752,7 @@ This option has been deprecated. Use the @code{asyncts} audio filter instead. Copy timestamps from input to output. @item -copytb Copy input stream time base from input to output when stream copying. -@item -shortest +@item -shortest (@emph{output}) Finish encoding when the shortest input stream ends. @item -dts_delta_threshold Timestamp discontinuity delta threshold. |