summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_demux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-04-11 13:27:44 +0200
committerAnton Khirnov <anton@khirnov.net>2023-04-17 12:01:40 +0200
commit2058402e001268e8bc68b33a8979429a73ed1b74 (patch)
treee663e6833fd2e42edd360f8f10c24313fc4622e4 /fftools/ffmpeg_demux.c
parentc8fa58430edd6b2c3527d851baaa5a418e2ab9e2 (diff)
downloadffmpeg-2058402e001268e8bc68b33a8979429a73ed1b74.tar.gz
fftools/ffmpeg: open decoders right after we know they are needed
Will allow initializing subtitle encoding earlier.
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r--fftools/ffmpeg_demux.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index c7141abadf..5afb3ff2c8 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -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)