[FFmpeg-devel] [PATCH 4/8] lavf/segment: add deinit function

Rodger Combs rodger.combs at gmail.com
Wed Apr 13 11:28:34 CEST 2016


---
 libavformat/segment.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index df6f4b5..1fffb7b 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -627,8 +627,9 @@ static int select_reference_stream(AVFormatContext *s)
     return 0;
 }
 
-static void seg_free_context(SegmentContext *seg)
+static void seg_free(AVFormatContext *s)
 {
+    SegmentContext *seg = s->priv_data;
     ff_format_io_close(seg->avf, &seg->list_pb);
     avformat_free_context(seg->avf);
     seg->avf = NULL;
@@ -908,9 +909,6 @@ fail:
         seg->segment_frame_count++;
     }
 
-    if (ret < 0)
-        seg_free_context(seg);
-
     return ret;
 }
 
@@ -1035,6 +1033,7 @@ AVOutputFormat ff_segment_muxer = {
     .init           = seg_init,
     .write_packet   = seg_write_packet,
     .write_trailer  = seg_write_trailer,
+    .deinit         = seg_free,
     .check_bitstream = seg_check_bitstream,
     .priv_class     = &seg_class,
 };
@@ -1054,6 +1053,7 @@ AVOutputFormat ff_stream_segment_muxer = {
     .init           = seg_init,
     .write_packet   = seg_write_packet,
     .write_trailer  = seg_write_trailer,
+    .deinit         = seg_free,
     .check_bitstream = seg_check_bitstream,
     .priv_class     = &sseg_class,
 };
-- 
2.7.3



More information about the ffmpeg-devel mailing list