+ if (hls->segment_type == SEGMENT_TYPE_FMP4) {
+ hls->fmp4_init_mode = 1;
+ if ((ret = s->io_open(s, &oc->pb, hls->fmp4_init_filename, AVIO_FLAG_WRITE, NULL)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", hls->fmp4_init_filename);
+ return ret;
+ }
+
+ if (hls->format_options_str) {
+ ret = av_dict_parse_string(&hls->format_options, hls->format_options_str, "=", ":", 0);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "Could not parse format options list '%s'\n",
+ hls->format_options_str);
+ return ret;
+ }
+ }
+
+ av_dict_copy(&options, hls->format_options, 0);
+ av_dict_set(&options, "fflags", "-autobsf", 0);
+ av_dict_set(&options, "movflags", "frag_custom+dash+delay_moov", 0);
+ ret = avformat_init_output(oc, &options);
+ if (av_dict_count(options)) {
+ av_log(s, AV_LOG_ERROR, "Some of the provided format options in '%s' are not recognized\n", hls->format_options_str);
+ av_dict_free(&options);
+ return AVERROR(EINVAL);
+ }
+ av_dict_free(&options);
+ }