fftools/ffmpeg: replace OutputStream.file_index by a pointer

Reduces the need to use the output_files global array.
This commit is contained in:
Anton Khirnov
2023-12-13 18:39:02 +01:00
parent 0fcea80b2a
commit 4224895a87
6 changed files with 42 additions and 40 deletions

View File

@@ -374,7 +374,7 @@ static void ffmpeg_cleanup(int ret)
OutputStream *ost_iter(OutputStream *prev)
{
int of_idx = prev ? prev->file_index : 0;
int of_idx = prev ? prev->file->index : 0;
int ost_idx = prev ? prev->index + 1 : 0;
for (; of_idx < nb_output_files; of_idx++) {
@@ -530,7 +530,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
if (vid && ost->type == AVMEDIA_TYPE_VIDEO) {
av_bprintf(&buf, "q=%2.1f ", q);
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
ost->file_index, ost->index, q);
ost->file->index, ost->index, q);
}
if (!vid && ost->type == AVMEDIA_TYPE_VIDEO && ost->filter) {
float fps;
@@ -542,7 +542,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
av_bprintf(&buf_script, "frame=%"PRId64"\n", frame_number);
av_bprintf(&buf_script, "fps=%.2f\n", fps);
av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n",
ost->file_index, ost->index, q);
ost->file->index, ost->index, q);
if (is_last_report)
av_bprintf(&buf, "L");
@@ -780,7 +780,7 @@ static void print_stream_maps(void)
if (ost->attachment_filename) {
/* an attached file */
av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n",
ost->attachment_filename, ost->file_index, ost->index);
ost->attachment_filename, ost->file->index, ost->index);
continue;
}
@@ -790,7 +790,7 @@ static void print_stream_maps(void)
if (nb_filtergraphs > 1)
av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);
av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index,
av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file->index,
ost->index, ost->enc_ctx->codec->name);
continue;
}
@@ -798,7 +798,7 @@ static void print_stream_maps(void)
av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d",
ost->ist->file->index,
ost->ist->index,
ost->file_index,
ost->file->index,
ost->index);
if (ost->enc_ctx) {
const AVCodec *in_codec = ost->ist->dec;