| @@ -42,6 +42,7 @@ version <next>: | |||||
| - RTMPE protocol support | - RTMPE protocol support | ||||
| - RTMPTE protocol support | - RTMPTE protocol support | ||||
| - Canopus Lossless Codec decoder | - Canopus Lossless Codec decoder | ||||
| - avconv -shortest option is now per-output file | |||||
| version 0.8: | version 0.8: | ||||
| @@ -719,7 +719,7 @@ static int poll_filter(OutputStream *ost) | |||||
| */ | */ | ||||
| static int poll_filters(void) | static int poll_filters(void) | ||||
| { | { | ||||
| int i, ret = 0; | |||||
| int i, j, ret = 0; | |||||
| while (ret >= 0 && !received_sigterm) { | while (ret >= 0 && !received_sigterm) { | ||||
| OutputStream *ost = NULL; | OutputStream *ost = NULL; | ||||
| @@ -746,10 +746,14 @@ static int poll_filters(void) | |||||
| ret = poll_filter(ost); | ret = poll_filter(ost); | ||||
| if (ret == AVERROR_EOF) { | if (ret == AVERROR_EOF) { | ||||
| OutputFile *of = output_files[ost->file_index]; | |||||
| ost->finished = 1; | 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; | ret = 0; | ||||
| } else if (ret == AVERROR(EAGAIN)) | } 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(); | reset_eagain(); | ||||
| @@ -113,6 +113,7 @@ typedef struct OptionsContext { | |||||
| uint64_t limit_filesize; | uint64_t limit_filesize; | ||||
| float mux_preload; | float mux_preload; | ||||
| float mux_max_delay; | float mux_max_delay; | ||||
| int shortest; | |||||
| int video_disable; | int video_disable; | ||||
| int audio_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 recording_time; /* desired length of the resulting file in microseconds */ | ||||
| int64_t start_time; /* start time in microseconds */ | int64_t start_time; /* start time in microseconds */ | ||||
| uint64_t limit_filesize; | uint64_t limit_filesize; | ||||
| int shortest; | |||||
| } OutputFile; | } OutputFile; | ||||
| extern InputStream **input_streams; | extern InputStream **input_streams; | ||||
| @@ -333,7 +336,6 @@ extern int do_hex_dump; | |||||
| extern int do_pkt_dump; | extern int do_pkt_dump; | ||||
| extern int copy_ts; | extern int copy_ts; | ||||
| extern int copy_tb; | extern int copy_tb; | ||||
| extern int opt_shortest; | |||||
| extern int exit_on_error; | extern int exit_on_error; | ||||
| extern int print_stats; | extern int print_stats; | ||||
| extern int qp_hist; | extern int qp_hist; | ||||
| @@ -1352,6 +1352,7 @@ loop_end: | |||||
| oc->duration = o->recording_time; | oc->duration = o->recording_time; | ||||
| output_files[nb_output_files - 1]->start_time = o->start_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]->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); | av_dict_copy(&output_files[nb_output_files - 1]->opts, format_opts, 0); | ||||
| /* check filename in case of an image number is expected */ | /* 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" }, | { "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" }, | { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)©_ts}, "copy timestamps" }, | ||||
| { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)©_tb}, "copy input stream time base when stream copying" }, | { "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" }, | { "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" }, | { "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" }, | { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC, {.off = OFFSET(copy_initial_nonkeyframes)}, "copy initial non-keyframes" }, | ||||
| @@ -752,7 +752,7 @@ This option has been deprecated. Use the @code{asyncts} audio filter instead. | |||||
| Copy timestamps from input to output. | Copy timestamps from input to output. | ||||
| @item -copytb | @item -copytb | ||||
| Copy input stream time base from input to output when stream copying. | 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. | Finish encoding when the shortest input stream ends. | ||||
| @item -dts_delta_threshold | @item -dts_delta_threshold | ||||
| Timestamp discontinuity delta threshold. | Timestamp discontinuity delta threshold. | ||||