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

Function avformat_free_context

libavformat/avformat.c:144–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void avformat_free_context(AVFormatContext *s)
145{
146 FormatContextInternal *fci;
147 FFFormatContext *si;
148
149 if (!s)
150 return;
151 fci = ff_fc_internal(s);
152 si = &fci->fc;
153
154 if (s->oformat && ffofmt(s->oformat)->deinit && fci->initialized)
155 ffofmt(s->oformat)->deinit(s);
156
157 av_opt_free(s);
158 if (s->iformat && s->iformat->priv_class && s->priv_data)
159 av_opt_free(s->priv_data);
160 if (s->oformat && s->oformat->priv_class && s->priv_data)
161 av_opt_free(s->priv_data);
162
163 for (unsigned i = 0; i < s->nb_streams; i++)
164 ff_free_stream(&s->streams[i]);
165 for (unsigned i = 0; i < s->nb_stream_groups; i++)
166 ff_free_stream_group(&s->stream_groups[i]);
167 s->nb_stream_groups = 0;
168 s->nb_streams = 0;
169
170 for (unsigned i = 0; i < s->nb_programs; i++) {
171 av_dict_free(&s->programs[i]->metadata);
172 av_freep(&s->programs[i]->stream_index);
173 av_freep(&s->programs[i]);
174 }
175 s->nb_programs = 0;
176
177 av_freep(&s->programs);
178 av_freep(&s->priv_data);
179 while (s->nb_chapters--) {
180 av_dict_free(&s->chapters[s->nb_chapters]->metadata);
181 av_freep(&s->chapters[s->nb_chapters]);
182 }
183 av_freep(&s->chapters);
184 av_dict_free(&s->metadata);
185 av_dict_free(&si->id3v2_meta);
186 av_packet_free(&si->pkt);
187 av_packet_free(&si->parse_pkt);
188 avpriv_packet_list_free(&si->packet_buffer);
189 av_freep(&s->streams);
190 av_freep(&s->stream_groups);
191 if (s->iformat)
192 ff_flush_packet_queue(s);
193 av_freep(&s->url);
194 av_freep(&s->name);
195 av_free(s);
196}
197
198/**
199 * Copy all stream parameters from source to destination stream, with the

Callers 15

list_devices_for_contextFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
mainFunction · 0.85
avformat_alloc_contextFunction · 0.85
mov_read_closeFunction · 0.85
ff_mov_close_hintingFunction · 0.85
ff_rtsp_undo_setupFunction · 0.85
dvdvideo_subdemux_openFunction · 0.85
hls_deinitFunction · 0.85
avformat_open_inputFunction · 0.85

Calls 10

ffofmtFunction · 0.85
av_opt_freeFunction · 0.85
ff_free_streamFunction · 0.85
ff_free_stream_groupFunction · 0.85
av_dict_freeFunction · 0.85
av_freepFunction · 0.85
av_packet_freeFunction · 0.85
avpriv_packet_list_freeFunction · 0.85
ff_flush_packet_queueFunction · 0.85
av_freeFunction · 0.50

Tested by 2

run_testFunction · 0.68
finishFunction · 0.68