diff mbox series

[FFmpeg-devel,2/6] fftools/: constify values from av_dict_get().

Message ID 6dd2c119-ab9f-2d8a-328a-37ee86ee1824@triularity.org
State Accepted
Commit a185b526a9267923fb4e67f5fded90e359aea169
Headers show
Series None | expand

Commit Message

Chad Fraleigh Oct. 18, 2021, 10:27 p.m. UTC
Treat values returned from av_dict_get() as const, since they are internal to AVDictionary.

Signed-off-by: Chad Fraleigh <chadf@triularity.org>
---
 fftools/cmdutils.c      | 2 +-
 fftools/ffmpeg.c        | 6 +++---
 fftools/ffmpeg_filter.c | 6 +++---
 fftools/ffmpeg_opt.c    | 8 ++++----
 fftools/ffplay.c        | 8 ++++----
 fftools/ffprobe.c       | 8 ++++----
 6 files changed, 19 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..d351ceb7fa 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -2106,7 +2106,7 @@  AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
                                 AVFormatContext *s, AVStream *st, const AVCodec *codec)
 {
     AVDictionary    *ret = NULL;
-    AVDictionaryEntry *t = NULL;
+    const AVDictionaryEntry *t = NULL;
     int            flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM
                                       : AV_OPT_FLAG_DECODING_PARAM;
     char          prefix = 0;
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9d4f9d7a2b..d46d154af1 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -677,7 +677,7 @@  static void ffmpeg_cleanup(int ret)
 
 void remove_avoptions(AVDictionary **a, AVDictionary *b)
 {
-    AVDictionaryEntry *t = NULL;
+    const AVDictionaryEntry *t = NULL;
 
     while ((t = av_dict_get(b, "", t, AV_DICT_IGNORE_SUFFIX))) {
         av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE);
@@ -686,7 +686,7 @@  void remove_avoptions(AVDictionary **a, AVDictionary *b)
 
 void assert_avoptions(AVDictionary *m)
 {
-    AVDictionaryEntry *t;
+    const AVDictionaryEntry *t;
     if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
         av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
         exit_program(1);
@@ -3228,7 +3228,7 @@  static int init_output_stream_streamcopy(OutputStream *ost)
 
 static void set_encoder_id(OutputFile *of, OutputStream *ost)
 {
-    AVDictionaryEntry *e;
+    const AVDictionaryEntry *e;
 
     uint8_t *encoder_string;
     int encoder_string_len;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b798459946..c70903295f 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -86,7 +86,7 @@  static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx
 static char *choose_pix_fmts(OutputFilter *ofilter)
 {
     OutputStream *ost = ofilter->ost;
-    AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
+    const AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0);
     if (strict_dict)
         // used by choose_pixel_fmt() and below
         av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0);
@@ -437,7 +437,7 @@  static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) {
         char args[255];
         AVFilterContext *filter;
-        AVDictionaryEntry *e = NULL;
+        const AVDictionaryEntry *e = NULL;
 
         snprintf(args, sizeof(args), "%d:%d",
                  ofilter->width, ofilter->height);
@@ -994,7 +994,7 @@  int configure_filtergraph(FilterGraph *fg)
     if (simple) {
         OutputStream *ost = fg->outputs[0]->ost;
         char args[512];
-        AVDictionaryEntry *e = NULL;
+        const AVDictionaryEntry *e = NULL;
 
         if (filter_nbthreads) {
             ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 7aff43d917..d034ff2a5b 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -249,7 +249,7 @@  static int show_hwaccels(void *optctx, const char *opt, const char *arg)
 /* return a copy of the input with the stream specifiers removed from the keys */
 static AVDictionary *strip_specifiers(AVDictionary *dict)
 {
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
     AVDictionary    *ret = NULL;
 
     while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
@@ -1073,7 +1073,7 @@  static void dump_attachment(AVStream *st, const char *filename)
 {
     int ret;
     AVIOContext *out = NULL;
-    AVDictionaryEntry *e;
+    const AVDictionaryEntry *e;
 
     if (!st->codecpar->extradata_size) {
         av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
@@ -1109,7 +1109,7 @@  static int open_input_file(OptionsContext *o, const char *filename)
     int err, i, ret;
     int64_t timestamp;
     AVDictionary *unused_opts = NULL;
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
     char *   video_codec_name = NULL;
     char *   audio_codec_name = NULL;
     char *subtitle_codec_name = NULL;
@@ -2212,7 +2212,7 @@  static int open_output_file(OptionsContext *o, const char *filename)
     OutputStream *ost;
     InputStream  *ist;
     AVDictionary *unused_opts = NULL;
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
 
     if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
         o->stop_time = INT64_MAX;
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index ccea0e4578..1183235624 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1856,7 +1856,7 @@  static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
     AVCodecParameters *codecpar = is->video_st->codecpar;
     AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
     int nb_pix_fmts = 0;
     int i, j;
 
@@ -1960,7 +1960,7 @@  static int configure_audio_filters(VideoState *is, const char *afilters, int for
     int channels[2] = { 0, -1 };
     AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
     char aresample_swr_opts[512] = "";
-    AVDictionaryEntry *e = NULL;
+    const AVDictionaryEntry *e = NULL;
     char asrc_args[256];
     int ret;
 
@@ -2575,7 +2575,7 @@  static int stream_component_open(VideoState *is, int stream_index)
     const AVCodec *codec;
     const char *forced_codec_name = NULL;
     AVDictionary *opts = NULL;
-    AVDictionaryEntry *t = NULL;
+    const AVDictionaryEntry *t = NULL;
     int sample_rate, nb_channels;
     int64_t channel_layout;
     int ret = 0;
@@ -2760,7 +2760,7 @@  static int read_thread(void *arg)
     AVPacket *pkt = NULL;
     int64_t stream_start_time;
     int pkt_in_play_range = 0;
-    AVDictionaryEntry *t;
+    const AVDictionaryEntry *t;
     SDL_mutex *wait_mutex = SDL_CreateMutex();
     int scan_all_pmts_set = 0;
     int64_t pkt_ts;
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 90e895bbf9..169c26b65c 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -580,7 +580,7 @@  static int writer_open(WriterContext **wctx, const Writer *writer, const char *a
     /* convert options to dictionary */
     if (args) {
         AVDictionary *opts = NULL;
-        AVDictionaryEntry *opt = NULL;
+        const AVDictionaryEntry *opt = NULL;
 
         if ((ret = av_dict_parse_string(&opts, args, "=", ":", 0)) < 0) {
             av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args);
@@ -1836,7 +1836,7 @@  static void writer_register_all(void)
 
 static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
 {
-    AVDictionaryEntry *tag = NULL;
+    const AVDictionaryEntry *tag = NULL;
     int ret = 0;
 
     if (!tags)
@@ -2364,7 +2364,7 @@  static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
                 print_int("max_content", metadata->MaxCLL);
                 print_int("max_average", metadata->MaxFALL);
             } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
-                AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE);
+                const AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE);
                 if (tag)
                     print_str(tag->key, tag->value);
                 print_int("size", sd->size);
@@ -2957,7 +2957,7 @@  static int open_input_file(InputFile *ifile, const char *filename,
 {
     int err, i;
     AVFormatContext *fmt_ctx = NULL;
-    AVDictionaryEntry *t = NULL;
+    const AVDictionaryEntry *t = NULL;
     int scan_all_pmts_set = 0;
 
     fmt_ctx = avformat_alloc_context();