[FFmpeg-devel] [PATCH 1/4] av_dict_set: add fag to allow NULL values

Stefano Sabatini stefasab at gmail.com
Sun Jul 21 13:09:49 CEST 2013


What about:
lavu/dict: add flags to allow NULL values for av_dict_set()

On date Saturday 2013-07-20 18:55:02 +0200, Michael Niedermayer encoded:
> 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 */

_NULL_VAL?

Also, what happens in case the value is NULL?
-- 
FFmpeg = Furious and Fostering Mean Problematic Elaborated Gladiator


More information about the ffmpeg-devel mailing list