MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / ffmpeg_cleanup

Function ffmpeg_cleanup

ffmpeg-single-cmd/src/main/cpp/ffmpeg_mod.c:466–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
465
466static void ffmpeg_cleanup(int ret)
467{
468 int i, j;
469
470 if (do_benchmark) {
471 int maxrss = getmaxrss() / 1024;
472 av_log(NULL, AV_LOG_INFO, "bench: maxrss=%ikB\n", maxrss);
473 }
474
475 for (i = 0; i < nb_filtergraphs; i++) {
476 FilterGraph *fg = filtergraphs[i];
477 avfilter_graph_free(&fg->graph);
478 for (j = 0; j < fg->nb_inputs; j++) {
479 while (av_fifo_size(fg->inputs[j]->frame_queue)) {
480 AVFrame *frame;
481 av_fifo_generic_read(fg->inputs[j]->frame_queue, &frame,
482 sizeof(frame), NULL);
483 av_frame_free(&frame);
484 }
485 av_fifo_free(fg->inputs[j]->frame_queue);
486 if (fg->inputs[j]->ist->sub2video.sub_queue) {
487 while (av_fifo_size(fg->inputs[j]->ist->sub2video.sub_queue)) {
488 AVSubtitle sub;
489 av_fifo_generic_read(fg->inputs[j]->ist->sub2video.sub_queue,
490 &sub, sizeof(sub), NULL);
491 avsubtitle_free(&sub);
492 }
493 av_fifo_free(fg->inputs[j]->ist->sub2video.sub_queue);
494 }
495 av_buffer_unref(&fg->inputs[j]->hw_frames_ctx);
496 av_freep(&fg->inputs[j]->name);
497 av_freep(&fg->inputs[j]);
498 }
499 av_freep(&fg->inputs);
500 for (j = 0; j < fg->nb_outputs; j++) {
501 av_freep(&fg->outputs[j]->name);
502 av_freep(&fg->outputs[j]->formats);
503 av_freep(&fg->outputs[j]->channel_layouts);
504 av_freep(&fg->outputs[j]->sample_rates);
505 av_freep(&fg->outputs[j]);
506 }
507 av_freep(&fg->outputs);
508 av_freep(&fg->graph_desc);
509
510 av_freep(&filtergraphs[i]);
511 }
512 av_freep(&filtergraphs);
513
514 av_freep(&subtitle_out);
515
516 /* close files */
517 for (i = 0; i < nb_output_files; i++) {
518 OutputFile *of = output_files[i];
519 AVFormatContext *s;
520 if (!of)
521 continue;
522 s = of->ctx;
523 if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))

Callers

nothing calls this directly

Calls 4

getmaxrssFunction · 0.85
free_input_threadsFunction · 0.85
uninit_optsFunction · 0.85
term_exitFunction · 0.85

Tested by

no test coverage detected