From ccfdef79b132bef49f4654266d5d3da8d1deb305 Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 17 Sep 2021 00:06:45 -0300 Subject: [PATCH] avutil/buffer: constify some function parameters Reviewed-by: Andreas Rheinhardt Signed-off-by: James Almer --- doc/APIchanges | 4 ++++ libavutil/buffer.c | 6 +++--- libavutil/buffer.h | 6 +++--- libavutil/version.h | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d03e3233ba..cf6105c99e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-17 - xxxxxxxxxx - lavu 57.5.101 - buffer.h + Constified the input parameters in av_buffer_replace(), av_buffer_ref(), + and av_buffer_pool_buffer_get_opaque(). + 2021-09-08 - xxxxxxxxxx - lavu 57.5.100 - hwcontext_d3d11va.h Add AVD3D11VAFramesContext.texture_infos diff --git a/libavutil/buffer.c b/libavutil/buffer.c index b13eeadffb..a32b7deb89 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -90,7 +90,7 @@ AVBufferRef *av_buffer_allocz(size_t size) return ret; } -AVBufferRef *av_buffer_ref(AVBufferRef *buf) +AVBufferRef *av_buffer_ref(const AVBufferRef *buf) { AVBufferRef *ret = av_mallocz(sizeof(*ret)); @@ -216,7 +216,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, size_t size) return 0; } -int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) +int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src) { AVBufferRef *dst = *pdst; AVBufferRef *tmp; @@ -395,7 +395,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) return ret; } -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref) +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref) { BufferPoolEntry *buf = ref->buffer->opaque; av_assert0(buf); diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 2c0ce1a108..e1ef5b7f07 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -145,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -212,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -313,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @} diff --git a/libavutil/version.h b/libavutil/version.h index f220e192c8..1e6a80f86e 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 57 #define LIBAVUTIL_VERSION_MINOR 5 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \