From e1dfb5128b90f7a3253465599eeb6d6718359da8 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 15 Dec 2019 22:12:53 +0100 Subject: [PATCH] avformat/hlsenc: Localize initialization of subtitle streams Before this commit, the checks were unnecessarily scattered. Signed-off-by: Andreas Rheinhardt --- libavformat/hlsenc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 20f66d52d1..3d5b09c963 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2878,13 +2878,6 @@ static int hls_init(AVFormatContext *s) goto fail; } - if (vs->has_subtitle) { - vs->vtt_oformat = av_guess_format("webvtt", NULL, NULL); - if (!vs->vtt_oformat) { - ret = AVERROR_MUXER_NOT_FOUND; - goto fail; - } - } if (hls->segment_filename) { ret = format_name(hls->segment_filename, &vs->basename, i, vs->varname); if (ret < 0) @@ -2979,6 +2972,9 @@ static int hls_init(AVFormatContext *s) goto fail; if (vs->has_subtitle) { + vs->vtt_oformat = av_guess_format("webvtt", NULL, NULL); + if (!vs->vtt_oformat) + return AVERROR_MUXER_NOT_FOUND; if (hls->flags & HLS_SINGLE_FILE) vtt_pattern = ".vtt";