History

dict.c: Add av_dict_set_int helper function.

This allows getting rid of the many, slightly differing, implementations of basically the same thing.

Reimar Döffinger committed 12 years ago

Commit c2829dc1 parent 82e0cb34 files · +20 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/dict.c +8 −0
  3. libavutil/dict.h +8 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2014-08-09 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2014-xx-xx - xxxxxxx - lavu 54.4.100 - dict.h
19+ Add av_dict_set_int helper function.
20+
1821 2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
1922 Add av_strndup().
2023
libavutil/dict.c+8−0
@@ -122,6 +122,14 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, · 121 unmodified lines
122122 return 0;
123123 }
124124
125+int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value,
126+ int flags)
127+{
128+ char valuestr[22];
129+ snprintf(valuestr, sizeof(valuestr), "%"PRId64, value);
130+ return av_dict_set(pm, key, valuestr, flags);
131+}
132+
125133 static int parse_key_value_pair(AVDictionary **pm, const char **buf,
126134 const char *key_val_sep, const char *pairs_sep,
127135 int flags)
libavutil/dict.h+8−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #ifndef AVUTIL_DICT_H
3232 #define AVUTIL_DICT_H
3333
34+#include <stdint.h>
35+
3436 #include "version.h"
3537
3638 /**
@@ -122,6 +124,12 @@ int av_dict_count(const AVDictionary *m); · 85 unmodified lines
122124 */
123125 int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
124126
127+/**
128+ * Convenience wrapper for av_dict_set that converts the value to a string
129+ * and stores it.
130+ */
131+int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
132+
125133 /**
126134 * Parse the key/value pairs list and add the parsed entries to a dictionary.
127135 *
libavutil/version.h+1−1
@@ -56,7 +56,7 @@ · 55 unmodified lines
5656 */
5757
5858 #define LIBAVUTIL_VERSION_MAJOR 54
59−#define LIBAVUTIL_VERSION_MINOR 3
59+#define LIBAVUTIL_VERSION_MINOR 4
6060 #define LIBAVUTIL_VERSION_MICRO 100
6161
6262 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t