diff options
author | Martin Storsjö <martin@martin.st> | 2011-02-04 12:04:18 +0200 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-02-04 11:39:55 -0500 |
commit | b22dbb291d41e9fb038884bcebad2394c501cbaf (patch) | |
tree | ba3ca832fc842b2e891715513e6ed63d9f16a3c4 /libavformat | |
parent | ff1974897778942180c1d4f95b0b7b45a4fbbc02 (diff) | |
download | ffmpeg-b22dbb291d41e9fb038884bcebad2394c501cbaf.tar.gz |
Use avformat_free_context for cleaning up muxers
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/movenchint.c | 20 | ||||
-rw-r--r-- | libavformat/rtpenc_chain.c | 6 | ||||
-rw-r--r-- | libavformat/rtsp.c | 8 | ||||
-rw-r--r-- | libavformat/sapenc.c | 8 |
4 files changed, 6 insertions, 36 deletions
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 6a9df076ce..10913dd904 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -81,17 +81,9 @@ fail: url_close_dyn_buf(track->rtp_ctx->pb, &buf); av_free(buf); } - if (track->rtp_ctx && track->rtp_ctx->streams[0]) { - av_metadata_free(&track->rtp_ctx->streams[0]->metadata); - av_free(track->rtp_ctx->streams[0]->codec->extradata); - av_free(track->rtp_ctx->streams[0]->codec); - av_free(track->rtp_ctx->streams[0]->info); - av_free(track->rtp_ctx->streams[0]); - } if (track->rtp_ctx) { - av_metadata_free(&track->rtp_ctx->metadata); - av_free(track->rtp_ctx->priv_data); - av_freep(&track->rtp_ctx); + avformat_free_context(track->rtp_ctx); + track->rtp_ctx = NULL; } av_freep(&track->enc); /* Set a default timescale, to avoid crashes in dump_format */ @@ -488,12 +480,6 @@ void ff_mov_close_hinting(MOVTrack *track) { url_close_dyn_buf(rtp_ctx->pb, &ptr); av_free(ptr); } - av_metadata_free(&rtp_ctx->streams[0]->metadata); - av_metadata_free(&rtp_ctx->metadata); - av_free(rtp_ctx->streams[0]->codec->extradata); - av_free(rtp_ctx->streams[0]->codec); - av_free(rtp_ctx->streams[0]->info); - av_free(rtp_ctx->streams[0]); - av_freep(&rtp_ctx); + avformat_free_context(rtp_ctx); } diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 09b4ebd7c3..e1f200ca08 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -66,11 +66,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } - av_free(rtpctx->streams[0]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); return NULL; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d31e8eeae4..d3e88e9a5c 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -498,13 +498,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) } else { url_fclose(rtpctx->pb); } - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ff_rdt_parse_close(rtsp_st->transport_priv); else if (CONFIG_RTPDEC) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 634f033d50..9bbacef680 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -46,13 +46,7 @@ static int sap_write_close(AVFormatContext *s) continue; av_write_trailer(rtpctx); url_fclose(rtpctx->pb); - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); s->streams[i]->priv_data = NULL; } |