[FFmpeg-cvslog] lavc: Mark hw_config pointer arrays as const

Mark Thompson git at videolan.org
Sun Nov 8 21:07:14 EET 2020


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sun Nov  8 18:51:15 2020 +0000| [cd322794eecf1dd7d975ce3dcf1c18bbd8b91ad1] | committer: Mark Thompson

lavc: Mark hw_config pointer arrays as const

They are read-only just like the HWConfig structures they point to.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd322794eecf1dd7d975ce3dcf1c18bbd8b91ad1
---

 libavcodec/codec.h         | 2 +-
 libavcodec/cuviddec.c      | 2 +-
 libavcodec/h263dec.c       | 2 +-
 libavcodec/mediacodecdec.c | 2 +-
 libavcodec/mmaldec.c       | 2 +-
 libavcodec/nvenc.c         | 2 +-
 libavcodec/nvenc.h         | 2 +-
 libavcodec/qsvdec.c        | 2 +-
 libavcodec/qsvdec.h        | 2 +-
 libavcodec/qsvenc.c        | 2 +-
 libavcodec/qsvenc.h        | 2 +-
 libavcodec/rkmppdec.c      | 2 +-
 libavcodec/vaapi_encode.c  | 2 +-
 libavcodec/vaapi_encode.h  | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index dc8e12b3f0..0ccbf0eb19 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -320,7 +320,7 @@ typedef struct AVCodec {
      *
      * The user can only access this field via avcodec_get_hw_config().
      */
-    const struct AVCodecHWConfigInternal **hw_configs;
+    const struct AVCodecHWConfigInternal *const *hw_configs;
 
     /**
      * List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index ee2ecc01fe..5e698d4cd0 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -1100,7 +1100,7 @@ static const AVOption options[] = {
     { NULL }
 };
 
-static const AVCodecHWConfigInternal *cuvid_hw_configs[] = {
+static const AVCodecHWConfigInternal *const cuvid_hw_configs[] = {
     &(const AVCodecHWConfigInternal) {
         .public = {
             .pix_fmt     = AV_PIX_FMT_CUDA,
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 3b29a189e9..32e26a57de 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -743,7 +743,7 @@ const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
     AV_PIX_FMT_NONE
 };
 
-const AVCodecHWConfigInternal *ff_h263_hw_config_list[] = {
+const AVCodecHWConfigInternal *const ff_h263_hw_config_list[] = {
 #if CONFIG_H263_VAAPI_HWACCEL
     HWACCEL_VAAPI(h263),
 #endif
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 25410021e8..ac1725e466 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -486,7 +486,7 @@ static void mediacodec_decode_flush(AVCodecContext *avctx)
     ff_mediacodec_dec_flush(avctx, s->ctx);
 }
 
-static const AVCodecHWConfigInternal *mediacodec_hw_configs[] = {
+static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = {
     &(const AVCodecHWConfigInternal) {
         .public          = {
             .pix_fmt     = AV_PIX_FMT_MEDIACODEC,
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index cd2b263a98..172fb61c9b 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -809,7 +809,7 @@ static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame,
     return ret;
 }
 
-static const AVCodecHWConfigInternal *mmal_hw_configs[] = {
+static const AVCodecHWConfigInternal *const mmal_hw_configs[] = {
     HW_CONFIG_INTERNAL(MMAL),
     NULL
 };
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 48625f5baa..1c06b6af27 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -59,7 +59,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_NONE
 };
 
-const AVCodecHWConfigInternal *ff_nvenc_hw_configs[] = {
+const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = {
     HW_CONFIG_ENCODER_FRAMES(CUDA,  CUDA),
     HW_CONFIG_ENCODER_DEVICE(NONE,  CUDA),
 #if CONFIG_D3D11VA
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index f6f2a6361a..fefc5f7f0b 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -230,6 +230,6 @@ int ff_nvenc_receive_packet(AVCodecContext *avctx, AVPacket *pkt);
 void ff_nvenc_encode_flush(AVCodecContext *avctx);
 
 extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
-extern const AVCodecHWConfigInternal *ff_nvenc_hw_configs[];
+extern const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[];
 
 #endif /* AVCODEC_NVENC_H */
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index fc25dc73e5..c666aaeb52 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -43,7 +43,7 @@
 #include "qsv_internal.h"
 #include "qsvdec.h"
 
-const AVCodecHWConfigInternal *ff_qsv_hw_configs[] = {
+const AVCodecHWConfigInternal *const ff_qsv_hw_configs[] = {
     &(const AVCodecHWConfigInternal) {
         .public = {
             .pix_fmt     = AV_PIX_FMT_QSV,
diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h
index cb948f516d..f3b7344cba 100644
--- a/libavcodec/qsvdec.h
+++ b/libavcodec/qsvdec.h
@@ -74,7 +74,7 @@ typedef struct QSVContext {
     int         nb_ext_buffers;
 } QSVContext;
 
-extern const AVCodecHWConfigInternal *ff_qsv_hw_configs[];
+extern const AVCodecHWConfigInternal *const ff_qsv_hw_configs[];
 
 int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
                         AVFrame *frame, int *got_frame, AVPacket *pkt);
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 1ed8f5d973..2bd2a56227 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1655,7 +1655,7 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
     return 0;
 }
 
-const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[] = {
+const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[] = {
     HW_CONFIG_ENCODER_FRAMES(QSV,  QSV),
     HW_CONFIG_ENCODER_DEVICE(NV12, QSV),
     HW_CONFIG_ENCODER_DEVICE(P010, QSV),
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 4f579d1db1..6d305f87dd 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -98,7 +98,7 @@
 { "forced_idr",     "Forcing I frames as IDR frames",         OFFSET(qsv.forced_idr),     AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,          1, VE },                         \
 { "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\
 
-extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];
+extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
 
 typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
                              const AVFrame *frame, mfxEncodeCtrl* enc_ctrl);
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index 248020d5d6..a60962dc86 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -548,7 +548,7 @@ static void rkmpp_flush(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);
 }
 
-static const AVCodecHWConfigInternal *rkmpp_hw_configs[] = {
+static const AVCodecHWConfigInternal *const rkmpp_hw_configs[] = {
     HW_CONFIG_INTERNAL(DRM_PRIME),
     NULL
 };
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index b3a02459f1..518e5b2c00 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -28,7 +28,7 @@
 #include "encode.h"
 #include "avcodec.h"
 
-const AVCodecHWConfigInternal *ff_vaapi_encode_hw_configs[] = {
+const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[] = {
     HW_CONFIG_ENCODER_FRAMES(VAAPI, VAAPI),
     NULL,
 };
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index aa2a45bca6..b41604a883 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -49,7 +49,7 @@ enum {
     MAX_TILE_COLS          = 20,
 };
 
-extern const AVCodecHWConfigInternal *ff_vaapi_encode_hw_configs[];
+extern const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[];
 
 enum {
     PICTURE_TYPE_IDR = 0,



More information about the ffmpeg-cvslog mailing list