* [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate
@ 2022-11-25 1:30 Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate Marvin Scholz
` (31 more replies)
0 siblings, 32 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
This patchset replaces the common use of:
av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)
with the new av_dict_iterate in most places where it makes
sense. It is more concise and clearer to understand the
intention of the code.
Additionally for fftools/ffmpeg_filter it switches to
av_dict_get_string, as it makes more sense to use the
proper API for that instead of manually assembling the
string.
Marvin Scholz (31):
fftools: use av_dict_iterate
fftools: use av_dict_get_string
avcodec/librav1e: use av_dict_iterate
avcodec/librav1e: remove unnecessary variable
avcodec/libvpxenc: use av_dict_iterate
avformat/smjpegenc: use av_dict_iterate
avutil: use av_dict_iterate
avfilter/vf_scale: use av_dict_iterate
avfilter/vf_coreimage: use av_dict_iterate
avcodec/libxavs2: use av_dict_iterate
avcodec/avpacket: use av_dict_iterate
avformat/vorbiscomment: use av_dict_iterate
avfilter/vf_libvmaf: use av_dict_iterate
avfilter/f_metadata: use av_dict_iterate
avformat/cafenc: use av_dict_iterate
doc/examples/metadata: use av_dict_iterate
avformat/movenc: use av_dict_iterate
avformat/metadata: use av_dict_iterate
avformat/flvenc: use av_dict_iterate
avformat/hls: use av_dict_iterate
avformat/lrcenc: use av_dict_iterate
avformat/dump: use av_dict_iterate
avformat/wtvenc: use av_dict_iterate
avformat/ffmetaenc: use av_dict_iterate
avformat/id3v2enc: use av_dict_iterate
avformat/nutenc: use av_dict_iterate
avformat/apetag: use av_dict_iterate
avformat/asfenc: use av_dict_iterate
avformat/http: use av_dict_iterate
avformat/matroskaenc: use av_dict_iterate
avformat/fifo: use av_dict_iterate
doc/examples/metadata.c | 2 +-
fftools/cmdutils.c | 2 +-
fftools/ffmpeg.c | 2 +-
fftools/ffmpeg_demux.c | 5 ++---
fftools/ffmpeg_filter.c | 34 ++++++++++++++--------------------
fftools/ffmpeg_opt.c | 2 +-
fftools/ffplay.c | 4 ++--
fftools/ffprobe.c | 6 +++---
libavcodec/avpacket.c | 2 +-
libavcodec/librav1e.c | 7 +++----
libavcodec/libvpxenc.c | 4 ++--
libavcodec/libxavs2.c | 4 ++--
libavfilter/f_metadata.c | 4 ++--
libavfilter/vf_coreimage.m | 16 ++++++++--------
libavfilter/vf_libvmaf.c | 10 +++++-----
libavfilter/vf_scale.c | 4 ++--
libavformat/apetag.c | 4 ++--
libavformat/asfenc.c | 4 ++--
libavformat/cafenc.c | 6 +++---
libavformat/dump.c | 2 +-
libavformat/ffmetaenc.c | 4 ++--
libavformat/fifo.c | 4 ++--
libavformat/flvenc.c | 4 ++--
libavformat/hls.c | 6 +++---
libavformat/http.c | 6 +++---
libavformat/id3v2enc.c | 10 +++++-----
libavformat/lrcenc.c | 3 +--
libavformat/matroskaenc.c | 2 +-
libavformat/metadata.c | 4 ++--
libavformat/movenc.c | 8 ++++----
libavformat/nutenc.c | 12 ++++++------
libavformat/smjpegenc.c | 4 ++--
libavformat/vorbiscomment.c | 14 +++++++-------
libavformat/wtvenc.c | 8 ++++----
libavutil/opt.c | 12 ++++++------
libavutil/tests/dict.c | 10 +++++-----
36 files changed, 113 insertions(+), 122 deletions(-)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string Marvin Scholz
` (30 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
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)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 12:48 ` Andreas Rheinhardt
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
` (29 subsequent siblings)
31 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
Instead of manually assembling the string, use av_dict_get_string
which handles things like proper escaping too (even though it is
not yet needed here).
---
fftools/ffmpeg_filter.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b0c4c8ece3..29794fdc85 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -972,7 +972,7 @@ int configure_filtergraph(FilterGraph *fg)
if (simple) {
OutputStream *ost = fg->outputs[0]->ost;
- char args[512];
+ char *args = NULL;
const AVDictionaryEntry *e = NULL;
if (filter_nbthreads) {
@@ -985,26 +985,21 @@ int configure_filtergraph(FilterGraph *fg)
av_opt_set(fg->graph, "threads", e->value, 0);
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->sws_dict, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
- }
- if (strlen(args)) {
- args[strlen(args)-1] = 0;
- fg->graph->scale_sws_opts = av_strdup(args);
+ if (av_dict_count(ost->sws_dict)) {
+ ret = av_dict_get_string(ost->sws_dict, &args, '=', ':');
+ if (ret < 0)
+ goto fail;
+ fg->graph->scale_sws_opts = args;
+ args = NULL;
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->swr_opts, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+ if (av_dict_count(ost->swr_opts)) {
+ ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
+ if (ret < 0)
+ goto fail;
+ av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
+ free(args);
}
- if (strlen(args))
- args[strlen(args)-1] = 0;
- av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
} else {
fg->graph->nb_threads = filter_complex_nbthreads;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 03/31] avcodec/librav1e: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
` (28 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/librav1e.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index 4f424caf5b..f48d5e0eb4 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -243,8 +243,8 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
}
{
- AVDictionaryEntry *en = NULL;
- while ((en = av_dict_get(ctx->rav1e_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *en = NULL;
+ while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
if (parse_ret < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 04/31] avcodec/librav1e: remove unnecessary variable
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (2 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
` (27 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/librav1e.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index f48d5e0eb4..3481b7637d 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -245,8 +245,7 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
{
const AVDictionaryEntry *en = NULL;
while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
- int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
- if (parse_ret < 0)
+ if (rav1e_config_parse(cfg, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
}
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 05/31] avcodec/libvpxenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (3 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 06/31] avformat/smjpegenc: " Marvin Scholz
` (26 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/libvpxenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 667cffc200..9aa5510c28 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -900,7 +900,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;
av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -1072,7 +1072,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
- while ((en = av_dict_get(ctx->vpx_ts_parameters, "", en, AV_DICT_IGNORE_SUFFIX))) {
+ while ((en = av_dict_iterate(ctx->vpx_ts_parameters, en))) {
if (vpx_ts_param_parse(ctx, &enccfg, en->key, en->value, avctx->codec_id) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 06/31] avformat/smjpegenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (4 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 07/31] avutil: " Marvin Scholz
` (25 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/smjpegenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 888ece2f7c..edba08cf9b 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -35,7 +35,7 @@ typedef struct SMJPEGMuxContext {
static int smjpeg_write_header(AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *pb = s->pb;
int n, tag;
@@ -48,7 +48,7 @@ static int smjpeg_write_header(AVFormatContext *s)
avio_wb32(pb, 0);
ff_standardize_creation_time(s);
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
avio_wl32(pb, SMJPEG_TXT);
avio_wb32(pb, strlen(t->key) + strlen(t->value) + 3);
avio_write(pb, t->key, strlen(t->key));
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 07/31] avutil: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (5 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 06/31] avformat/smjpegenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 12:50 ` Andreas Rheinhardt
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 08/31] avfilter/vf_scale: " Marvin Scholz
` (24 subsequent siblings)
31 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavutil/opt.c | 12 ++++++------
libavutil/tests/dict.c | 10 +++++-----
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index a3940f47fb..0a909a8b22 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVDictionary *tmp = NULL;
int ret;
if (!options)
return 0;
- while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(*options, t))) {
ret = av_opt_set(obj, t->key, t->value, search_flags);
if (ret == AVERROR_OPTION_NOT_FOUND)
ret = av_dict_set(&tmp, t->key, t->value, 0);
@@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_DICT: {
AVDictionary *dict1 = NULL;
AVDictionary *dict2 = *(AVDictionary **)dst;
- AVDictionaryEntry *en1 = NULL;
- AVDictionaryEntry *en2 = NULL;
+ const AVDictionaryEntry *en1 = NULL;
+ const AVDictionaryEntry *en2 = NULL;
ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
if (ret < 0) {
av_dict_free(&dict1);
return ret;
}
do {
- en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
- en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
+ en1 = av_dict_iterate(dict1, en1);
+ en2 = av_dict_iterate(dict2, en2);
} while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
av_dict_free(&dict1);
return (!en1 && !en2);
diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
index d053545f4d..8c05752ea7 100644
--- a/libavutil/tests/dict.c
+++ b/libavutil/tests/dict.c
@@ -22,8 +22,8 @@
static void print_dict(const AVDictionary *m)
{
- AVDictionaryEntry *t = NULL;
- while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
+ const AVDictionaryEntry *t = NULL;
+ while ((t = av_dict_iterate(m, t)))
printf("%s %s ", t->key, t->value);
printf("\n");
}
@@ -94,7 +94,7 @@ int main(void)
if (av_dict_get(dict, NULL, NULL, 0))
printf("av_dict_get() does not correctly handle NULL key.\n");
e = NULL;
- while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+ while ((e = av_dict_iterate(dict, e)))
printf("%s %s\n", e->key, e->value);
av_dict_free(&dict);
@@ -106,7 +106,7 @@ int main(void)
printf("av_dict_set does not correctly handle NULL key\n");
e = NULL;
- while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+ while ((e = av_dict_iterate(dict, e)))
printf("'%s' '%s'\n", e->key, e->value);
av_dict_free(&dict);
@@ -122,7 +122,7 @@ int main(void)
av_dict_set_int(&dict, "12", 1, 0);
av_dict_set_int(&dict, "12", 2, AV_DICT_APPEND);
e = NULL;
- while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+ while ((e = av_dict_iterate(dict, e)))
printf("%s %s\n", e->key, e->value);
av_dict_free(&dict);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 08/31] avfilter/vf_scale: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (6 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 07/31] avutil: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 09/31] avfilter/vf_coreimage: " Marvin Scholz
` (23 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_scale.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 2b12cf283c..b95e2e6c66 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -555,8 +555,8 @@ static int config_props(AVFilterLink *outlink)
scale->out_range == AVCOL_RANGE_JPEG, 0);
if (scale->opts) {
- AVDictionaryEntry *e = NULL;
- while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *e = NULL;
+ while ((e = av_dict_iterate(scale->opts, e))) {
if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
return ret;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 09/31] avfilter/vf_coreimage: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (7 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 08/31] avfilter/vf_scale: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 10/31] avcodec/libxavs2: " Marvin Scholz
` (22 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_coreimage.m | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 874bdc8c56..b1959861de 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -416,8 +416,8 @@ static void set_option(CoreImageContext *ctx, CIFilter *filter, const char *key,
// set user options
if (filter_options) {
- AVDictionaryEntry *o = NULL;
- while ((o = av_dict_get(filter_options, "", o, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *o = NULL;
+ while ((o = av_dict_iterate(filter_options, o))) {
set_option(ctx, filter, o->key, o->value);
}
}
@@ -427,10 +427,10 @@ static void set_option(CoreImageContext *ctx, CIFilter *filter, const char *key,
static av_cold int init(AVFilterContext *fctx)
{
- CoreImageContext *ctx = fctx->priv;
- AVDictionary *filter_dict = NULL;
- AVDictionaryEntry *f = NULL;
- AVDictionaryEntry *o = NULL;
+ CoreImageContext *ctx = fctx->priv;
+ AVDictionary *filter_dict = NULL;
+ const AVDictionaryEntry *f = NULL;
+ const AVDictionaryEntry *o = NULL;
int ret;
int i;
@@ -460,7 +460,7 @@ static av_cold int init(AVFilterContext *fctx)
// parse filters for option key-value pairs (opt=val@opt2=val2) separated by @
i = 0;
- while ((f = av_dict_get(filter_dict, "", f, AV_DICT_IGNORE_SUFFIX))) {
+ while ((f = av_dict_iterate(filter_dict, f))) {
AVDictionary *filter_options = NULL;
if (strncmp(f->value, "default", 7)) { // not default
@@ -477,7 +477,7 @@ static av_cold int init(AVFilterContext *fctx)
if (!filter_options) {
av_log(ctx, AV_LOG_DEBUG, "\tusing default options\n");
} else {
- while ((o = av_dict_get(filter_options, "", o, AV_DICT_IGNORE_SUFFIX))) {
+ while ((o = av_dict_iterate(filter_options, o))) {
av_log(ctx, AV_LOG_DEBUG, "\t%s: %s\n", o->key, o->value);
}
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 10/31] avcodec/libxavs2: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (8 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 09/31] avfilter/vf_coreimage: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 11/31] avcodec/avpacket: " Marvin Scholz
` (21 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/libxavs2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 1672edfc07..c493ddc325 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -96,8 +96,8 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));
{
- AVDictionaryEntry *en = NULL;
- while ((en = av_dict_get(cae->xavs2_opts, "", en, AV_DICT_IGNORE_SUFFIX)))
+ const AVDictionaryEntry *en = NULL;
+ while ((en = av_dict_iterate(cae->xavs2_opts, en)))
xavs2_opt_set2(en->key, "%s", en->value);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 11/31] avcodec/avpacket: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (9 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 10/31] avcodec/libxavs2: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 12/31] avformat/vorbiscomment: " Marvin Scholz
` (20 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/avpacket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index bcbc4166cb..5fef65e97a 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -316,7 +316,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
const AVDictionaryEntry *t = NULL;
size_t total_length = 0;
- while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(dict, t))) {
for (int i = 0; i < 2; i++) {
const char *str = i ? t->value : t->key;
const size_t len = strlen(str) + 1;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 12/31] avformat/vorbiscomment: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (10 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 11/31] avcodec/avpacket: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 13/31] avfilter/vf_libvmaf: " Marvin Scholz
` (19 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
| 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index 13ee065a44..abe12fd586 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -45,17 +45,17 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string
len += strlen(vendor_string);
if (chapters && nb_chapters) {
for (int i = 0; i < nb_chapters; i++) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
len += 4 + 12 + 1 + 10;
- while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
len += 4 + 10 + len1 + 1 + strlen(tag->value);
}
}
}
if (m) {
- AVDictionaryEntry *tag = NULL;
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *tag = NULL;
+ while ((tag = av_dict_iterate(m, tag))) {
len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
}
}
@@ -77,9 +77,9 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
}
if (m) {
int count = av_dict_count(m) + cm_count;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
avio_wl32(pb, count);
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(m, tag))) {
int64_t len1 = strlen(tag->key);
int64_t len2 = strlen(tag->value);
if (len1+1+len2 > UINT32_MAX)
@@ -109,7 +109,7 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
avio_write(pb, chapter_time, 12);
tag = NULL;
- while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
int64_t len2 = strlen(tag->value);
if (len1+1+len2+10 > UINT32_MAX)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 13/31] avfilter/vf_libvmaf: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (11 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 12/31] avformat/vorbiscomment: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 14/31] avfilter/f_metadata: " Marvin Scholz
` (18 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_libvmaf.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 8f649c5b02..2586f37d99 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -236,9 +236,9 @@ static int parse_features(AVFilterContext *ctx)
for (unsigned i = 0; i < dict_cnt; i++) {
char *feature_name = NULL;
VmafFeatureDictionary *feature_opts_dict = NULL;
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
if (av_stristr(e->key, "name")) {
feature_name = e->value;
continue;
@@ -295,11 +295,11 @@ static int parse_models(AVFilterContext *ctx)
for (unsigned i = 0; i < dict_cnt; i++) {
VmafModelConfig model_cfg = { 0 };
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
char *version = NULL;
char *path = NULL;
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
if (av_stristr(e->key, "disable_clip")) {
model_cfg.flags |= av_stristr(e->value, "true") ?
VMAF_MODEL_FLAG_DISABLE_CLIP : 0;
@@ -355,7 +355,7 @@ static int parse_models(AVFilterContext *ctx)
goto exit;
}
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
VmafFeatureDictionary *feature_opts_dict = NULL;
char *feature_opt = NULL;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 14/31] avfilter/f_metadata: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (12 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 13/31] avfilter/vf_libvmaf: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 15/31] avformat/cafenc: " Marvin Scholz
` (17 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/f_metadata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 82491f2bb8..4b7cfb0cb7 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -308,7 +308,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterLink *outlink = ctx->outputs[0];
MetadataContext *s = ctx->priv;
AVDictionary **metadata = &frame->metadata;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
!s->key ? AV_DICT_IGNORE_SUFFIX: 0);
@@ -339,7 +339,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%s\n",
inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
s->print(ctx, "%s=%s\n", e->key, e->value);
- while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
+ while ((e = av_dict_iterate(*metadata, e)) != NULL) {
s->print(ctx, "%s=%s\n", e->key, e->value);
}
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 15/31] avformat/cafenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (13 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 14/31] avfilter/f_metadata: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 16/31] doc/examples/metadata: " Marvin Scholz
` (16 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/cafenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index b90811d46f..b8317cd5ed 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -113,7 +113,7 @@ static int caf_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[0]->codecpar;
CAFContext *caf = s->priv_data;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, par->codec_id);
int64_t chunk_size = 0;
int frame_size = par->frame_size, sample_rate = par->sample_rate;
@@ -195,13 +195,13 @@ static int caf_write_header(AVFormatContext *s)
ff_standardize_creation_time(s);
if (av_dict_count(s->metadata)) {
ffio_wfourcc(pb, "info"); //< Information chunk
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
chunk_size += strlen(t->key) + strlen(t->value) + 2;
}
avio_wb64(pb, chunk_size + 4);
avio_wb32(pb, av_dict_count(s->metadata));
t = NULL;
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
avio_put_str(pb, t->key);
avio_put_str(pb, t->value);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 16/31] doc/examples/metadata: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (14 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 15/31] avformat/cafenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 17/31] avformat/movenc: " Marvin Scholz
` (15 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
doc/examples/metadata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/examples/metadata.c b/doc/examples/metadata.c
index 7c44009a24..734b12df16 100644
--- a/doc/examples/metadata.c
+++ b/doc/examples/metadata.c
@@ -52,7 +52,7 @@ int main (int argc, char **argv)
return ret;
}
- while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(fmt_ctx->metadata, tag)))
printf("%s=%s\n", tag->key, tag->value);
avformat_close_input(&fmt_ctx);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 17/31] avformat/movenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (15 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 16/31] doc/examples/metadata: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 18/31] avformat/metadata: " Marvin Scholz
` (14 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/movenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 064b541972..7b00e65cdd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4110,7 +4110,7 @@ static int mov_write_mdta_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int64_t curpos, entry_pos;
int count = 0;
@@ -4121,7 +4121,7 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
entry_pos = avio_tell(pb);
avio_wb32(pb, 0); /* entry count */
- while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ while (t = av_dict_iterate(s->metadata, t)) {
size_t key_len = strlen(t->key);
avio_wb32(pb, key_len + 8);
ffio_wfourcc(pb, "mdta");
@@ -4139,14 +4139,14 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int count = 1; /* keys are 1-index based */
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, "ilst");
- while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ while (t = av_dict_iterate(s->metadata, t)) {
int64_t entry_pos = avio_tell(pb);
avio_wb32(pb, 0); /* size */
avio_wb32(pb, count); /* key */
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 18/31] avformat/metadata: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (16 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 17/31] avformat/movenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 19/31] avformat/flvenc: " Marvin Scholz
` (13 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/metadata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index b9b6de7972..a0258ea125 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -29,14 +29,14 @@ void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
/* TODO: use binary search to look up the two conversion tables
if the tables are getting big enough that it would matter speed wise */
const AVMetadataConv *sc, *dc;
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key;
if (d_conv == s_conv || !pm)
return;
- while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((mtag = av_dict_iterate(*pm, mtag))) {
key = mtag->key;
if (s_conv)
for (sc=s_conv; sc->native; sc++)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 19/31] avformat/flvenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (17 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 18/31] avformat/metadata: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 20/31] avformat/hls: " Marvin Scholz
` (12 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/flvenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 59be11eba8..128ae8ebc0 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -277,7 +277,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
int write_duration_filesize = !(flv->flags & FLV_NO_DURATION_FILESIZE);
int metadata_count = 0;
int64_t metadata_count_pos;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
/* write meta_tag */
avio_w8(pb, FLV_TAG_TYPE_META); // tag type META
@@ -353,7 +353,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
}
ff_standardize_creation_time(s);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
if( !strcmp(tag->key, "width")
||!strcmp(tag->key, "height")
||!strcmp(tag->key, "videodatarate")
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 20/31] avformat/hls: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (18 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 19/31] avformat/flvenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 21/31] avformat/lrcenc: " Marvin Scholz
` (11 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
And constify oldentry too while at it.
---
libavformat/hls.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 402eb2b5a0..926d053939 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1104,10 +1104,10 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb,
static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata,
ID3v2ExtraMetaAPIC *apic)
{
- AVDictionaryEntry *entry = NULL;
- AVDictionaryEntry *oldentry;
+ const AVDictionaryEntry *entry = NULL;
+ const AVDictionaryEntry *oldentry;
/* check that no keys have changed values */
- while ((entry = av_dict_get(metadata, "", entry, AV_DICT_IGNORE_SUFFIX))) {
+ while ((entry = av_dict_iterate(metadata, entry))) {
oldentry = av_dict_get(pls->id3_initial, entry->key, NULL, AV_DICT_MATCH_CASE);
if (!oldentry || strcmp(oldentry->value, entry->value) != 0)
return 1;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 21/31] avformat/lrcenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (19 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 20/31] avformat/hls: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 22/31] avformat/dump: " Marvin Scholz
` (10 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/lrcenc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c
index f7a5a6982d..2d6ca33e38 100644
--- a/libavformat/lrcenc.c
+++ b/libavformat/lrcenc.c
@@ -63,8 +63,7 @@ static int lrc_write_header(AVFormatContext *s)
av_dict_set(&s->metadata, "ve", NULL, 0);
}
for(metadata_item = NULL;
- (metadata_item = av_dict_get(s->metadata, "", metadata_item,
- AV_DICT_IGNORE_SUFFIX));) {
+ (metadata_item = av_dict_iterate(s->metadata, metadata_item));) {
char *delim;
if(!metadata_item->value[0]) {
continue;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 22/31] avformat/dump: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (20 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 21/31] avformat/lrcenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: " Marvin Scholz
` (9 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 225f80ac22..d31e4c2ec6 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -140,7 +140,7 @@ static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
const AVDictionaryEntry *tag = NULL;
av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(m, tag)))
if (strcmp("language", tag->key)) {
const char *p = tag->value;
av_log(ctx, AV_LOG_INFO,
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (21 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 22/31] avformat/dump: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 12:53 ` Andreas Rheinhardt
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 24/31] avformat/ffmetaenc: " Marvin Scholz
` (8 subsequent siblings)
31 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/wtvenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 7e28b2082e..977e16c5a4 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -670,12 +670,12 @@ static void write_table_entries_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = 0;
ff_standardize_creation_time(s);
//FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(s->metadata, tag)))
write_tag(pb, tag->key, tag->value);
if (wctx->thumbnail.size) {
@@ -698,11 +698,11 @@ static void write_table_redirector_legacy_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = 0;
int64_t pos = 0;
//FIXME: translate special tags to binary representation
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
avio_wl64(pb, pos);
pos += metadata_header_size(tag->key) + strlen(tag->value)*2 + 2;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 24/31] avformat/ffmetaenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (22 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 25/31] avformat/id3v2enc: " Marvin Scholz
` (7 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/ffmetaenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c
index edd66e1a04..f27ac1ac50 100644
--- a/libavformat/ffmetaenc.c
+++ b/libavformat/ffmetaenc.c
@@ -40,8 +40,8 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str)
static void write_tags(AVIOContext *s, AVDictionary *m)
{
- AVDictionaryEntry *t = NULL;
- while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *t = NULL;
+ while ((t = av_dict_iterate(m, t))) {
write_escape_str(s, t->key);
avio_w8(s, '=');
write_escape_str(s, t->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 25/31] avformat/id3v2enc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (23 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 24/31] avformat/ffmetaenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 26/31] avformat/nutenc: " Marvin Scholz
` (6 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/id3v2enc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
index 515d2efd7d..ac907c2758 100644
--- a/libavformat/id3v2enc.c
+++ b/libavformat/id3v2enc.c
@@ -150,7 +150,7 @@ static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext *avioc, const char *
return len + ID3v2_HEADER_SIZE;
}
-static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t,
+static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, const AVDictionaryEntry *t,
const char table[][4], enum ID3v2Encoding enc)
{
uint32_t tag;
@@ -167,13 +167,13 @@ static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictio
static void id3v2_3_metadata_split_date(AVDictionary **pm)
{
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key, *value;
char year[5] = {0}, day_month[5] = {0};
int i;
- while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((mtag = av_dict_iterate(*pm, mtag))) {
key = mtag->key;
if (!av_strcasecmp(key, "date")) {
/* split date tag using "YYYY-MM-DD" format into year and month/day segments */
@@ -220,7 +220,7 @@ void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version,
static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
ID3v2EncContext *id3, int enc)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int ret;
ff_metadata_conv(metadata, ff_id3v2_34_metadata_conv, NULL);
@@ -229,7 +229,7 @@ static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
else if (id3->version == 4)
ff_metadata_conv(metadata, ff_id3v2_4_metadata_conv, NULL);
- while ((t = av_dict_get(*metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(*metadata, t))) {
if ((ret = id3v2_check_write_tag(id3, pb, t, ff_id3v2_tags, enc)) > 0) {
id3->len += ret;
continue;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 26/31] avformat/nutenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (24 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 25/31] avformat/id3v2enc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 27/31] avformat/apetag: " Marvin Scholz
` (5 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/nutenc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 1afdeeb8ab..ff81ee34aa 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -516,7 +516,7 @@ static int add_info(AVIOContext *bc, const char *type, const char *value)
static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
{
AVFormatContext *s = nut->avf;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
int count = 0, dyn_size;
@@ -525,7 +525,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
return ret;
ff_standardize_creation_time(s);
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(s->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
put_v(bc, 0); //stream_if_plus1
@@ -544,7 +544,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
AVFormatContext *s= nut->avf;
AVStream* st = s->streams[stream_id];
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size, i;
@@ -552,7 +552,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
if (ret < 0)
return ret;
- while ((t = av_dict_get(st->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(st->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
for (i=0; ff_nut_dispositions[i].flag; ++i) {
if (st->disposition & ff_nut_dispositions[i].flag)
@@ -587,7 +587,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
{
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVChapter *ch = nut->avf->chapters[id];
int ret, dyn_size, count = 0;
@@ -600,7 +600,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start
put_v(bc, ch->end - ch->start); // chapter_len
- while ((t = av_dict_get(ch->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(ch->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
put_v(bc, count);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 27/31] avformat/apetag: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (25 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 26/31] avformat/nutenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 28/31] avformat/asfenc: " Marvin Scholz
` (4 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/apetag.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index e861aac0f8..f2794c46f2 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -175,7 +175,7 @@ static int string_is_ascii(const uint8_t *str)
int ff_ape_write_tag(AVFormatContext *s)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int size, ret, count = 0;
AVIOContext *dyn_bc;
uint8_t *dyn_buf;
@@ -184,7 +184,7 @@ int ff_ape_write_tag(AVFormatContext *s)
return ret;
ff_standardize_creation_time(s);
- while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ while ((e = av_dict_iterate(s->metadata, e))) {
int val_len;
if (!string_is_ascii(e->key)) {
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 28/31] avformat/asfenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (26 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 27/31] avformat/apetag: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 29/31] avformat/http: " Marvin Scholz
` (3 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/asfenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 70800a6df5..47240fc0a8 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -570,10 +570,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
end_header(pb, hpos);
}
if (metadata_count) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
hpos = put_header(pb, &ff_asf_extended_content_header);
avio_wl16(pb, metadata_count);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
put_str16(pb, dyn_buf, tag->key);
avio_wl16(pb, 0);
put_str16(pb, dyn_buf, tag->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 29/31] avformat/http: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (27 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 28/31] avformat/asfenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 30/31] avformat/matroskaenc: " Marvin Scholz
` (2 subsequent siblings)
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/http.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index c5c48c7900..7bce821535 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1021,11 +1021,11 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
static int cookie_string(AVDictionary *dict, char **cookies)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int len = 1;
// determine how much memory is needed for the cookies string
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
len += strlen(e->key) + strlen(e->value) + 1;
// reallocate the cookies
@@ -1036,7 +1036,7 @@ static int cookie_string(AVDictionary *dict, char **cookies)
*cookies[0] = '\0';
// write out the cookies
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);
return 0;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 30/31] avformat/matroskaenc: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (28 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 29/31] avformat/http: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 31/31] avformat/fifo: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/matroskaenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2be4f87284..2deb4284e8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2048,7 +2048,7 @@ static int mkv_write_tag(MatroskaMuxContext *mkv, const AVDictionary *m,
mkv_write_tag_targets(mkv, tmp_bc, elementid, uid);
- while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(m, t))) {
if (mkv_check_tag_name(t->key, elementid)) {
ret = mkv_write_simpletag(tmp_bc, t);
if (ret < 0)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH 31/31] avformat/fifo: use av_dict_iterate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (29 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 30/31] avformat/matroskaenc: " Marvin Scholz
@ 2022-11-25 1:30 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
31 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-25 1:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/fifo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 7b35c9bf02..c125a97b0d 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -148,8 +148,8 @@ static int fifo_thread_write_header(FifoThreadContext *ctx)
// Check for options unrecognized by underlying muxer
if (format_options) {
- AVDictionaryEntry *entry = NULL;
- while ((entry = av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)))
+ const AVDictionaryEntry *entry = NULL;
+ while ((entry = av_dict_iterate(format_options, entry)))
av_log(avf2, AV_LOG_ERROR, "Unknown option '%s'\n", entry->key);
ret = AVERROR(EINVAL);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string Marvin Scholz
@ 2022-11-25 12:48 ` Andreas Rheinhardt
0 siblings, 0 replies; 72+ messages in thread
From: Andreas Rheinhardt @ 2022-11-25 12:48 UTC (permalink / raw)
To: ffmpeg-devel
Marvin Scholz:
> Instead of manually assembling the string, use av_dict_get_string
> which handles things like proper escaping too (even though it is
> not yet needed here).
> ---
> fftools/ffmpeg_filter.c | 31 +++++++++++++------------------
> 1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index b0c4c8ece3..29794fdc85 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -972,7 +972,7 @@ int configure_filtergraph(FilterGraph *fg)
>
> if (simple) {
> OutputStream *ost = fg->outputs[0]->ost;
> - char args[512];
> + char *args = NULL;
> const AVDictionaryEntry *e = NULL;
>
> if (filter_nbthreads) {
> @@ -985,26 +985,21 @@ int configure_filtergraph(FilterGraph *fg)
> av_opt_set(fg->graph, "threads", e->value, 0);
> }
>
> - args[0] = 0;
> - e = NULL;
> - while ((e = av_dict_get(ost->sws_dict, "", e,
> - AV_DICT_IGNORE_SUFFIX))) {
> - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
> - }
> - if (strlen(args)) {
> - args[strlen(args)-1] = 0;
> - fg->graph->scale_sws_opts = av_strdup(args);
> + if (av_dict_count(ost->sws_dict)) {
> + ret = av_dict_get_string(ost->sws_dict, &args, '=', ':');
> + if (ret < 0)
> + goto fail;
> + fg->graph->scale_sws_opts = args;
> + args = NULL;
It would be cleaner if you used a smaller scope for args (here and
below); or maybe just eliminate this variable here entirely by using
&fg->graph->scale_sws_opts as destination for av_dict_get_string()?
> }
>
> - args[0] = 0;
> - e = NULL;
> - while ((e = av_dict_get(ost->swr_opts, "", e,
> - AV_DICT_IGNORE_SUFFIX))) {
> - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
> + if (av_dict_count(ost->swr_opts)) {
> + ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
> + if (ret < 0)
> + goto fail;
> + av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
> + free(args);
Wrong deallocator.
> }
> - if (strlen(args))
> - args[strlen(args)-1] = 0;
> - av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
> } else {
> fg->graph->nb_threads = filter_complex_nbthreads;
> }
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH 07/31] avutil: use av_dict_iterate
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 07/31] avutil: " Marvin Scholz
@ 2022-11-25 12:50 ` Andreas Rheinhardt
2022-11-26 14:42 ` Marvin Scholz
0 siblings, 1 reply; 72+ messages in thread
From: Andreas Rheinhardt @ 2022-11-25 12:50 UTC (permalink / raw)
To: ffmpeg-devel
Marvin Scholz:
> ---
> libavutil/opt.c | 12 ++++++------
> libavutil/tests/dict.c | 10 +++++-----
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index a3940f47fb..0a909a8b22 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>
> int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
> {
> - AVDictionaryEntry *t = NULL;
> + const AVDictionaryEntry *t = NULL;
> AVDictionary *tmp = NULL;
> int ret;
>
> if (!options)
> return 0;
>
> - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
> + while ((t = av_dict_iterate(*options, t))) {
> ret = av_opt_set(obj, t->key, t->value, search_flags);
> if (ret == AVERROR_OPTION_NOT_FOUND)
> ret = av_dict_set(&tmp, t->key, t->value, 0);
> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
> case AV_OPT_TYPE_DICT: {
> AVDictionary *dict1 = NULL;
> AVDictionary *dict2 = *(AVDictionary **)dst;
> - AVDictionaryEntry *en1 = NULL;
> - AVDictionaryEntry *en2 = NULL;
> + const AVDictionaryEntry *en1 = NULL;
> + const AVDictionaryEntry *en2 = NULL;
> ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
> if (ret < 0) {
> av_dict_free(&dict1);
> return ret;
> }
> do {
> - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
> - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
> + en1 = av_dict_iterate(dict1, en1);
> + en2 = av_dict_iterate(dict2, en2);
> } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
> av_dict_free(&dict1);
> return (!en1 && !en2);
> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
> index d053545f4d..8c05752ea7 100644
> --- a/libavutil/tests/dict.c
> +++ b/libavutil/tests/dict.c
> @@ -22,8 +22,8 @@
>
> static void print_dict(const AVDictionary *m)
> {
> - AVDictionaryEntry *t = NULL;
> - while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
> + const AVDictionaryEntry *t = NULL;
> + while ((t = av_dict_iterate(m, t)))
> printf("%s %s ", t->key, t->value);
> printf("\n");
> }
> @@ -94,7 +94,7 @@ int main(void)
> if (av_dict_get(dict, NULL, NULL, 0))
> printf("av_dict_get() does not correctly handle NULL key.\n");
> e = NULL;
> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
> + while ((e = av_dict_iterate(dict, e)))
> printf("%s %s\n", e->key, e->value);
> av_dict_free(&dict);
>
> @@ -106,7 +106,7 @@ int main(void)
> printf("av_dict_set does not correctly handle NULL key\n");
>
> e = NULL;
> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
> + while ((e = av_dict_iterate(dict, e)))
> printf("'%s' '%s'\n", e->key, e->value);
> av_dict_free(&dict);
>
> @@ -122,7 +122,7 @@ int main(void)
> av_dict_set_int(&dict, "12", 1, 0);
> av_dict_set_int(&dict, "12", 2, AV_DICT_APPEND);
> e = NULL;
> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
> + while ((e = av_dict_iterate(dict, e)))
> printf("%s %s\n", e->key, e->value);
> av_dict_free(&dict);
>
This stops testing the old iterating pattern; instead it should
explicitly test that both patterns coincide.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: use av_dict_iterate
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: " Marvin Scholz
@ 2022-11-25 12:53 ` Andreas Rheinhardt
0 siblings, 0 replies; 72+ messages in thread
From: Andreas Rheinhardt @ 2022-11-25 12:53 UTC (permalink / raw)
To: ffmpeg-devel
Marvin Scholz:
> ---
> libavformat/wtvenc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
> index 7e28b2082e..977e16c5a4 100644
> --- a/libavformat/wtvenc.c
> +++ b/libavformat/wtvenc.c
> @@ -670,12 +670,12 @@ static void write_table_entries_attrib(AVFormatContext *s)
> {
> WtvContext *wctx = s->priv_data;
> AVIOContext *pb = s->pb;
> - AVDictionaryEntry *tag = 0;
> + const AVDictionaryEntry *tag = 0;
>
> ff_standardize_creation_time(s);
> //FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
> ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
> - while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
> + while ((tag = av_dict_iterate(s->metadata, tag)))
> write_tag(pb, tag->key, tag->value);
>
> if (wctx->thumbnail.size) {
> @@ -698,11 +698,11 @@ static void write_table_redirector_legacy_attrib(AVFormatContext *s)
> {
> WtvContext *wctx = s->priv_data;
> AVIOContext *pb = s->pb;
> - AVDictionaryEntry *tag = 0;
> + const AVDictionaryEntry *tag = 0;
> int64_t pos = 0;
>
> //FIXME: translate special tags to binary representation
> - while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
> + while ((tag = av_dict_iterate(s->metadata, tag))) {
> avio_wl64(pb, pos);
> pos += metadata_header_size(tag->key) + strlen(tag->value)*2 + 2;
> }
We typically use NULL for NULL pointers.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH 07/31] avutil: use av_dict_iterate
2022-11-25 12:50 ` Andreas Rheinhardt
@ 2022-11-26 14:42 ` Marvin Scholz
2022-11-27 13:59 ` James Almer
0 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 25 Nov 2022, at 13:50, Andreas Rheinhardt wrote:
> Marvin Scholz:
>> ---
>> libavutil/opt.c | 12 ++++++------
>> libavutil/tests/dict.c | 10 +++++-----
>> 2 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/libavutil/opt.c b/libavutil/opt.c
>> index a3940f47fb..0a909a8b22 100644
>> --- a/libavutil/opt.c
>> +++ b/libavutil/opt.c
>> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>>
>> int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
>> {
>> - AVDictionaryEntry *t = NULL;
>> + const AVDictionaryEntry *t = NULL;
>> AVDictionary *tmp = NULL;
>> int ret;
>>
>> if (!options)
>> return 0;
>>
>> - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
>> + while ((t = av_dict_iterate(*options, t))) {
>> ret = av_opt_set(obj, t->key, t->value, search_flags);
>> if (ret == AVERROR_OPTION_NOT_FOUND)
>> ret = av_dict_set(&tmp, t->key, t->value, 0);
>> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
>> case AV_OPT_TYPE_DICT: {
>> AVDictionary *dict1 = NULL;
>> AVDictionary *dict2 = *(AVDictionary **)dst;
>> - AVDictionaryEntry *en1 = NULL;
>> - AVDictionaryEntry *en2 = NULL;
>> + const AVDictionaryEntry *en1 = NULL;
>> + const AVDictionaryEntry *en2 = NULL;
>> ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
>> if (ret < 0) {
>> av_dict_free(&dict1);
>> return ret;
>> }
>> do {
>> - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
>> - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
>> + en1 = av_dict_iterate(dict1, en1);
>> + en2 = av_dict_iterate(dict2, en2);
>> } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
>> av_dict_free(&dict1);
>> return (!en1 && !en2);
>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>> index d053545f4d..8c05752ea7 100644
>> --- a/libavutil/tests/dict.c
>> +++ b/libavutil/tests/dict.c
>> @@ -22,8 +22,8 @@
>>
>> static void print_dict(const AVDictionary *m)
>> {
>> - AVDictionaryEntry *t = NULL;
>> - while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
>> + const AVDictionaryEntry *t = NULL;
>> + while ((t = av_dict_iterate(m, t)))
>> printf("%s %s ", t->key, t->value);
>> printf("\n");
>> }
>> @@ -94,7 +94,7 @@ int main(void)
>> if (av_dict_get(dict, NULL, NULL, 0))
>> printf("av_dict_get() does not correctly handle NULL key.\n");
>> e = NULL;
>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>> + while ((e = av_dict_iterate(dict, e)))
>> printf("%s %s\n", e->key, e->value);
>> av_dict_free(&dict);
>>
>> @@ -106,7 +106,7 @@ int main(void)
>> printf("av_dict_set does not correctly handle NULL key\n");
>>
>> e = NULL;
>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>> + while ((e = av_dict_iterate(dict, e)))
>> printf("'%s' '%s'\n", e->key, e->value);
>> av_dict_free(&dict);
>>
>> @@ -122,7 +122,7 @@ int main(void)
>> av_dict_set_int(&dict, "12", 1, 0);
>> av_dict_set_int(&dict, "12", 2, AV_DICT_APPEND);
>> e = NULL;
>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>> + while ((e = av_dict_iterate(dict, e)))
>> printf("%s %s\n", e->key, e->value);
>> av_dict_free(&dict);
>>
>
> This stops testing the old iterating pattern; instead it should
> explicitly test that both patterns coincide.
>
Ok, I've removed this change for now from the pachset
as adding tests is not really what this patchset is about.
Additionally I do not fully understand how the testing works yet
so I don't know how I could write such a test.
> - Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (30 preceding siblings ...)
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 31/31] avformat/fifo: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 01/31] fftools: use av_dict_iterate Marvin Scholz
` (30 more replies)
31 siblings, 31 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
Changes to v1:
- Fixed 0 used as NULL pointer in wtvenc
- Dropped change to the dict test
- Narrowed variabel scope/removed unnecessary variables
in fftools/ffmpeg_filter.c
---
This patchset replaces the common use of:
av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)
with the new av_dict_iterate in most places where it makes
sense. It is more concise and clearer to understand the
intention of the code.
Additionally for fftools/ffmpeg_filter it switches to
av_dict_get_string, as it makes more sense to use the
proper API for that instead of manually assembling the
string.
Marvin Scholz (31):
fftools: use av_dict_iterate
fftools: use av_dict_get_string
avcodec/librav1e: use av_dict_iterate
avcodec/librav1e: remove unnecessary variable
avcodec/libvpxenc: use av_dict_iterate
avformat/smjpegenc: use av_dict_iterate
avutil: use av_dict_iterate
avfilter/vf_scale: use av_dict_iterate
avfilter/vf_coreimage: use av_dict_iterate
avcodec/libxavs2: use av_dict_iterate
avcodec/avpacket: use av_dict_iterate
avformat/vorbiscomment: use av_dict_iterate
avfilter/vf_libvmaf: use av_dict_iterate
avfilter/f_metadata: use av_dict_iterate
avformat/cafenc: use av_dict_iterate
doc/examples/metadata: use av_dict_iterate
avformat/movenc: use av_dict_iterate
avformat/metadata: use av_dict_iterate
avformat/flvenc: use av_dict_iterate
avformat/hls: use av_dict_iterate
avformat/lrcenc: use av_dict_iterate
avformat/dump: use av_dict_iterate
avformat/wtvenc: use av_dict_iterate
avformat/ffmetaenc: use av_dict_iterate
avformat/id3v2enc: use av_dict_iterate
avformat/nutenc: use av_dict_iterate
avformat/apetag: use av_dict_iterate
avformat/asfenc: use av_dict_iterate
avformat/http: use av_dict_iterate
avformat/matroskaenc: use av_dict_iterate
avformat/fifo: use av_dict_iterate
doc/examples/metadata.c | 2 +-
fftools/cmdutils.c | 2 +-
fftools/ffmpeg.c | 2 +-
fftools/ffmpeg_demux.c | 5 ++---
fftools/ffmpeg_filter.c | 36 +++++++++++++++---------------------
fftools/ffmpeg_opt.c | 2 +-
fftools/ffplay.c | 4 ++--
fftools/ffprobe.c | 6 +++---
libavcodec/avpacket.c | 2 +-
libavcodec/librav1e.c | 7 +++----
libavcodec/libvpxenc.c | 4 ++--
libavcodec/libxavs2.c | 4 ++--
libavfilter/f_metadata.c | 4 ++--
libavfilter/vf_coreimage.m | 16 ++++++++--------
libavfilter/vf_libvmaf.c | 10 +++++-----
libavfilter/vf_scale.c | 4 ++--
libavformat/apetag.c | 4 ++--
libavformat/asfenc.c | 4 ++--
libavformat/cafenc.c | 6 +++---
libavformat/dump.c | 2 +-
libavformat/ffmetaenc.c | 4 ++--
libavformat/fifo.c | 4 ++--
libavformat/flvenc.c | 4 ++--
libavformat/hls.c | 6 +++---
libavformat/http.c | 6 +++---
libavformat/id3v2enc.c | 10 +++++-----
libavformat/lrcenc.c | 3 +--
libavformat/matroskaenc.c | 2 +-
libavformat/metadata.c | 4 ++--
libavformat/movenc.c | 8 ++++----
libavformat/nutenc.c | 12 ++++++------
libavformat/smjpegenc.c | 4 ++--
libavformat/vorbiscomment.c | 14 +++++++-------
libavformat/wtvenc.c | 8 ++++----
libavutil/opt.c | 12 ++++++------
libavutil/tests/dict.c | 2 +-
36 files changed, 110 insertions(+), 119 deletions(-)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 01/31] fftools: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 02/31] fftools: use av_dict_get_string Marvin Scholz
` (29 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
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)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 02/31] fftools: use av_dict_get_string
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 01/31] fftools: use av_dict_iterate Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
` (28 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
Instead of manually assembling the string, use av_dict_get_string
which handles things like proper escaping too (even though it is
not yet needed here).
---
fftools/ffmpeg_filter.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b0c4c8ece3..7eb656dbe5 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -972,39 +972,34 @@ int configure_filtergraph(FilterGraph *fg)
if (simple) {
OutputStream *ost = fg->outputs[0]->ost;
- char args[512];
- const AVDictionaryEntry *e = NULL;
if (filter_nbthreads) {
ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0);
if (ret < 0)
goto fail;
} else {
+ const AVDictionaryEntry *e = NULL;
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->sws_dict, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
- }
- if (strlen(args)) {
- args[strlen(args)-1] = 0;
- fg->graph->scale_sws_opts = av_strdup(args);
+ if (av_dict_count(ost->sws_dict)) {
+ ret = av_dict_get_string(ost->sws_dict,
+ &fg->graph->scale_sws_opts,
+ '=', ':');
+ if (ret < 0)
+ goto fail;
}
- args[0] = 0;
- e = NULL;
- while ((e = av_dict_get(ost->swr_opts, "", e,
- AV_DICT_IGNORE_SUFFIX))) {
- av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+ if (av_dict_count(ost->swr_opts)) {
+ char *args;
+ ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
+ if (ret < 0)
+ goto fail;
+ av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
+ av_free(args);
}
- if (strlen(args))
- args[strlen(args)-1] = 0;
- av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
} else {
fg->graph->nb_threads = filter_complex_nbthreads;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 03/31] avcodec/librav1e: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 01/31] fftools: use av_dict_iterate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 02/31] fftools: use av_dict_get_string Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
` (27 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/librav1e.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index 4f424caf5b..f48d5e0eb4 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -243,8 +243,8 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
}
{
- AVDictionaryEntry *en = NULL;
- while ((en = av_dict_get(ctx->rav1e_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *en = NULL;
+ while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
if (parse_ret < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 04/31] avcodec/librav1e: remove unnecessary variable
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (2 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
` (26 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/librav1e.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index f48d5e0eb4..3481b7637d 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -245,8 +245,7 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
{
const AVDictionaryEntry *en = NULL;
while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
- int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
- if (parse_ret < 0)
+ if (rav1e_config_parse(cfg, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
}
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (3 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-30 20:18 ` James Zern
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 06/31] avformat/smjpegenc: " Marvin Scholz
` (25 subsequent siblings)
30 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/libvpxenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 667cffc200..9aa5510c28 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -900,7 +900,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;
av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -1072,7 +1072,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
- while ((en = av_dict_get(ctx->vpx_ts_parameters, "", en, AV_DICT_IGNORE_SUFFIX))) {
+ while ((en = av_dict_iterate(ctx->vpx_ts_parameters, en))) {
if (vpx_ts_param_parse(ctx, &enccfg, en->key, en->value, avctx->codec_id) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 06/31] avformat/smjpegenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (4 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 07/31] avutil: " Marvin Scholz
` (24 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/smjpegenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 888ece2f7c..edba08cf9b 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -35,7 +35,7 @@ typedef struct SMJPEGMuxContext {
static int smjpeg_write_header(AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *pb = s->pb;
int n, tag;
@@ -48,7 +48,7 @@ static int smjpeg_write_header(AVFormatContext *s)
avio_wb32(pb, 0);
ff_standardize_creation_time(s);
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
avio_wl32(pb, SMJPEG_TXT);
avio_wb32(pb, strlen(t->key) + strlen(t->value) + 3);
avio_write(pb, t->key, strlen(t->key));
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 07/31] avutil: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (5 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 06/31] avformat/smjpegenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-27 15:06 ` James Almer
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 08/31] avfilter/vf_scale: " Marvin Scholz
` (23 subsequent siblings)
30 siblings, 1 reply; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavutil/opt.c | 12 ++++++------
libavutil/tests/dict.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index a3940f47fb..0a909a8b22 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVDictionary *tmp = NULL;
int ret;
if (!options)
return 0;
- while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(*options, t))) {
ret = av_opt_set(obj, t->key, t->value, search_flags);
if (ret == AVERROR_OPTION_NOT_FOUND)
ret = av_dict_set(&tmp, t->key, t->value, 0);
@@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
case AV_OPT_TYPE_DICT: {
AVDictionary *dict1 = NULL;
AVDictionary *dict2 = *(AVDictionary **)dst;
- AVDictionaryEntry *en1 = NULL;
- AVDictionaryEntry *en2 = NULL;
+ const AVDictionaryEntry *en1 = NULL;
+ const AVDictionaryEntry *en2 = NULL;
ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
if (ret < 0) {
av_dict_free(&dict1);
return ret;
}
do {
- en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
- en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
+ en1 = av_dict_iterate(dict1, en1);
+ en2 = av_dict_iterate(dict2, en2);
} while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
av_dict_free(&dict1);
return (!en1 && !en2);
diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
index d053545f4d..91567289c2 100644
--- a/libavutil/tests/dict.c
+++ b/libavutil/tests/dict.c
@@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
int main(void)
{
AVDictionary *dict = NULL;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
char *buffer = NULL;
printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 08/31] avfilter/vf_scale: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (6 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 07/31] avutil: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 09/31] avfilter/vf_coreimage: " Marvin Scholz
` (22 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_scale.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 2b12cf283c..b95e2e6c66 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -555,8 +555,8 @@ static int config_props(AVFilterLink *outlink)
scale->out_range == AVCOL_RANGE_JPEG, 0);
if (scale->opts) {
- AVDictionaryEntry *e = NULL;
- while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *e = NULL;
+ while ((e = av_dict_iterate(scale->opts, e))) {
if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
return ret;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 09/31] avfilter/vf_coreimage: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (7 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 08/31] avfilter/vf_scale: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 10/31] avcodec/libxavs2: " Marvin Scholz
` (21 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_coreimage.m | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 874bdc8c56..b1959861de 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -416,8 +416,8 @@ static void set_option(CoreImageContext *ctx, CIFilter *filter, const char *key,
// set user options
if (filter_options) {
- AVDictionaryEntry *o = NULL;
- while ((o = av_dict_get(filter_options, "", o, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *o = NULL;
+ while ((o = av_dict_iterate(filter_options, o))) {
set_option(ctx, filter, o->key, o->value);
}
}
@@ -427,10 +427,10 @@ static void set_option(CoreImageContext *ctx, CIFilter *filter, const char *key,
static av_cold int init(AVFilterContext *fctx)
{
- CoreImageContext *ctx = fctx->priv;
- AVDictionary *filter_dict = NULL;
- AVDictionaryEntry *f = NULL;
- AVDictionaryEntry *o = NULL;
+ CoreImageContext *ctx = fctx->priv;
+ AVDictionary *filter_dict = NULL;
+ const AVDictionaryEntry *f = NULL;
+ const AVDictionaryEntry *o = NULL;
int ret;
int i;
@@ -460,7 +460,7 @@ static av_cold int init(AVFilterContext *fctx)
// parse filters for option key-value pairs (opt=val@opt2=val2) separated by @
i = 0;
- while ((f = av_dict_get(filter_dict, "", f, AV_DICT_IGNORE_SUFFIX))) {
+ while ((f = av_dict_iterate(filter_dict, f))) {
AVDictionary *filter_options = NULL;
if (strncmp(f->value, "default", 7)) { // not default
@@ -477,7 +477,7 @@ static av_cold int init(AVFilterContext *fctx)
if (!filter_options) {
av_log(ctx, AV_LOG_DEBUG, "\tusing default options\n");
} else {
- while ((o = av_dict_get(filter_options, "", o, AV_DICT_IGNORE_SUFFIX))) {
+ while ((o = av_dict_iterate(filter_options, o))) {
av_log(ctx, AV_LOG_DEBUG, "\t%s: %s\n", o->key, o->value);
}
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 10/31] avcodec/libxavs2: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (8 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 09/31] avfilter/vf_coreimage: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 11/31] avcodec/avpacket: " Marvin Scholz
` (20 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/libxavs2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 1672edfc07..c493ddc325 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -96,8 +96,8 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));
{
- AVDictionaryEntry *en = NULL;
- while ((en = av_dict_get(cae->xavs2_opts, "", en, AV_DICT_IGNORE_SUFFIX)))
+ const AVDictionaryEntry *en = NULL;
+ while ((en = av_dict_iterate(cae->xavs2_opts, en)))
xavs2_opt_set2(en->key, "%s", en->value);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 11/31] avcodec/avpacket: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (9 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 10/31] avcodec/libxavs2: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 12/31] avformat/vorbiscomment: " Marvin Scholz
` (19 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavcodec/avpacket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index bcbc4166cb..5fef65e97a 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -316,7 +316,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
const AVDictionaryEntry *t = NULL;
size_t total_length = 0;
- while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(dict, t))) {
for (int i = 0; i < 2; i++) {
const char *str = i ? t->value : t->key;
const size_t len = strlen(str) + 1;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 12/31] avformat/vorbiscomment: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (10 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 11/31] avcodec/avpacket: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 13/31] avfilter/vf_libvmaf: " Marvin Scholz
` (18 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
| 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index 13ee065a44..abe12fd586 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -45,17 +45,17 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string
len += strlen(vendor_string);
if (chapters && nb_chapters) {
for (int i = 0; i < nb_chapters; i++) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
len += 4 + 12 + 1 + 10;
- while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
len += 4 + 10 + len1 + 1 + strlen(tag->value);
}
}
}
if (m) {
- AVDictionaryEntry *tag = NULL;
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *tag = NULL;
+ while ((tag = av_dict_iterate(m, tag))) {
len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
}
}
@@ -77,9 +77,9 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
}
if (m) {
int count = av_dict_count(m) + cm_count;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
avio_wl32(pb, count);
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(m, tag))) {
int64_t len1 = strlen(tag->key);
int64_t len2 = strlen(tag->value);
if (len1+1+len2 > UINT32_MAX)
@@ -109,7 +109,7 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
avio_write(pb, chapter_time, 12);
tag = NULL;
- while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
int64_t len2 = strlen(tag->value);
if (len1+1+len2+10 > UINT32_MAX)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 13/31] avfilter/vf_libvmaf: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (11 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 12/31] avformat/vorbiscomment: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 14/31] avfilter/f_metadata: " Marvin Scholz
` (17 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/vf_libvmaf.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 8f649c5b02..2586f37d99 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -236,9 +236,9 @@ static int parse_features(AVFilterContext *ctx)
for (unsigned i = 0; i < dict_cnt; i++) {
char *feature_name = NULL;
VmafFeatureDictionary *feature_opts_dict = NULL;
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
if (av_stristr(e->key, "name")) {
feature_name = e->value;
continue;
@@ -295,11 +295,11 @@ static int parse_models(AVFilterContext *ctx)
for (unsigned i = 0; i < dict_cnt; i++) {
VmafModelConfig model_cfg = { 0 };
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
char *version = NULL;
char *path = NULL;
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
if (av_stristr(e->key, "disable_clip")) {
model_cfg.flags |= av_stristr(e->value, "true") ?
VMAF_MODEL_FLAG_DISABLE_CLIP : 0;
@@ -355,7 +355,7 @@ static int parse_models(AVFilterContext *ctx)
goto exit;
}
- while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+ while (e = av_dict_iterate(dict[i], e)) {
VmafFeatureDictionary *feature_opts_dict = NULL;
char *feature_opt = NULL;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 14/31] avfilter/f_metadata: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (12 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 13/31] avfilter/vf_libvmaf: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 15/31] avformat/cafenc: " Marvin Scholz
` (16 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavfilter/f_metadata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 82491f2bb8..4b7cfb0cb7 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -308,7 +308,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterLink *outlink = ctx->outputs[0];
MetadataContext *s = ctx->priv;
AVDictionary **metadata = &frame->metadata;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
!s->key ? AV_DICT_IGNORE_SUFFIX: 0);
@@ -339,7 +339,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%s\n",
inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
s->print(ctx, "%s=%s\n", e->key, e->value);
- while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
+ while ((e = av_dict_iterate(*metadata, e)) != NULL) {
s->print(ctx, "%s=%s\n", e->key, e->value);
}
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 15/31] avformat/cafenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (13 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 14/31] avfilter/f_metadata: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 16/31] doc/examples/metadata: " Marvin Scholz
` (15 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/cafenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index b90811d46f..b8317cd5ed 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -113,7 +113,7 @@ static int caf_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[0]->codecpar;
CAFContext *caf = s->priv_data;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, par->codec_id);
int64_t chunk_size = 0;
int frame_size = par->frame_size, sample_rate = par->sample_rate;
@@ -195,13 +195,13 @@ static int caf_write_header(AVFormatContext *s)
ff_standardize_creation_time(s);
if (av_dict_count(s->metadata)) {
ffio_wfourcc(pb, "info"); //< Information chunk
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
chunk_size += strlen(t->key) + strlen(t->value) + 2;
}
avio_wb64(pb, chunk_size + 4);
avio_wb32(pb, av_dict_count(s->metadata));
t = NULL;
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(s->metadata, t))) {
avio_put_str(pb, t->key);
avio_put_str(pb, t->value);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 16/31] doc/examples/metadata: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (14 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 15/31] avformat/cafenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 17/31] avformat/movenc: " Marvin Scholz
` (14 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
doc/examples/metadata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/examples/metadata.c b/doc/examples/metadata.c
index 7c44009a24..734b12df16 100644
--- a/doc/examples/metadata.c
+++ b/doc/examples/metadata.c
@@ -52,7 +52,7 @@ int main (int argc, char **argv)
return ret;
}
- while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(fmt_ctx->metadata, tag)))
printf("%s=%s\n", tag->key, tag->value);
avformat_close_input(&fmt_ctx);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 17/31] avformat/movenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (15 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 16/31] doc/examples/metadata: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 18/31] avformat/metadata: " Marvin Scholz
` (13 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/movenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 064b541972..7b00e65cdd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4110,7 +4110,7 @@ static int mov_write_mdta_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int64_t curpos, entry_pos;
int count = 0;
@@ -4121,7 +4121,7 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
entry_pos = avio_tell(pb);
avio_wb32(pb, 0); /* entry count */
- while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ while (t = av_dict_iterate(s->metadata, t)) {
size_t key_len = strlen(t->key);
avio_wb32(pb, key_len + 8);
ffio_wfourcc(pb, "mdta");
@@ -4139,14 +4139,14 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int count = 1; /* keys are 1-index based */
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, "ilst");
- while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ while (t = av_dict_iterate(s->metadata, t)) {
int64_t entry_pos = avio_tell(pb);
avio_wb32(pb, 0); /* size */
avio_wb32(pb, count); /* key */
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 18/31] avformat/metadata: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (16 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 17/31] avformat/movenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 19/31] avformat/flvenc: " Marvin Scholz
` (12 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/metadata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index b9b6de7972..a0258ea125 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -29,14 +29,14 @@ void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
/* TODO: use binary search to look up the two conversion tables
if the tables are getting big enough that it would matter speed wise */
const AVMetadataConv *sc, *dc;
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key;
if (d_conv == s_conv || !pm)
return;
- while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((mtag = av_dict_iterate(*pm, mtag))) {
key = mtag->key;
if (s_conv)
for (sc=s_conv; sc->native; sc++)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 19/31] avformat/flvenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (17 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 18/31] avformat/metadata: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 20/31] avformat/hls: " Marvin Scholz
` (11 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/flvenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 59be11eba8..128ae8ebc0 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -277,7 +277,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
int write_duration_filesize = !(flv->flags & FLV_NO_DURATION_FILESIZE);
int metadata_count = 0;
int64_t metadata_count_pos;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
/* write meta_tag */
avio_w8(pb, FLV_TAG_TYPE_META); // tag type META
@@ -353,7 +353,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
}
ff_standardize_creation_time(s);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
if( !strcmp(tag->key, "width")
||!strcmp(tag->key, "height")
||!strcmp(tag->key, "videodatarate")
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 20/31] avformat/hls: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (18 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 19/31] avformat/flvenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 21/31] avformat/lrcenc: " Marvin Scholz
` (10 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
And constify oldentry too while at it.
---
libavformat/hls.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 402eb2b5a0..926d053939 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1104,10 +1104,10 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb,
static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata,
ID3v2ExtraMetaAPIC *apic)
{
- AVDictionaryEntry *entry = NULL;
- AVDictionaryEntry *oldentry;
+ const AVDictionaryEntry *entry = NULL;
+ const AVDictionaryEntry *oldentry;
/* check that no keys have changed values */
- while ((entry = av_dict_get(metadata, "", entry, AV_DICT_IGNORE_SUFFIX))) {
+ while ((entry = av_dict_iterate(metadata, entry))) {
oldentry = av_dict_get(pls->id3_initial, entry->key, NULL, AV_DICT_MATCH_CASE);
if (!oldentry || strcmp(oldentry->value, entry->value) != 0)
return 1;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 21/31] avformat/lrcenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (19 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 20/31] avformat/hls: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 22/31] avformat/dump: " Marvin Scholz
` (9 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/lrcenc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c
index f7a5a6982d..2d6ca33e38 100644
--- a/libavformat/lrcenc.c
+++ b/libavformat/lrcenc.c
@@ -63,8 +63,7 @@ static int lrc_write_header(AVFormatContext *s)
av_dict_set(&s->metadata, "ve", NULL, 0);
}
for(metadata_item = NULL;
- (metadata_item = av_dict_get(s->metadata, "", metadata_item,
- AV_DICT_IGNORE_SUFFIX));) {
+ (metadata_item = av_dict_iterate(s->metadata, metadata_item));) {
char *delim;
if(!metadata_item->value[0]) {
continue;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 22/31] avformat/dump: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (20 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 21/31] avformat/lrcenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 23/31] avformat/wtvenc: " Marvin Scholz
` (8 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 225f80ac22..d31e4c2ec6 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -140,7 +140,7 @@ static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
const AVDictionaryEntry *tag = NULL;
av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
- while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(m, tag)))
if (strcmp("language", tag->key)) {
const char *p = tag->value;
av_log(ctx, AV_LOG_INFO,
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 23/31] avformat/wtvenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (21 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 22/31] avformat/dump: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 24/31] avformat/ffmetaenc: " Marvin Scholz
` (7 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/wtvenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 7e28b2082e..62dca62b06 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -670,12 +670,12 @@ static void write_table_entries_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = NULL;
ff_standardize_creation_time(s);
//FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ while ((tag = av_dict_iterate(s->metadata, tag)))
write_tag(pb, tag->key, tag->value);
if (wctx->thumbnail.size) {
@@ -698,11 +698,11 @@ static void write_table_redirector_legacy_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = NULL;
int64_t pos = 0;
//FIXME: translate special tags to binary representation
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
avio_wl64(pb, pos);
pos += metadata_header_size(tag->key) + strlen(tag->value)*2 + 2;
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 24/31] avformat/ffmetaenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (22 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 23/31] avformat/wtvenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 25/31] avformat/id3v2enc: " Marvin Scholz
` (6 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/ffmetaenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c
index edd66e1a04..f27ac1ac50 100644
--- a/libavformat/ffmetaenc.c
+++ b/libavformat/ffmetaenc.c
@@ -40,8 +40,8 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str)
static void write_tags(AVIOContext *s, AVDictionary *m)
{
- AVDictionaryEntry *t = NULL;
- while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ const AVDictionaryEntry *t = NULL;
+ while ((t = av_dict_iterate(m, t))) {
write_escape_str(s, t->key);
avio_w8(s, '=');
write_escape_str(s, t->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 25/31] avformat/id3v2enc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (23 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 24/31] avformat/ffmetaenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 26/31] avformat/nutenc: " Marvin Scholz
` (5 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/id3v2enc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
index 515d2efd7d..ac907c2758 100644
--- a/libavformat/id3v2enc.c
+++ b/libavformat/id3v2enc.c
@@ -150,7 +150,7 @@ static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext *avioc, const char *
return len + ID3v2_HEADER_SIZE;
}
-static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t,
+static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, const AVDictionaryEntry *t,
const char table[][4], enum ID3v2Encoding enc)
{
uint32_t tag;
@@ -167,13 +167,13 @@ static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictio
static void id3v2_3_metadata_split_date(AVDictionary **pm)
{
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key, *value;
char year[5] = {0}, day_month[5] = {0};
int i;
- while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((mtag = av_dict_iterate(*pm, mtag))) {
key = mtag->key;
if (!av_strcasecmp(key, "date")) {
/* split date tag using "YYYY-MM-DD" format into year and month/day segments */
@@ -220,7 +220,7 @@ void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version,
static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
ID3v2EncContext *id3, int enc)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int ret;
ff_metadata_conv(metadata, ff_id3v2_34_metadata_conv, NULL);
@@ -229,7 +229,7 @@ static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
else if (id3->version == 4)
ff_metadata_conv(metadata, ff_id3v2_4_metadata_conv, NULL);
- while ((t = av_dict_get(*metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(*metadata, t))) {
if ((ret = id3v2_check_write_tag(id3, pb, t, ff_id3v2_tags, enc)) > 0) {
id3->len += ret;
continue;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 26/31] avformat/nutenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (24 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 25/31] avformat/id3v2enc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 27/31] avformat/apetag: " Marvin Scholz
` (4 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/nutenc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 1afdeeb8ab..ff81ee34aa 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -516,7 +516,7 @@ static int add_info(AVIOContext *bc, const char *type, const char *value)
static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
{
AVFormatContext *s = nut->avf;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
int count = 0, dyn_size;
@@ -525,7 +525,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
return ret;
ff_standardize_creation_time(s);
- while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(s->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
put_v(bc, 0); //stream_if_plus1
@@ -544,7 +544,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
AVFormatContext *s= nut->avf;
AVStream* st = s->streams[stream_id];
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size, i;
@@ -552,7 +552,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
if (ret < 0)
return ret;
- while ((t = av_dict_get(st->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(st->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
for (i=0; ff_nut_dispositions[i].flag; ++i) {
if (st->disposition & ff_nut_dispositions[i].flag)
@@ -587,7 +587,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
{
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVChapter *ch = nut->avf->chapters[id];
int ret, dyn_size, count = 0;
@@ -600,7 +600,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start
put_v(bc, ch->end - ch->start); // chapter_len
- while ((t = av_dict_get(ch->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+ while ((t = av_dict_iterate(ch->metadata, t)))
count += add_info(dyn_bc, t->key, t->value);
put_v(bc, count);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 27/31] avformat/apetag: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (25 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 26/31] avformat/nutenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 28/31] avformat/asfenc: " Marvin Scholz
` (3 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/apetag.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index e861aac0f8..f2794c46f2 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -175,7 +175,7 @@ static int string_is_ascii(const uint8_t *str)
int ff_ape_write_tag(AVFormatContext *s)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int size, ret, count = 0;
AVIOContext *dyn_bc;
uint8_t *dyn_buf;
@@ -184,7 +184,7 @@ int ff_ape_write_tag(AVFormatContext *s)
return ret;
ff_standardize_creation_time(s);
- while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
+ while ((e = av_dict_iterate(s->metadata, e))) {
int val_len;
if (!string_is_ascii(e->key)) {
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 28/31] avformat/asfenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (26 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 27/31] avformat/apetag: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 29/31] avformat/http: " Marvin Scholz
` (2 subsequent siblings)
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/asfenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 70800a6df5..47240fc0a8 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -570,10 +570,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
end_header(pb, hpos);
}
if (metadata_count) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
hpos = put_header(pb, &ff_asf_extended_content_header);
avio_wl16(pb, metadata_count);
- while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+ while ((tag = av_dict_iterate(s->metadata, tag))) {
put_str16(pb, dyn_buf, tag->key);
avio_wl16(pb, 0);
put_str16(pb, dyn_buf, tag->value);
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 29/31] avformat/http: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (27 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 28/31] avformat/asfenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 30/31] avformat/matroskaenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 31/31] avformat/fifo: " Marvin Scholz
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/http.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c
index c5c48c7900..7bce821535 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1021,11 +1021,11 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
static int cookie_string(AVDictionary *dict, char **cookies)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int len = 1;
// determine how much memory is needed for the cookies string
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
len += strlen(e->key) + strlen(e->value) + 1;
// reallocate the cookies
@@ -1036,7 +1036,7 @@ static int cookie_string(AVDictionary *dict, char **cookies)
*cookies[0] = '\0';
// write out the cookies
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);
return 0;
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 30/31] avformat/matroskaenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (28 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 29/31] avformat/http: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 31/31] avformat/fifo: " Marvin Scholz
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/matroskaenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2be4f87284..2deb4284e8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2048,7 +2048,7 @@ static int mkv_write_tag(MatroskaMuxContext *mkv, const AVDictionary *m,
mkv_write_tag_targets(mkv, tmp_bc, elementid, uid);
- while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ while ((t = av_dict_iterate(m, t))) {
if (mkv_check_tag_name(t->key, elementid)) {
ret = mkv_write_simpletag(tmp_bc, t);
if (ret < 0)
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* [FFmpeg-devel] [PATCH v2 31/31] avformat/fifo: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
` (29 preceding siblings ...)
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 30/31] avformat/matroskaenc: " Marvin Scholz
@ 2022-11-26 14:46 ` Marvin Scholz
30 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-26 14:46 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marvin Scholz
---
libavformat/fifo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 7b35c9bf02..c125a97b0d 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -148,8 +148,8 @@ static int fifo_thread_write_header(FifoThreadContext *ctx)
// Check for options unrecognized by underlying muxer
if (format_options) {
- AVDictionaryEntry *entry = NULL;
- while ((entry = av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)))
+ const AVDictionaryEntry *entry = NULL;
+ while ((entry = av_dict_iterate(format_options, entry)))
av_log(avf2, AV_LOG_ERROR, "Unknown option '%s'\n", entry->key);
ret = AVERROR(EINVAL);
}
--
2.37.0 (Apple Git-136)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH 07/31] avutil: use av_dict_iterate
2022-11-26 14:42 ` Marvin Scholz
@ 2022-11-27 13:59 ` James Almer
0 siblings, 0 replies; 72+ messages in thread
From: James Almer @ 2022-11-27 13:59 UTC (permalink / raw)
To: ffmpeg-devel
On 11/26/2022 11:42 AM, Marvin Scholz wrote:
>
>
> On 25 Nov 2022, at 13:50, Andreas Rheinhardt wrote:
>
>> Marvin Scholz:
>>> ---
>>> libavutil/opt.c | 12 ++++++------
>>> libavutil/tests/dict.c | 10 +++++-----
>>> 2 files changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/libavutil/opt.c b/libavutil/opt.c
>>> index a3940f47fb..0a909a8b22 100644
>>> --- a/libavutil/opt.c
>>> +++ b/libavutil/opt.c
>>> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>>>
>>> int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
>>> {
>>> - AVDictionaryEntry *t = NULL;
>>> + const AVDictionaryEntry *t = NULL;
>>> AVDictionary *tmp = NULL;
>>> int ret;
>>>
>>> if (!options)
>>> return 0;
>>>
>>> - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
>>> + while ((t = av_dict_iterate(*options, t))) {
>>> ret = av_opt_set(obj, t->key, t->value, search_flags);
>>> if (ret == AVERROR_OPTION_NOT_FOUND)
>>> ret = av_dict_set(&tmp, t->key, t->value, 0);
>>> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>> case AV_OPT_TYPE_DICT: {
>>> AVDictionary *dict1 = NULL;
>>> AVDictionary *dict2 = *(AVDictionary **)dst;
>>> - AVDictionaryEntry *en1 = NULL;
>>> - AVDictionaryEntry *en2 = NULL;
>>> + const AVDictionaryEntry *en1 = NULL;
>>> + const AVDictionaryEntry *en2 = NULL;
>>> ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
>>> if (ret < 0) {
>>> av_dict_free(&dict1);
>>> return ret;
>>> }
>>> do {
>>> - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
>>> - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
>>> + en1 = av_dict_iterate(dict1, en1);
>>> + en2 = av_dict_iterate(dict2, en2);
>>> } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
>>> av_dict_free(&dict1);
>>> return (!en1 && !en2);
>>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>>> index d053545f4d..8c05752ea7 100644
>>> --- a/libavutil/tests/dict.c
>>> +++ b/libavutil/tests/dict.c
>>> @@ -22,8 +22,8 @@
>>>
>>> static void print_dict(const AVDictionary *m)
>>> {
>>> - AVDictionaryEntry *t = NULL;
>>> - while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
>>> + const AVDictionaryEntry *t = NULL;
>>> + while ((t = av_dict_iterate(m, t)))
>>> printf("%s %s ", t->key, t->value);
>>> printf("\n");
>>> }
>>> @@ -94,7 +94,7 @@ int main(void)
>>> if (av_dict_get(dict, NULL, NULL, 0))
>>> printf("av_dict_get() does not correctly handle NULL key.\n");
>>> e = NULL;
>>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>>> + while ((e = av_dict_iterate(dict, e)))
>>> printf("%s %s\n", e->key, e->value);
>>> av_dict_free(&dict);
>>>
>>> @@ -106,7 +106,7 @@ int main(void)
>>> printf("av_dict_set does not correctly handle NULL key\n");
>>>
>>> e = NULL;
>>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>>> + while ((e = av_dict_iterate(dict, e)))
>>> printf("'%s' '%s'\n", e->key, e->value);
>>> av_dict_free(&dict);
>>>
>>> @@ -122,7 +122,7 @@ int main(void)
>>> av_dict_set_int(&dict, "12", 1, 0);
>>> av_dict_set_int(&dict, "12", 2, AV_DICT_APPEND);
>>> e = NULL;
>>> - while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>>> + while ((e = av_dict_iterate(dict, e)))
>>> printf("%s %s\n", e->key, e->value);
>>> av_dict_free(&dict);
>>>
>>
>> This stops testing the old iterating pattern; instead it should
>> explicitly test that both patterns coincide.
>>
>
> Ok, I've removed this change for now from the pachset
> as adding tests is not really what this patchset is about.
>
> Additionally I do not fully understand how the testing works yet
> so I don't know how I could write such a test.
This specific test just prints some hardcoded lines plus the output of
av_dict_get() to stderr, and compares it with the reference in
tests/ref/fate/dict.
What could be done is to either print both the output of the
av_dict_get() and av_dict_iterate() iterations, or to compare the
returned AVDictionaryEntry on each iteration and if they differ, print a
line about it.
I can send a patch for that later.
>
>> - Andreas
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 07/31] avutil: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 07/31] avutil: " Marvin Scholz
@ 2022-11-27 15:06 ` James Almer
2022-11-30 22:06 ` Marvin Scholz
0 siblings, 1 reply; 72+ messages in thread
From: James Almer @ 2022-11-27 15:06 UTC (permalink / raw)
To: ffmpeg-devel
On 11/26/2022 11:46 AM, Marvin Scholz wrote:
> ---
> libavutil/opt.c | 12 ++++++------
> libavutil/tests/dict.c | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index a3940f47fb..0a909a8b22 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>
> int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
> {
> - AVDictionaryEntry *t = NULL;
> + const AVDictionaryEntry *t = NULL;
> AVDictionary *tmp = NULL;
> int ret;
>
> if (!options)
> return 0;
>
> - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
> + while ((t = av_dict_iterate(*options, t))) {
> ret = av_opt_set(obj, t->key, t->value, search_flags);
> if (ret == AVERROR_OPTION_NOT_FOUND)
> ret = av_dict_set(&tmp, t->key, t->value, 0);
> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
> case AV_OPT_TYPE_DICT: {
> AVDictionary *dict1 = NULL;
> AVDictionary *dict2 = *(AVDictionary **)dst;
> - AVDictionaryEntry *en1 = NULL;
> - AVDictionaryEntry *en2 = NULL;
> + const AVDictionaryEntry *en1 = NULL;
> + const AVDictionaryEntry *en2 = NULL;
> ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
> if (ret < 0) {
> av_dict_free(&dict1);
> return ret;
> }
> do {
> - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
> - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
> + en1 = av_dict_iterate(dict1, en1);
> + en2 = av_dict_iterate(dict2, en2);
> } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
> av_dict_free(&dict1);
> return (!en1 && !en2);
> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
> index d053545f4d..91567289c2 100644
> --- a/libavutil/tests/dict.c
> +++ b/libavutil/tests/dict.c
> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
> int main(void)
> {
> AVDictionary *dict = NULL;
> - AVDictionaryEntry *e;
> + const AVDictionaryEntry *e;
Spurious change? You're not touching the test otherwise.
In any case, feel free to add the following to this patch:
> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
> index d053545f4d..468391a9f3 100644
> --- a/libavutil/tests/dict.c
> +++ b/libavutil/tests/dict.c
> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
> int main(void)
> {
> AVDictionary *dict = NULL;
> - AVDictionaryEntry *e;
> + const AVDictionaryEntry *e;
> char *buffer = NULL;
>
> printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
> @@ -94,8 +94,13 @@ int main(void)
> if (av_dict_get(dict, NULL, NULL, 0))
> printf("av_dict_get() does not correctly handle NULL key.\n");
> e = NULL;
> + printf("Iterating with av_dict_get()\n");
> while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
> printf("%s %s\n", e->key, e->value);
> + e = NULL;
> + printf("Iterating with av_dict_iterate()\n");
> + while ((e = av_dict_iterate(dict, e)))
> + printf("%s %s\n", e->key, e->value);
> av_dict_free(&dict);
>
> if (av_dict_set(&dict, NULL, "a", 0) >= 0 ||
> diff --git a/tests/ref/fate/dict b/tests/ref/fate/dict
> index 7205e4c845..a519b49163 100644
> --- a/tests/ref/fate/dict
> +++ b/tests/ref/fate/dict
> @@ -30,6 +30,14 @@ ret 0
> aaa aaa bbb bbb ccc ccc \,='" \,='"
>
> Testing av_dict_set()
> +Iterating with av_dict_get()
> +a a
> +b b
> +c c
> +d d
> +e e
> +ff ff
> +Iterating with av_dict_iterate()
> a a
> b b
> c c
That should be enough to compare the output of both functions.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
@ 2022-11-30 20:18 ` James Zern
0 siblings, 0 replies; 72+ messages in thread
From: James Zern @ 2022-11-30 20:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Marvin Scholz
On Sat, Nov 26, 2022 at 6:47 AM Marvin Scholz <epirat07@gmail.com> wrote:
>
> ---
> libavcodec/libvpxenc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
lgtm.
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 667cffc200..9aa5510c28 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -900,7 +900,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;
>
> av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
> av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
> @@ -1072,7 +1072,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
>
> enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
>
> - while ((en = av_dict_get(ctx->vpx_ts_parameters, "", en, AV_DICT_IGNORE_SUFFIX))) {
> + while ((en = av_dict_iterate(ctx->vpx_ts_parameters, en))) {
> if (vpx_ts_param_parse(ctx, &enccfg, en->key, en->value, avctx->codec_id) < 0)
> av_log(avctx, AV_LOG_WARNING,
> "Error parsing option '%s = %s'.\n",
> --
> 2.37.0 (Apple Git-136)
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 07/31] avutil: use av_dict_iterate
2022-11-27 15:06 ` James Almer
@ 2022-11-30 22:06 ` Marvin Scholz
0 siblings, 0 replies; 72+ messages in thread
From: Marvin Scholz @ 2022-11-30 22:06 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 27 Nov 2022, at 16:06, James Almer wrote:
> On 11/26/2022 11:46 AM, Marvin Scholz wrote:
>> ---
>> libavutil/opt.c | 12 ++++++------
>> libavutil/tests/dict.c | 2 +-
>> 2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/libavutil/opt.c b/libavutil/opt.c
>> index a3940f47fb..0a909a8b22 100644
>> --- a/libavutil/opt.c
>> +++ b/libavutil/opt.c
>> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>> int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
>> {
>> - AVDictionaryEntry *t = NULL;
>> + const AVDictionaryEntry *t = NULL;
>> AVDictionary *tmp = NULL;
>> int ret;
>> if (!options)
>> return 0;
>> - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
>> + while ((t = av_dict_iterate(*options, t))) {
>> ret = av_opt_set(obj, t->key, t->value, search_flags);
>> if (ret == AVERROR_OPTION_NOT_FOUND)
>> ret = av_dict_set(&tmp, t->key, t->value, 0);
>> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
>> case AV_OPT_TYPE_DICT: {
>> AVDictionary *dict1 = NULL;
>> AVDictionary *dict2 = *(AVDictionary **)dst;
>> - AVDictionaryEntry *en1 = NULL;
>> - AVDictionaryEntry *en2 = NULL;
>> + const AVDictionaryEntry *en1 = NULL;
>> + const AVDictionaryEntry *en2 = NULL;
>> ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
>> if (ret < 0) {
>> av_dict_free(&dict1);
>> return ret;
>> }
>> do {
>> - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
>> - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
>> + en1 = av_dict_iterate(dict1, en1);
>> + en2 = av_dict_iterate(dict2, en2);
>> } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
>> av_dict_free(&dict1);
>> return (!en1 && !en2);
>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>> index d053545f4d..91567289c2 100644
>> --- a/libavutil/tests/dict.c
>> +++ b/libavutil/tests/dict.c
>> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
>> int main(void)
>> {
>> AVDictionary *dict = NULL;
>> - AVDictionaryEntry *e;
>> + const AVDictionaryEntry *e;
>
> Spurious change? You're not touching the test otherwise.
Oh indeed!.
>
> In any case, feel free to add the following to this patch:
>
>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>> index d053545f4d..468391a9f3 100644
>> --- a/libavutil/tests/dict.c
>> +++ b/libavutil/tests/dict.c
>> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
>> int main(void)
>> {
>> AVDictionary *dict = NULL;
>> - AVDictionaryEntry *e;
>> + const AVDictionaryEntry *e;
>> char *buffer = NULL;
>>
>> printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
>> @@ -94,8 +94,13 @@ int main(void)
>> if (av_dict_get(dict, NULL, NULL, 0))
>> printf("av_dict_get() does not correctly handle NULL key.\n");
>> e = NULL;
>> + printf("Iterating with av_dict_get()\n");
>> while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>> printf("%s %s\n", e->key, e->value);
>> + e = NULL;
>> + printf("Iterating with av_dict_iterate()\n");
>> + while ((e = av_dict_iterate(dict, e)))
>> + printf("%s %s\n", e->key, e->value);
>> av_dict_free(&dict);
>>
>> if (av_dict_set(&dict, NULL, "a", 0) >= 0 ||
>> diff --git a/tests/ref/fate/dict b/tests/ref/fate/dict
>> index 7205e4c845..a519b49163 100644
>> --- a/tests/ref/fate/dict
>> +++ b/tests/ref/fate/dict
>> @@ -30,6 +30,14 @@ ret 0
>> aaa aaa bbb bbb ccc ccc \,='" \,='"
>>
>> Testing av_dict_set()
>> +Iterating with av_dict_get()
>> +a a
>> +b b
>> +c c
>> +d d
>> +e e
>> +ff ff
>> +Iterating with av_dict_iterate()
>> a a
>> b b
>> c c
>
> That should be enough to compare the output of both functions.
I see, thanks. Do you want to apply this change to the patch
when merging saving an unnecessary round trip to the ML?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 72+ messages in thread
end of thread, other threads:[~2022-11-30 22:06 UTC | newest]
Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 1:30 [FFmpeg-devel] [PATCH 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 01/31] fftools: use av_dict_iterate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string Marvin Scholz
2022-11-25 12:48 ` Andreas Rheinhardt
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 06/31] avformat/smjpegenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 07/31] avutil: " Marvin Scholz
2022-11-25 12:50 ` Andreas Rheinhardt
2022-11-26 14:42 ` Marvin Scholz
2022-11-27 13:59 ` James Almer
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 08/31] avfilter/vf_scale: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 09/31] avfilter/vf_coreimage: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 10/31] avcodec/libxavs2: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 11/31] avcodec/avpacket: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 12/31] avformat/vorbiscomment: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 13/31] avfilter/vf_libvmaf: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 14/31] avfilter/f_metadata: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 15/31] avformat/cafenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 16/31] doc/examples/metadata: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 17/31] avformat/movenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 18/31] avformat/metadata: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 19/31] avformat/flvenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 20/31] avformat/hls: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 21/31] avformat/lrcenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 22/31] avformat/dump: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: " Marvin Scholz
2022-11-25 12:53 ` Andreas Rheinhardt
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 24/31] avformat/ffmetaenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 25/31] avformat/id3v2enc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 26/31] avformat/nutenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 27/31] avformat/apetag: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 28/31] avformat/asfenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 29/31] avformat/http: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 30/31] avformat/matroskaenc: " Marvin Scholz
2022-11-25 1:30 ` [FFmpeg-devel] [PATCH 31/31] avformat/fifo: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 00/31] Use av_dict_iterate where approproate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 01/31] fftools: use av_dict_iterate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 02/31] fftools: use av_dict_get_string Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 03/31] avcodec/librav1e: use av_dict_iterate Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 04/31] avcodec/librav1e: remove unnecessary variable Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate Marvin Scholz
2022-11-30 20:18 ` James Zern
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 06/31] avformat/smjpegenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 07/31] avutil: " Marvin Scholz
2022-11-27 15:06 ` James Almer
2022-11-30 22:06 ` Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 08/31] avfilter/vf_scale: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 09/31] avfilter/vf_coreimage: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 10/31] avcodec/libxavs2: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 11/31] avcodec/avpacket: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 12/31] avformat/vorbiscomment: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 13/31] avfilter/vf_libvmaf: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 14/31] avfilter/f_metadata: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 15/31] avformat/cafenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 16/31] doc/examples/metadata: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 17/31] avformat/movenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 18/31] avformat/metadata: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 19/31] avformat/flvenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 20/31] avformat/hls: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 21/31] avformat/lrcenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 22/31] avformat/dump: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 23/31] avformat/wtvenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 24/31] avformat/ffmetaenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 25/31] avformat/id3v2enc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 26/31] avformat/nutenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 27/31] avformat/apetag: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 28/31] avformat/asfenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 29/31] avformat/http: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 30/31] avformat/matroskaenc: " Marvin Scholz
2022-11-26 14:46 ` [FFmpeg-devel] [PATCH v2 31/31] avformat/fifo: " Marvin Scholz
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git