avconv: make -shortest work with streamcopy
CC: libav-stable@libav.org
(cherry picked from commit 48e5092133
)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
27
avconv.c
27
avconv.c
@@ -687,6 +687,19 @@ static int poll_filter(OutputStream *ost)
|
|||||||
return 0;
|
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.
|
* Read as many frames from possible from lavfi and encode them.
|
||||||
*
|
*
|
||||||
@@ -697,7 +710,7 @@ static int poll_filter(OutputStream *ost)
|
|||||||
*/
|
*/
|
||||||
static int poll_filters(void)
|
static int poll_filters(void)
|
||||||
{
|
{
|
||||||
int i, j, ret = 0;
|
int i, ret = 0;
|
||||||
|
|
||||||
while (ret >= 0 && !received_sigterm) {
|
while (ret >= 0 && !received_sigterm) {
|
||||||
OutputStream *ost = NULL;
|
OutputStream *ost = NULL;
|
||||||
@@ -724,15 +737,7 @@ 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];
|
finish_output_stream(ost);
|
||||||
|
|
||||||
ost->finished = 1;
|
|
||||||
|
|
||||||
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))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2205,7 +2210,7 @@ static int process_input(void)
|
|||||||
|
|
||||||
if (ost->source_index == ifile->ist_index + i &&
|
if (ost->source_index == ifile->ist_index + i &&
|
||||||
(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
|
(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
|
||||||
ost->finished= 1;
|
finish_output_stream(ost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user