[FFmpeg-devel] [PATCH 1/4] av_dict_set: add fag to allow NULL values
Michael Niedermayer
michaelni at gmx.at
Sat Jul 20 18:55:02 CEST 2013
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavutil/dict.c | 2 +-
libavutil/dict.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 3a0e84c..f965492 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -84,7 +84,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
} else
return AVERROR(ENOMEM);
}
- if (value) {
+ if (value || (flags & AV_DICT_ALLOW_NULLVAL)) {
if (flags & AV_DICT_DONT_STRDUP_KEY) {
m->elems[m->count].key = (char*)(intptr_t)key;
} else
diff --git a/libavutil/dict.h b/libavutil/dict.h
index 38f03a4..944d932 100644
--- a/libavutil/dict.h
+++ b/libavutil/dict.h
@@ -74,6 +74,8 @@
#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_ALLOW_NULLVAL 65536 /**< Allow keys without value */
+
typedef struct AVDictionaryEntry {
char *key;
char *value;
--
1.7.9.5
More information about the ffmpeg-devel
mailing list