This allows getting rid of the many, slightly differing, implementations of basically the same thing.
Signed-off-by: Reimar Döffinger <reimar.doeffin...@gmx.de> --- doc/APIchanges | 3 +++ libavutil/dict.c | 8 ++++++++ libavutil/dict.h | 8 ++++++++ libavutil/version.h | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index b7961ae..5613452 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2014-08-09 API changes, most recent first: +2014-xx-xx - xxxxxxx - lavu 52.95.100 - dict.h + Add av_dict_set_int helper function. + 2014-04-xx - xxxxxxx - lavr 2.1.0 - avresample.h Add avresample_convert_frame() and avresample_config(). diff --git a/libavutil/dict.c b/libavutil/dict.c index aea8910..9fdc6d6 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -122,6 +122,14 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, return 0; } +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, + int flags) +{ + char valuestr[22]; + snprintf(valuestr, sizeof(valuestr), "%"PRId64, value); + return av_dict_set(pm, key, valuestr, flags); +} + static int parse_key_value_pair(AVDictionary **pm, const char **buf, const char *key_val_sep, const char *pairs_sep, int flags) diff --git a/libavutil/dict.h b/libavutil/dict.h index 025d867..06f1621 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -31,6 +31,8 @@ #ifndef AVUTIL_DICT_H #define AVUTIL_DICT_H +#include <stdint.h> + #include "version.h" /** @@ -123,6 +125,12 @@ int av_dict_count(const AVDictionary *m); int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); /** + * Convenience wrapper for av_dict_set that converts the value to a string + * and stores it. + */ +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + +/** * Parse the key/value pairs list and add the parsed entries to a dictionary. * * In case of failure, all the successfully set entries are stored in diff --git a/libavutil/version.h b/libavutil/version.h index 23b331d..43114c7 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 1 +#define LIBAVUTIL_VERSION_MINOR 2 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.1.0.rc1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel