MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / segment_mux_init

Function segment_mux_init

libavformat/segment.c:149–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149static int segment_mux_init(AVFormatContext *s)
150{
151 SegmentContext *seg = s->priv_data;
152 AVFormatContext *oc;
153 int i;
154 int ret;
155
156 ret = avformat_alloc_output_context2(&seg->avf, seg->oformat, NULL, NULL);
157 if (ret < 0)
158 return ret;
159 oc = seg->avf;
160
161 oc->interrupt_callback = s->interrupt_callback;
162 oc->max_delay = s->max_delay;
163 av_dict_copy(&oc->metadata, s->metadata, 0);
164 oc->opaque = s->opaque;
165 oc->io_close2 = s->io_close2;
166 oc->io_open = s->io_open;
167 oc->flags = s->flags;
168
169 for (i = 0; i < s->nb_streams; i++) {
170 AVStream *st, *ist = s->streams[i];
171 AVCodecParameters *ipar = ist->codecpar, *opar;
172
173 st = ff_stream_clone(oc, ist);
174 if (!st)
175 return AVERROR(ENOMEM);
176 opar = st->codecpar;
177 if (!oc->oformat->codec_tag ||
178 av_codec_get_id (oc->oformat->codec_tag, ipar->codec_tag) == opar->codec_id ||
179 av_codec_get_tag(oc->oformat->codec_tag, ipar->codec_id) <= 0) {
180 opar->codec_tag = ipar->codec_tag;
181 } else {
182 opar->codec_tag = 0;
183 }
184 }
185
186 return 0;
187}
188
189static int set_segment_filename(AVFormatContext *s)
190{

Callers 2

segment_startFunction · 0.85
seg_initFunction · 0.85

Calls 5

av_dict_copyFunction · 0.85
ff_stream_cloneFunction · 0.85
av_codec_get_idFunction · 0.85
av_codec_get_tagFunction · 0.85

Tested by

no test coverage detected