From 2930d42c1dba1f608c1058b95ebcff3909695715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Tue, 18 Feb 2025 16:45:41 +0100 Subject: [PATCH 1/3] lavu/dict: Add info: namespace and AV_DICT_COPY_INFO The intent is to enable demuxers to provide informative metadata that is not to be copied to muxers --- libavutil/dict.c | 3 +++ libavutil/dict.h | 1 + 2 files changed, 4 insertions(+) diff --git a/libavutil/dict.c b/libavutil/dict.c index 6fb09399ba..067107b7cd 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -239,9 +239,12 @@ int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags) const AVDictionaryEntry *t = NULL; while ((t = av_dict_iterate(src, t))) { + // do not copy info: keys unless explicitly told to do so + if ((flags & AV_DICT_COPY_INFO) || strncmp(t->key, "info:", 5)) { int ret = av_dict_set(dst, t->key, t->value, flags); if (ret < 0) return ret; + } } return 0; diff --git a/libavutil/dict.h b/libavutil/dict.h index 713c9e361a..5012374d26 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -82,6 +82,7 @@ #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ #define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */ +#define AV_DICT_COPY_INFO 128 /**< In av_dict_copy(), also copy info: keys */ /** * @} */ -- 2.39.5