@@ -2798,13 +2798,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)
@@ -2899,6 +2892,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";
Before this commit, the checks were unnecessarily scattered. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- Now not moving variables into a smaller scope. libavformat/hlsenc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)