mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 09:12:33 +00:00
avconv: split checking for active outputs out of transcode().
This commit is contained in:
parent
8eb9bf0933
commit
2f51ec2b94
51
avconv.c
51
avconv.c
@ -2855,6 +2855,35 @@ static int transcode_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 1 if there are still streams where more output is wanted,
|
||||||
|
* 0 otherwise
|
||||||
|
*/
|
||||||
|
static int need_output(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < nb_output_streams; i++) {
|
||||||
|
OutputStream *ost = output_streams[i];
|
||||||
|
OutputFile *of = output_files[ost->file_index];
|
||||||
|
AVFormatContext *os = output_files[ost->file_index]->ctx;
|
||||||
|
|
||||||
|
if (ost->is_past_recording_time ||
|
||||||
|
(os->pb && avio_tell(os->pb) >= of->limit_filesize))
|
||||||
|
continue;
|
||||||
|
if (ost->frame_number > ost->max_frames) {
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < of->ctx->nb_streams; j++)
|
||||||
|
output_streams[of->ost_index + j]->is_past_recording_time = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following code is the main loop of the file converter
|
* The following code is the main loop of the file converter
|
||||||
*/
|
*/
|
||||||
@ -2881,31 +2910,17 @@ static int transcode(void)
|
|||||||
timer_start = av_gettime();
|
timer_start = av_gettime();
|
||||||
|
|
||||||
for (; received_sigterm == 0;) {
|
for (; received_sigterm == 0;) {
|
||||||
int file_index, ist_index, past_recording_time = 1;
|
int file_index, ist_index;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
int64_t ipts_min;
|
int64_t ipts_min;
|
||||||
|
|
||||||
ipts_min = INT64_MAX;
|
ipts_min = INT64_MAX;
|
||||||
|
|
||||||
/* check if there's any stream where output is still needed */
|
/* check if there's any stream where output is still needed */
|
||||||
for (i = 0; i < nb_output_streams; i++) {
|
if (!need_output()) {
|
||||||
OutputFile *of;
|
av_log(NULL, AV_LOG_VERBOSE, "No more output streams to write to, finishing.\n");
|
||||||
ost = output_streams[i];
|
|
||||||
of = output_files[ost->file_index];
|
|
||||||
os = output_files[ost->file_index]->ctx;
|
|
||||||
if (ost->is_past_recording_time ||
|
|
||||||
(os->pb && avio_tell(os->pb) >= of->limit_filesize))
|
|
||||||
continue;
|
|
||||||
if (ost->frame_number > ost->max_frames) {
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < of->ctx->nb_streams; j++)
|
|
||||||
output_streams[of->ost_index + j]->is_past_recording_time = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
past_recording_time = 0;
|
|
||||||
}
|
|
||||||
if (past_recording_time)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* select the stream that we must read now by looking at the
|
/* select the stream that we must read now by looking at the
|
||||||
smallest output pts */
|
smallest output pts */
|
||||||
|
Loading…
Reference in New Issue
Block a user