diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-06-10 17:41:57 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-06-12 08:17:50 +0200 |
commit | 48e50921337984ba4ec2c1cafe45d43787f84498 (patch) | |
tree | cdff6ba978f6833938f107f79b23a3ec4762257f /avconv.c | |
parent | 2f4170312f605c1f02a14c01347e94cf46726dbd (diff) | |
download | ffmpeg-48e50921337984ba4ec2c1cafe45d43787f84498.tar.gz |
avconv: make -shortest work with streamcopy
CC: libav-stable@libav.org
Diffstat (limited to 'avconv.c')
-rw-r--r-- | avconv.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -707,6 +707,19 @@ static int poll_filter(OutputStream *ost) return 0; } +static void finish_output_stream(OutputStream *ost) +{ + OutputFile *of = output_files[ost->file_index]; + int i; + + ost->finished = 1; + + if (of->shortest) { + for (i = 0; i < of->ctx->nb_streams; i++) + output_streams[of->ost_index + i]->finished = 1; + } +} + /* * Read as many frames from possible from lavfi and encode them. * @@ -717,7 +730,7 @@ static int poll_filter(OutputStream *ost) */ static int poll_filters(void) { - int i, j, ret = 0; + int i, ret = 0; while (ret >= 0 && !received_sigterm) { OutputStream *ost = NULL; @@ -744,15 +757,7 @@ static int poll_filters(void) ret = poll_filter(ost); if (ret == AVERROR_EOF) { - OutputFile *of = output_files[ost->file_index]; - - ost->finished = 1; - - if (of->shortest) { - for (j = 0; j < of->ctx->nb_streams; j++) - output_streams[of->ost_index + j]->finished = 1; - } - + finish_output_stream(ost); ret = 0; } else if (ret == AVERROR(EAGAIN)) return 0; @@ -2376,7 +2381,7 @@ static int process_input(void) if (ost->source_index == ifile->ist_index + i && (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE)) - ost->finished= 1; + finish_output_stream(ost); } } |