aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-02-26 01:31:14 +0200
committerMartin Storsjö <martin@martin.st>2012-10-04 13:52:09 +0300
commit73871dc96ff78053b9dcd0eb259b7f5a5308ec87 (patch)
treed1889a62d2662bc4fadf5d69515dec4d68783ce8
parent0edae4e6286096023cdd6adea74722fa06029867 (diff)
downloadffmpeg-73871dc96ff78053b9dcd0eb259b7f5a5308ec87.tar.gz
segment: Use the public av_write_header/av_write_trailer functions
With this change, the segmenter muxer doesn't rely on anything not available/supported to libavformat external users, making the segmenter muxer do things just like a normal segmenter application using libavformat would do. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/segment.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index ccd8a91e41..20adb73d24 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -62,42 +62,18 @@ static int segment_start(AVFormatContext *s)
&s->interrupt_callback, NULL)) < 0)
return err;
- if (!oc->priv_data && oc->oformat->priv_data_size > 0) {
- oc->priv_data = av_mallocz(oc->oformat->priv_data_size);
- if (!oc->priv_data) {
- avio_close(oc->pb);
- return AVERROR(ENOMEM);
- }
- if (oc->oformat->priv_class) {
- *(const AVClass**)oc->priv_data = oc->oformat->priv_class;
- av_opt_set_defaults(oc->priv_data);
- }
- }
-
- if ((err = oc->oformat->write_header(oc)) < 0) {
- goto fail;
- }
+ if ((err = avformat_write_header(oc, NULL)) < 0)
+ return err;
return 0;
-
-fail:
- avio_close(oc->pb);
- av_freep(&oc->priv_data);
-
- return err;
}
static int segment_end(AVFormatContext *oc)
{
int ret = 0;
- if (oc->oformat->write_trailer)
- ret = oc->oformat->write_trailer(oc);
-
+ av_write_trailer(oc);
avio_close(oc->pb);
- if (oc->oformat->priv_class)
- av_opt_free(oc->priv_data);
- av_freep(&oc->priv_data);
return ret;
}