[FFmpeg-devel] [PATCH] add const to pix_fmt_lists in find_best
Dylan Alex Simon
dylan-ffmpeg at dylex.net
Tue Aug 13 17:33:51 CEST 2013
Passing AVCodec.pix_fmts to avcodec_find_best_pix_fmt_of_list results in a
warning of non-constness. This patch adds const to the argument to avoid this
warning. (If this is not something I should be doing in the first place, let
me know.) Patch is attached and also available in github.com/dylex/FFmpeg.
-------------- next part --------------
>From 28c83806e3dad6325ccaf8c4f18b4fdeb7a93524 Mon Sep 17 00:00:00 2001
From: Dylan Simon <dylan at dylex.net>
Date: Tue, 13 Aug 2013 11:12:10 -0400
Subject: [PATCH] avcodec: add const qualifier to pix_fmt_list args
avcodec_find_best_pix_fmt_of_list does not modify its first argument so may be
marked const. This avoids a warning when passing in AVCodec.pix_fmts.
Signed-off-by: Dylan Simon <dylan at dylex.net>
---
libavcodec/avcodec.h | 4 ++--
libavcodec/imgconvert.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 070ce7a..cf82b89 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4567,7 +4567,7 @@ int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat
* @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
* @return The best pixel format to convert to or -1 if none was found.
*/
-enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(enum AVPixelFormat *pix_fmt_list,
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
@@ -4606,7 +4606,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt
attribute_deprecated
#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
-enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
+enum AVPixelFormat avcodec_find_best_pix_fmt2(const enum AVPixelFormat *pix_fmt_list,
enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
#else
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 1835e00..d9dc55d 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -248,7 +248,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt
}
#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
-enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
+enum AVPixelFormat avcodec_find_best_pix_fmt2(const enum AVPixelFormat *pix_fmt_list,
enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr){
return avcodec_find_best_pix_fmt_of_list(pix_fmt_list, src_pix_fmt, has_alpha, loss_ptr);
@@ -261,7 +261,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, e
}
#endif
-enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(enum AVPixelFormat *pix_fmt_list,
+enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr){
int i;
--
1.8.1.4
More information about the ffmpeg-devel
mailing list