summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2014-07-31 20:08:19 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2014-08-16 14:30:18 +0200
commitc2829dc925ffcc2a5934f3e99360a89fb0a3cad5 (patch)
tree67a20dfc78ed71ef6a54bbababaae6aa364a99b2 /libavutil
parent82e0cb360aaa87a62f731ee3dee500e98bf9d1a6 (diff)
dict.c: Add av_dict_set_int helper function.
This allows getting rid of the many, slightly differing, implementations of basically the same thing. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/dict.c8
-rw-r--r--libavutil/dict.h8
-rw-r--r--libavutil/version.h2
3 files changed, 17 insertions, 1 deletions
diff --git a/libavutil/dict.c b/libavutil/dict.c
index aea8910541..9fdc6d6273 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 025d867993..06f1621d45 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 f5b92778e2..b86609b08a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -56,7 +56,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 54
-#define LIBAVUTIL_VERSION_MINOR 3
+#define LIBAVUTIL_VERSION_MINOR 4
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \