summaryrefslogtreecommitdiff
path: root/libavformat/segment.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-02 12:19:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-02 12:31:04 +0200
commit0ffe32cf8f922a3538751c68b92840321594950f (patch)
tree5e4a723fa6be1c61b03b8fca45dc4939477bbc31 /libavformat/segment.c
parent3668168afa1ef73928b2c6cc2a6ffa8e8ad82312 (diff)
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@elisa.fi> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/segment.c')
-rw-r--r--libavformat/segment.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 1cb64543aa..7919a39187 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);