Hi! I believe adding const to the declaration of av_packet_get_side_data() better reflects its intention, also fixes a warning.
Please comment, Carl Eugen
From a17c4bab8cd21c15e91f5efd03d5900eda29090b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceho...@ag.or.at> Date: Sun, 26 Feb 2017 11:39:07 +0100 Subject: [PATCH] lavc/avpacket: Make pkt parameter of av_packet_get_side_data() const. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reflects the actual code and silences a gcc warning: libavcodec/utils.c:2102:36: warning: passing argument 1 of âav_packet_get_side_dataâ discards âconstâ qualifier from pointer target type [-Wdiscarded-qualifiers] --- libavcodec/avcodec.h | 6 +++++- libavcodec/avpacket.c | 6 +++++- libavcodec/version.h | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 925a8c7..b065309 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4563,7 +4563,11 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @param size pointer for side information size to store (optional) * @return pointer to data if present or NULL otherwise */ -uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +uint8_t* av_packet_get_side_data( +#if FF_API_CONST_GET_SIDE_DATA +const +#endif + AVPacket *pkt, enum AVPacketSideDataType type, int *size); int av_packet_merge_side_data(AVPacket *pkt); diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 8e028a2..d369526 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -336,7 +336,11 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, return data; } -uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +uint8_t *av_packet_get_side_data( +#if FF_API_CONST_GET_SIDE_DATA +const +#endif + AVPacket *pkt, enum AVPacketSideDataType type, int *size) { int i; diff --git a/libavcodec/version.h b/libavcodec/version.h index 6fdc776..59caa1c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -157,6 +157,9 @@ #ifndef FF_API_VAAPI_CONTEXT #define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) #endif +#ifndef FF_API_CONST_GET_SIDE_DATA +#define FF_API_CONST_GET_SIDE_DATA (LIBAVCODEC_VERSION_MAJOR >= 58) +#endif #ifndef FF_API_AVCTX_TIMEBASE #define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) #endif -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel