*/
static int poll_filters(void)
{
- int i, ret = 0;
+ int i, j, ret = 0;
while (ret >= 0 && !received_sigterm) {
OutputStream *ost = NULL;
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))
}
}
- if (opt_shortest)
- return AVERROR_EOF;
- else
- return AVERROR(EAGAIN);
+ return AVERROR(EAGAIN);
}
reset_eagain();
uint64_t limit_filesize;
float mux_preload;
float mux_max_delay;
+ int shortest;
int video_disable;
int audio_disable;
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;
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;
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 */
{ "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" },
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.