summaryrefslogtreecommitdiff
path: root/libavcodec/options.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-18 13:00:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-18 13:00:50 +0200
commit68c05185e229b093bf5c2236c2883cbc296ea938 (patch)
treea9be3ada3ccf90ecf227295f5d60f314aa176d9c /libavcodec/options.c
parentff17d8b56ec87fe1516ddd49b0bdea81f22904af (diff)
parentfd056029f45a9f6d213d9fce8165632042511d4f (diff)
Merge commit 'fd056029f45a9f6d213d9fce8165632042511d4f'
* commit 'fd056029f45a9f6d213d9fce8165632042511d4f': lavc: add avcodec_free_context(). Conflicts: doc/APIchanges libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/options.c')
-rw-r--r--libavcodec/options.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/options.c b/libavcodec/options.c
index b31483baa3..694e1c3f3b 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -154,6 +154,21 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
return avctx;
}
+void avcodec_free_context(AVCodecContext **pavctx)
+{
+ AVCodecContext *avctx = *pavctx;
+
+ if (!avctx)
+ return;
+
+ avcodec_close(avctx);
+
+ av_freep(&avctx->extradata);
+ av_freep(&avctx->subtitle_header);
+
+ av_freep(pavctx);
+}
+
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
{
const AVCodec *orig_codec = dest->codec;