diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
commit | 58257ea29e0716a50dc742959de876606ed22416 (patch) | |
tree | a4949244816d4eb7a4231b1798b54bea4a79d4e5 /libavutil/dict.h | |
parent | 971c04066c601bdd38ed5e8eb585d2f5ba211fe2 (diff) | |
parent | bda168d2b0210dda84f1a9d32c8aa4653d1674d5 (diff) | |
download | ffmpeg-58257ea29e0716a50dc742959de876606ed22416.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
mp3enc: write a xing frame containing number of frames in the file
lavf: update AVStream.nb_frames when muxing.
ffmpeg: remove unused variables from InputStream.
doc: update ffmpeg -ar and -ac documentation to reflect reality.
ffmpeg: remove pointless if (nb_input_files)
ffmpeg: merge input_files_ts_offset into input_files.
ffmpeg: merge input_codecs into input_streams.
ffmpeg: drop AV prefixes from struct names.
ffmpeg: deprecate loop_input and loop_output options
gif: add loop private option.
img2: add loop private option.
AVOptions: in av_opt_find() don't return named constants unless unit is specified.
x11grab: replace undocumented nomouse hackery with a private option.
dict: extend documentation.
lls: whitespace cosmetics
docs: Use proper markup for a literal command line option
docs: Remove a remark that isn't relevant any longer
docs: Explain how to regenerate import libraries with MSVC tools
docs: Mention that libraries for MSVC can be built with a cross compiler
docs: Remove old docs that mention setting up a build environment with lib.exe
...
Conflicts:
doc/ffmpeg.texi
doc/general.texi
ffmpeg.c
libavcodec/Makefile
libavcodec/dnxhddata.c
libavformat/mp3enc.c
libavformat/utils.c
libavutil/Makefile
tests/copycooker.sh
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/dict.h')
-rw-r--r-- | libavutil/dict.h | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/libavutil/dict.h b/libavutil/dict.h index 3982b0dae9..84f58ec473 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -31,10 +31,42 @@ #ifndef AVUTIL_DICT_H #define AVUTIL_DICT_H +/** + * @defgroup dict_api Public Dictionary API + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + * @code + * AVDictionary *d = NULL; // "create" an empty dictionary + * av_dict_set(&d, "foo", "bar", 0); // add an entry + * + * char *k = av_strdup("key"); // if your strings are already allocated, + * char *v = av_strdup("value"); // you can avoid copying them like this + * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + * + * AVDictionaryEntry *t = NULL; + * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + * <....> // iterate over all entries in d + * } + * + * av_dict_free(&d); + * @endcode + * + * @} + */ + #define AV_DICT_MATCH_CASE 1 #define AV_DICT_IGNORE_SUFFIX 2 -#define AV_DICT_DONT_STRDUP_KEY 4 -#define AV_DICT_DONT_STRDUP_VAL 8 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() and children. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() and chilren. */ #define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ @@ -80,7 +112,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); /** - * Free all the memory allocated for an AVDictionary struct. + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. */ void av_dict_free(AVDictionary **m); |