+ ff_format_set_url(oc, wc->header_filename);
+ wc->header_filename = NULL;
+
+ oc->interrupt_callback = s->interrupt_callback;
+ oc->max_delay = s->max_delay;
+ oc->flags = s->flags & ~AVFMT_FLAG_FLUSH_PACKETS;
+ oc->strict_std_compliance = s->strict_std_compliance;
+ oc->avoid_negative_ts = s->avoid_negative_ts;
+
+ oc->flush_packets = 0;
+
+ if ((ret = av_dict_copy(&oc->metadata, s->metadata, 0)) < 0)
+ return ret;
+
+ if (!(st = avformat_new_stream(oc, NULL)))
+ return AVERROR(ENOMEM);
+
+ if ((ret = avcodec_parameters_copy(st->codecpar, ost->codecpar)) < 0 ||
+ (ret = av_dict_copy(&st->metadata, ost->metadata, 0)) < 0)
+ return ret;
+
+ st->sample_aspect_ratio = ost->sample_aspect_ratio;
+ st->disposition = ost->disposition;
+ avpriv_set_pts_info(st, ost->pts_wrap_bits, ost->time_base.num,
+ ost->time_base.den);
+
+ if (wc->http_method)
+ if ((ret = av_dict_set(&dict, "method", wc->http_method, 0)) < 0)
+ return ret;
+ ret = s->io_open(s, &oc->pb, oc->url, AVIO_FLAG_WRITE, &dict);
+ av_dict_free(&dict);
+ if (ret < 0)
+ return ret;
+ oc->pb->seekable = 0;
+
+ if ((ret = av_dict_set_int(&dict, "dash", 1, 0)) < 0 ||
+ (ret = av_dict_set_int(&dict, "cluster_time_limit",
+ wc->chunk_duration, 0)) < 0 ||
+ (ret = av_dict_set_int(&dict, "live", 1, 0)) < 0)
+ goto fail;
+
+ ret = avformat_init_output(oc, &dict);
+fail:
+ av_dict_free(&dict);
+ if (ret < 0)
+ return ret;