[FFmpeg-devel] [PATCH 14/16] avformat/hlsenc: Localize initialization of subtitle streams
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Mon Dec 16 02:04:16 EET 2019
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavformat/hlsenc.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index c612c3bbb8..16595f02cd 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2684,9 +2684,7 @@ static int hls_init(AVFormatContext *s)
VariantStream *vs = NULL;
int basename_size = 0;
const char *pattern_localtime_fmt = get_default_pattern_localtime_fmt(s);
- const char *vtt_pattern = "%d.vtt";
char *p = NULL;
- int vtt_basename_size = 0;
int http_base_proto = ff_is_http_proto(s->url);
int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
@@ -2817,13 +2815,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)
@@ -2918,6 +2909,12 @@ static int hls_init(AVFormatContext *s)
goto fail;
if (vs->has_subtitle) {
+ const char *vtt_pattern = "%d.vtt";
+ int vtt_basename_size;
+
+ 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";
--
2.20.1
More information about the ffmpeg-devel
mailing list