[FFmpeg-cvslog] avformat/segment: Use avformat_alloc_output_context2()

Michael Niedermayer git at videolan.org
Tue Sep 2 12:37:44 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Sep  2 12:19:53 2014 +0200| [0ffe32cf8f922a3538751c68b92840321594950f] | committer: Michael Niedermayer

avformat/segment: Use avformat_alloc_output_context2()

This avoids having to assign oformat, allows returning the
correct error code and allocates priv_data

Based on patch by: Mika Raento <mika.raento at elisa.fi>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ffe32cf8f922a3538751c68b92840321594950f
---

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

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 1cb6454..7919a39 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -133,12 +133,13 @@ static int segment_mux_init(AVFormatContext *s)
     SegmentContext *seg = s->priv_data;
     AVFormatContext *oc;
     int i;
+    int ret;
 
-    seg->avf = oc = avformat_alloc_context();
-    if (!oc)
-        return AVERROR(ENOMEM);
+    ret = avformat_alloc_output_context2(&seg->avf, seg->oformat, NULL, NULL);
+    if (ret < 0)
+        return ret;
+    oc = seg->avf;
 
-    oc->oformat            = seg->oformat;
     oc->interrupt_callback = s->interrupt_callback;
     av_dict_copy(&oc->metadata, s->metadata, 0);
 



More information about the ffmpeg-cvslog mailing list