[FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate

Marvin Scholz epirat07 at gmail.com
Fri Nov 25 03:30:16 EET 2022


---
 fftools/cmdutils.c      | 2 +-
 fftools/ffmpeg.c        | 2 +-
 fftools/ffmpeg_demux.c  | 5 ++---
 fftools/ffmpeg_filter.c | 3 +--
 fftools/ffmpeg_opt.c    | 2 +-
 fftools/ffplay.c        | 4 ++--
 fftools/ffprobe.c       | 6 +++---
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index beef8ce385..a1de621d1c 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -921,7 +921,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
         break;
     }
 
-    while (t = av_dict_get(opts, "", t, AV_DICT_IGNORE_SUFFIX)) {
+    while (t = av_dict_iterate(opts, t)) {
         const AVClass *priv_class;
         char *p = strchr(t->key, ':');
 
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 3767ab444b..0aeb06e5d5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -620,7 +620,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b)
 {
     const AVDictionaryEntry *t = NULL;
 
-    while ((t = av_dict_get(b, "", t, AV_DICT_IGNORE_SUFFIX))) {
+    while ((t = av_dict_iterate(b, t))) {
         av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE);
     }
 }
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 2ac1d795b2..e845e6784d 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1082,13 +1082,12 @@ int ifile_open(const OptionsContext *o, const char *filename)
     unused_opts = strip_specifiers(o->g->codec_opts);
     for (i = 0; i < f->nb_streams; i++) {
         e = NULL;
-        while ((e = av_dict_get(f->streams[i]->decoder_opts, "", e,
-                                AV_DICT_IGNORE_SUFFIX)))
+        while ((e = av_dict_iterate(f->streams[i]->decoder_opts, e)))
             av_dict_set(&unused_opts, e->key, NULL, 0);
     }
 
     e = NULL;
-    while ((e = av_dict_get(unused_opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+    while ((e = av_dict_iterate(unused_opts, e))) {
         const AVClass *class = avcodec_get_class();
         const AVOption *option = av_opt_find(&class, e->key, NULL, 0,
                                              AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 5d50092b72..b0c4c8ece3 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -452,8 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
         snprintf(args, sizeof(args), "%d:%d",
                  ofilter->width, ofilter->height);
 
-        while ((e = av_dict_get(ost->sws_dict, "", e,
-                                AV_DICT_IGNORE_SUFFIX))) {
+        while ((e = av_dict_iterate(ost->sws_dict, e))) {
             av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
         }
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index a9dcf0e088..3df02b7d7f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -169,7 +169,7 @@ AVDictionary *strip_specifiers(const AVDictionary *dict)
     const AVDictionaryEntry *e = NULL;
     AVDictionary    *ret = NULL;
 
-    while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
+    while ((e = av_dict_iterate(dict, e))) {
         char *p = strchr(e->key, ':');
 
         if (p)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index bcc00afe31..fc7e1c2fb1 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1860,7 +1860,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
     }
     pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
 
-    while ((e = av_dict_get(sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
+    while ((e = av_dict_iterate(sws_dict, e))) {
         if (!strcmp(e->key, "sws_flags")) {
             av_strlcatf(sws_flags_str, sizeof(sws_flags_str), "%s=%s:", "flags", e->value);
         } else
@@ -1966,7 +1966,7 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
 
     av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
 
-    while ((e = av_dict_get(swr_opts, "", e, AV_DICT_IGNORE_SUFFIX)))
+    while ((e = av_dict_iterate(swr_opts, e)))
         av_strlcatf(aresample_swr_opts, sizeof(aresample_swr_opts), "%s=%s:", e->key, e->value);
     if (strlen(aresample_swr_opts))
         aresample_swr_opts[strlen(aresample_swr_opts)-1] = '\0';
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f46925618c..d2f126d9d6 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -656,7 +656,7 @@ static int writer_open(WriterContext **wctx, const Writer *writer, const char *a
             goto fail;
         }
 
-        while ((opt = av_dict_get(opts, "", opt, AV_DICT_IGNORE_SUFFIX))) {
+        while ((opt = av_dict_iterate(opts, opt))) {
             if ((ret = av_opt_set(*wctx, opt->key, opt->value, AV_OPT_SEARCH_CHILDREN)) < 0) {
                 av_log(*wctx, AV_LOG_ERROR, "Failed to set option '%s' with value '%s' provided to writer context\n",
                        opt->key, opt->value);
@@ -1945,7 +1945,7 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
         return 0;
     writer_print_section_header(w, section_id);
 
-    while ((tag = av_dict_get(tags, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+    while ((tag = av_dict_iterate(tags, tag))) {
         if ((ret = print_str_validate(tag->key, tag->value)) < 0)
             break;
     }
@@ -3315,7 +3315,7 @@ static int open_input_file(InputFile *ifile, const char *filename,
     ifile->fmt_ctx = fmt_ctx;
     if (scan_all_pmts_set)
         av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
-    while ((t = av_dict_get(format_opts, "", t, AV_DICT_IGNORE_SUFFIX)))
+    while ((t = av_dict_iterate(format_opts, t)))
         av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key);
 
     if (find_stream_info) {
-- 
2.37.0 (Apple Git-136)



More information about the ffmpeg-devel mailing list