[FFmpeg-cvslog] avformat/hlsenc: Localize initialization of subtitle streams

Andreas Rheinhardt git at videolan.org
Fri May 8 16:39:55 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Dec 15 22:12:53 2019 +0100| [e1dfb5128b90f7a3253465599eeb6d6718359da8] | committer: Andreas Rheinhardt

avformat/hlsenc: Localize initialization of subtitle streams

Before this commit, the checks were unnecessarily scattered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1dfb5128b90f7a3253465599eeb6d6718359da8
---

 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";



More information about the ffmpeg-cvslog mailing list