} HLSContext;
static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
- AVDictionary **options) {
+ AVDictionary **options)
+{
HLSContext *hls = s->priv_data;
int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
int err = AVERROR_MUXER_NOT_FOUND;
return err;
}
-static int hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filename) {
+static int hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filename)
+{
HLSContext *hls = s->priv_data;
int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
int ret = 0;
av_dict_set(options, "headers", c->headers, 0);
}
-static void write_codec_attr(AVStream *st, VariantStream *vs) {
+static void write_codec_attr(AVStream *st, VariantStream *vs)
+{
int codec_strlen = strlen(vs->codec_attr);
char attr[32];
}
static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
- VariantStream *vs) {
+ VariantStream *vs)
+{
HLSSegment *segment, *previous_segment = NULL;
float playlist_duration = 0.0f;
oc->io_close = s->io_close;
av_dict_copy(&oc->metadata, s->metadata, 0);
- if(vs->vtt_oformat) {
+ if (vs->vtt_oformat) {
ret = avformat_alloc_output_context2(&vs->vtt_avf, vs->vtt_oformat, NULL, NULL);
if (ret < 0)
return ret;
}
av_strlcpy(en->filename, filename, sizeof(en->filename));
- if(vs->has_subtitle)
+ if (vs->has_subtitle)
av_strlcpy(en->sub_filename, av_basename(vs->vtt_avf->url), sizeof(en->sub_filename));
else
en->sub_filename[0] = '\0';
{
HLSSegment *en;
- while(p) {
+ while (p) {
en = p;
p = p->next;
av_free(en);
return media_url + base_len;
}
-static int64_t get_stream_bit_rate(AVStream *stream) {
+static int64_t get_stream_bit_rate(AVStream *stream)
+{
AVCPBProperties *props = (AVCPBProperties*)av_stream_get_side_data(
stream,
AV_PKT_DATA_CPB_PROPERTIES,
}
}
fail:
- if(ret >=0)
+ if (ret >=0)
hls->master_m3u8_created = 1;
hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
if (use_temp_file)
ff_hls_write_playlist_header((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, hls->version, hls->allowcache,
target_duration, sequence, hls->pl_type, hls->flags & HLS_I_FRAMES_ONLY);
- if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && vs->discontinuity_set==0 ){
+ if ((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && vs->discontinuity_set==0 ) {
avio_printf((byterange_mode || hls->segment_type == SEGMENT_TYPE_FMP4) ? hls->m3u8_out : vs->out, "#EXT-X-DISCONTINUITY\n");
vs->discontinuity_set = 1;
}
}
ff_format_set_url(oc, filename);
}
- if( vs->vtt_basename) {
+ if ( vs->vtt_basename) {
char *filename = NULL;
if (replace_int_data_in_filename(&filename,
#if FF_API_HLS_WRAP
*/
p = av_strdup(hls->var_stream_map);
q = p;
- while(av_strtok(q, " \t", &saveptr1)) {
+ while (av_strtok(q, " \t", &saveptr1)) {
q = NULL;
hls->nb_varstreams++;
}
atoi(val));
if (stream_index >= 0 && nb_streams < vs->nb_streams) {
- for(i = 0; nb_streams > 0 && i < nb_streams; i++) {
+ for (i = 0; nb_streams > 0 && i < nb_streams; i++) {
if (vs->streams[i] == s->streams[stream_index]) {
av_log(s, AV_LOG_ERROR, "Same elementary stream found more than once inside "
"variant definition #%d\n", nb_varstreams - 1);
return AVERROR(EINVAL);
}
}
- for(j = 0; nb_varstreams > 1 && j < nb_varstreams - 1; j++) {
- for(i = 0; i < hls->var_streams[j].nb_streams; i++) {
+ for (j = 0; nb_varstreams > 1 && j < nb_varstreams - 1; j++) {
+ for (i = 0; i < hls->var_streams[j].nb_streams; i++) {
if (hls->var_streams[j].streams[i] == s->streams[stream_index]) {
av_log(s, AV_LOG_ERROR, "Same elementary stream found more than once "
"in two different variant definitions #%d and #%d\n",
p = av_strdup(hls->cc_stream_map);
q = p;
- while(av_strtok(q, " \t", &saveptr1)) {
+ while (av_strtok(q, " \t", &saveptr1)) {
q = NULL;
hls->nb_ccstreams++;
}
}
if (av_strstart(ccs->instreamid, "CC", &val)) {
- if(atoi(val) < 1 || atoi(val) > 4) {
+ if (atoi(val) < 1 || atoi(val) > 4) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else if (av_strstart(ccs->instreamid, "SERVICE", &val)) {
- if(atoi(val) < 1 || atoi(val) > 63) {
+ if (atoi(val) < 1 || atoi(val) > 63) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
return 0;
}
-static int update_variant_stream_info(AVFormatContext *s) {
+static int update_variant_stream_info(AVFormatContext *s)
+{
HLSContext *hls = s->priv_data;
unsigned int i;
int ret = 0;
return 0;
}
-static int update_master_pl_info(AVFormatContext *s) {
+static int update_master_pl_info(AVFormatContext *s)
+{
HLSContext *hls = s->priv_data;
const char *dir;
char *fn1= NULL, *fn2 = NULL;
vs = &hls->var_streams[i];
for (j = 0; j < vs->nb_streams; j++) {
if (vs->streams[j] == st) {
- if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) {
+ if ( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) {
oc = vs->vtt_avf;
stream_index = 0;
} else {