[FFmpeg-devel] [libav-devel] [PATCH] lavu: Add av_dict_from_string()

Stefano Sabatini stefasab at gmail.com
Fri Feb 24 17:47:32 CET 2012


On date Thursday 2012-02-16 17:45:00 +0200, Andrey Utkin encoded:
> ---
>  libavutil/dict.c |   35 +++++++++++++++++++++++++++++++++++
>  libavutil/dict.h |    7 +++++++
>  2 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/libavutil/dict.c b/libavutil/dict.c
[...]
>  /**
> + * Get AVDictionary from string in format "opt1=val1,opt_i=val_i,..."
> + *
> + * @return 0 on success, otherwise an error code <0
> + */
> +int av_dict_from_string(const char *arg, AVDictionary **dict);

I suggest to put a verb in the function name:
int av_dict_make_from_string(const char *arg, AVDictionary **dict);

slightly abusing the English grammar (make is transitive), or
"create".

Also I'd find more intuitive:
int av_dict_make_from_string(AVDictionary **dict, const char *arg);
which is read as:
dict <- arg

Another possible extension would consist into makeing the function
work with a non-NULL dictionary, so that items are added in the
existing dictionary (but may be difficult to implement in case of
invalid input, since it is not clear which should be the "right"
behavior).
-- 
FFmpeg = Fantastic Fancy Magical Portentous Extreme Game


More information about the ffmpeg-devel mailing list