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

Function chunk_end

libavformat/webm_chunk.c:174–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174static int chunk_end(AVFormatContext *s, int flush)
175{
176 WebMChunkContext *wc = s->priv_data;
177 AVFormatContext *oc = wc->avf;
178 int ret;
179 int buffer_size;
180 uint8_t *buffer;
181 AVIOContext *pb;
182 AVBPrint filename;
183 AVDictionary *options = NULL;
184
185 if (!oc->pb)
186 return 0;
187
188 if (flush)
189 // Flush the cluster in WebM muxer.
190 av_write_frame(oc, NULL);
191 buffer_size = avio_close_dyn_buf(oc->pb, &buffer);
192 oc->pb = NULL;
193 av_bprint_init(&filename, 0, AV_BPRINT_SIZE_UNLIMITED);
194 ret = get_chunk_filename(s, &filename);
195 if (ret < 0)
196 goto fail;
197 if (wc->http_method)
198 if ((ret = av_dict_set(&options, "method", wc->http_method, 0)) < 0)
199 goto fail;
200 ret = s->io_open(s, &pb, filename.str, AVIO_FLAG_WRITE, &options);
201 av_dict_free(&options);
202 if (ret < 0)
203 goto fail;
204 avio_write(pb, buffer, buffer_size);
205 ff_format_io_close(s, &pb);
206fail:
207 av_bprint_finalize(&filename, NULL);
208 av_free(buffer);
209 return (ret < 0) ? ret : 0;
210}
211
212static int webm_chunk_write_packet(AVFormatContext *s, AVPacket *pkt)
213{

Callers 2

webm_chunk_write_packetFunction · 0.85
webm_chunk_write_trailerFunction · 0.85

Calls 10

av_write_frameFunction · 0.85
avio_close_dyn_bufFunction · 0.85
av_bprint_initFunction · 0.85
get_chunk_filenameFunction · 0.85
av_dict_setFunction · 0.85
av_dict_freeFunction · 0.85
avio_writeFunction · 0.85
ff_format_io_closeFunction · 0.85
av_bprint_finalizeFunction · 0.85
av_freeFunction · 0.50

Tested by

no test coverage detected