From b12e4d3bb8df994f042ff1216fb8de2b967aab9e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Aug 2017 13:26:58 -0300 Subject: avio: add a destructor for AVIOContext Before this commit, AVIOContext is to be freed with a plain av_free(), which prevents us from adding any deeper structure to it. (cherry picked from commit 99684f3ae752fc8bfb44a2dd1482f8d7a3d8536d) Signed-off-by: James Almer --- libavformat/avio.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libavformat/avio.h') diff --git a/libavformat/avio.h b/libavformat/avio.h index f14b003ba5..ea56dad503 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -467,6 +467,14 @@ AVIOContext *avio_alloc_context( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); +/** + * Free the supplied IO context and everything associated with it. + * + * @param s Double pointer to the IO context. This function will write NULL + * into s. + */ +void avio_context_free(AVIOContext **s); + void avio_w8(AVIOContext *s, int b); void avio_write(AVIOContext *s, const unsigned char *buf, int size); void avio_wl64(AVIOContext *s, uint64_t val); -- cgit v1.2.3