unsigned int nb_streams;
int m3u8_created; /* status of media play-list creation */
int is_default; /* default status of audio group */
- char *language; /* audio lauguage name */
- char *agroup; /* audio group name */
- char *sgroup; /* subtitle group name */
- char *ccgroup; /* closed caption group name */
- char *varname; // variant name
+ const char *language; /* audio lauguage name */
+ const char *agroup; /* audio group name */
+ const char *sgroup; /* subtitle group name */
+ const char *ccgroup; /* closed caption group name */
+ const char *varname; /* variant name */
} VariantStream;
typedef struct ClosedCaptionsStream {
- char *ccgroup; /* closed caption group name */
- char *instreamid; /* closed captions INSTREAM-ID */
- char *language; /* closed captions langauge */
+ const char *ccgroup; /* closed caption group name */
+ const char *instreamid; /* closed captions INSTREAM-ID */
+ const char *language; /* closed captions langauge */
} ClosedCaptionsStream;
typedef struct HLSContext {
int ret, bandwidth;
const char *m3u8_rel_name = NULL;
const char *vtt_m3u8_rel_name = NULL;
- char *ccgroup;
- char *sgroup = NULL;
+ const char *ccgroup;
+ const char *sgroup = NULL;
ClosedCaptionsStream *ccs;
const char *proto = avio_find_protocol_name(hls->master_m3u8_url);
int is_file_proto = proto && !strcmp(proto, "file");
char *end;
varstr = NULL;
if (av_strstart(keyval, "language:", &val)) {
- av_free(vs->language);
- vs->language = av_strdup(val);
- if (!vs->language)
- return AVERROR(ENOMEM);
+ vs->language = val;
continue;
} else if (av_strstart(keyval, "default:", &val)) {
vs->is_default = (!av_strncasecmp(val, "YES", strlen("YES")) ||
hls->has_default_key = 1;
continue;
} else if (av_strstart(keyval, "name:", &val)) {
- av_free(vs->varname);
- vs->varname = av_strdup(val);
- if (!vs->varname)
- return AVERROR(ENOMEM);
+ vs->varname = val;
continue;
} else if (av_strstart(keyval, "agroup:", &val)) {
- av_free(vs->agroup);
- vs->agroup = av_strdup(val);
- if (!vs->agroup)
- return AVERROR(ENOMEM);
+ vs->agroup = val;
continue;
} else if (av_strstart(keyval, "sgroup:", &val)) {
- av_free(vs->sgroup);
- vs->sgroup = av_strdup(val);
- if (!vs->sgroup)
- return AVERROR(ENOMEM);
+ vs->sgroup = val;
continue;
} else if (av_strstart(keyval, "ccgroup:", &val)) {
- av_free(vs->ccgroup);
- vs->ccgroup = av_strdup(val);
- if (!vs->ccgroup)
- return AVERROR(ENOMEM);
+ vs->ccgroup = val;
continue;
} else if (av_strstart(keyval, "v:", &val)) {
codec_type = AVMEDIA_TYPE_VIDEO;
ccstr = NULL;
if (av_strstart(keyval, "ccgroup:", &val)) {
- av_free(ccs->ccgroup);
- ccs->ccgroup = av_strdup(val);
- if (!ccs->ccgroup)
- return AVERROR(ENOMEM);
+ ccs->ccgroup = val;
} else if (av_strstart(keyval, "instreamid:", &val)) {
- av_free(ccs->instreamid);
- ccs->instreamid = av_strdup(val);
- if (!ccs->instreamid)
- return AVERROR(ENOMEM);
+ ccs->instreamid = val;
} else if (av_strstart(keyval, "language:", &val)) {
- av_free(ccs->language);
- ccs->language = av_strdup(val);
- if (!ccs->language)
- return AVERROR(ENOMEM);
+ ccs->language = val;
} else {
av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval);
return AVERROR(EINVAL);
//by default, the first available ccgroup is mapped to the variant stream
if (hls->nb_ccstreams) {
- hls->var_streams[0].ccgroup = av_strdup(hls->cc_streams[0].ccgroup);
- if (!hls->var_streams[0].ccgroup)
- return AVERROR(ENOMEM);
+ hls->var_streams[0].ccgroup = hls->cc_streams[0].ccgroup;
}
for (i = 0; i < s->nb_streams; i++)
hls_free_segments(vs->old_segments);
av_freep(&vs->m3u8_name);
av_freep(&vs->streams);
- av_freep(&vs->agroup);
- av_freep(&vs->sgroup);
- av_freep(&vs->language);
- av_freep(&vs->ccgroup);
- av_freep(&vs->varname);
- }
-
- for (i = 0; i < hls->nb_ccstreams; i++) {
- ClosedCaptionsStream *ccs = &hls->cc_streams[i];
-
- av_freep(&ccs->ccgroup);
- av_freep(&ccs->instreamid);
- av_freep(&ccs->language);
}
ff_format_io_close(s, &hls->m3u8_out);