From 84adab333cddeefc3cfd843089dee23f58bd372c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 22 Jul 2015 14:39:30 +0200 Subject: lavc: add stream-global packet side data This is similar to what is done for AVStream. --- libavcodec/utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libavcodec/utils.c') diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ad00a9215a..f3361a016f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1603,9 +1603,11 @@ void avsubtitle_free(AVSubtitle *sub) av_cold int avcodec_close(AVCodecContext *avctx) { + int i; + if (avcodec_is_open(avctx)) { FramePool *pool = avctx->internal->pool; - int i; + if (HAVE_THREADS && avctx->internal->thread_ctx) ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) @@ -1622,6 +1624,11 @@ av_cold int avcodec_close(AVCodecContext *avctx) av_freep(&avctx->internal); } + for (i = 0; i < avctx->nb_coded_side_data; i++) + av_freep(&avctx->coded_side_data[i].data); + av_freep(&avctx->coded_side_data); + avctx->nb_coded_side_data = 0; + if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); -- cgit v1.2.3