1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

fftools/ffmpeg: open decoders right after we know they are needed

Will allow initializing subtitle encoding earlier.
This commit is contained in:
Anton Khirnov 2023-04-11 13:27:44 +02:00
parent c8fa58430e
commit 2058402e00
2 changed files with 6 additions and 5 deletions

View File

@ -1882,11 +1882,6 @@ static int transcode_init(void)
ifile->streams[j]->start = av_gettime_relative();
}
/* init input streams */
for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist))
if (ist->decoding_needed && (ret = dec_open(ist)) < 0)
goto dump_format;
/*
* initialize stream copy and subtitle/data streams.
* Encoded AVFrame based streams will get initialized when the first AVFrame

View File

@ -566,6 +566,12 @@ static void ist_use(InputStream *ist, int decoding_needed)
ist->discard = 0;
ist->st->discard = ist->user_set_discard;
ist->decoding_needed |= decoding_needed;
if (decoding_needed && !avcodec_is_open(ist->dec_ctx)) {
int ret = dec_open(ist);
if (ret < 0)
report_and_exit(ret);
}
}
void ist_output_add(InputStream *ist, OutputStream *ost)