diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-11-10 17:33:48 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-04-13 12:07:54 +0200 |
commit | 5c66ee6351ae3523206f64e5dc6c1768e438ed34 (patch) | |
tree | 60561453e1b2aeecac79c8859d6a0cd0568a9ce0 /fftools | |
parent | 5bc644ea8a6a0f8d02df36a12c1ce09bda696a77 (diff) | |
download | ffmpeg-5c66ee6351ae3523206f64e5dc6c1768e438ed34.tar.gz |
fftools/ffmpeg: move freeing the output file to ffmpeg_mux.c
Diffstat (limited to 'fftools')
-rw-r--r-- | fftools/ffmpeg.c | 14 | ||||
-rw-r--r-- | fftools/ffmpeg.h | 1 | ||||
-rw-r--r-- | fftools/ffmpeg_mux.c | 17 |
3 files changed, 20 insertions, 12 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index cc7855a4cc..69d1949103 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -565,19 +565,9 @@ static void ffmpeg_cleanup(int ret) av_freep(&subtitle_out); /* close files */ - for (i = 0; i < nb_output_files; i++) { - OutputFile *of = output_files[i]; - AVFormatContext *s; - if (!of) - continue; - s = of->ctx; - if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE)) - avio_closep(&s->pb); - avformat_free_context(s); - av_dict_free(&of->opts); + for (i = 0; i < nb_output_files; i++) + of_close(&output_files[i]); - av_freep(&output_files[i]); - } for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 4425b7a874..ff8ebbfab5 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -690,6 +690,7 @@ int hwaccel_decode_init(AVCodecContext *avctx); /* open the muxer when all the streams are initialized */ int of_check_init(OutputFile *of); int of_write_trailer(OutputFile *of); +void of_close(OutputFile **pof); void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue); diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 5348eef01d..3cdaa494d7 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -311,3 +311,20 @@ int of_write_trailer(OutputFile *of) return 0; } + +void of_close(OutputFile **pof) +{ + OutputFile *of = *pof; + AVFormatContext *s; + + if (!of) + return; + + s = of->ctx; + if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE)) + avio_closep(&s->pb); + avformat_free_context(s); + av_dict_free(&of->opts); + + av_freep(pof); +} |