[FFmpeg-devel] [PATCH 3/6] libavcodec/: constify values from av_dict_get().

Chad Fraleigh chadf at triularity.org
Tue Oct 19 01:27:08 EEST 2021


Treat values returned from av_dict_get() as const, since they are internal to AVDictionary.

Signed-off-by: Chad Fraleigh <chadf at triularity.org>
---
 libavcodec/libaomenc.c | 2 +-
 libavcodec/libvpxenc.c | 4 ++--
 libavcodec/libx264.c   | 2 +-
 libavcodec/libx265.c   | 2 +-
 libavcodec/mjpegdec.c  | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 800fda0591..85e8fc0f0b 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -882,7 +882,7 @@ static av_cold int aom_init(AVCodecContext *avctx,
 
 #if AOM_ENCODER_ABI_VERSION >= 23
     {
-        AVDictionaryEntry *en = NULL;
+        const AVDictionaryEntry *en = NULL;
 
         while ((en = av_dict_get(ctx->aom_params, "", en, AV_DICT_IGNORE_SUFFIX))) {
             int ret = aom_codec_set_option(&ctx->encoder, en->key, en->value);
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 10e5a22fa9..ea92eb6221 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -910,7 +910,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
     vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface);
     vpx_svc_extra_cfg_t svc_params;
 #endif
-    AVDictionaryEntry* en = NULL;
+    const AVDictionaryEntry* en = NULL;
 
     ctx->discard_hdr10_plus = 1;
     av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
@@ -1671,7 +1671,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
         if (frame->pict_type == AV_PICTURE_TYPE_I)
             flags |= VPX_EFLAG_FORCE_KF;
         if (frame->metadata) {
-            AVDictionaryEntry* en = av_dict_get(frame->metadata, "vp8-flags", NULL, 0);
+            const AVDictionaryEntry* en = av_dict_get(frame->metadata, "vp8-flags", NULL, 0);
             if (en) {
                 flags |= strtoul(en->value, NULL, 10);
             }
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 507fee39f2..0251842bd4 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -931,7 +931,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
 #endif
 
     {
-        AVDictionaryEntry *en = NULL;
+        const AVDictionaryEntry *en = NULL;
         while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) {
            if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) {
                av_log(avctx, AV_LOG_WARNING,
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 7dd70a3450..ec50b8a77f 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -363,7 +363,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
     }
 
     {
-        AVDictionaryEntry *en = NULL;
+        const AVDictionaryEntry *en = NULL;
         while ((en = av_dict_get(ctx->x265_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
             int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value);
 
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 7f89641660..b22895cfe6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2407,7 +2407,7 @@ int ff_mjpeg_receive_frame(AVCodecContext *avctx, AVFrame *frame)
     int i, index;
     int ret = 0;
     int is16bit;
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
 
     s->force_pal8 = 0;
 
-- 
2.25.1



More information about the ffmpeg-devel mailing list