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
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182014-xx-xx - xxxxxxx - lavu 54.4.100 - dict.h
19 Add av_dict_set_int helper function.
20
182014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h212014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
19 Add av_strndup().22 Add av_strndup().
20 23
libavutil/dict.c+8−0
@@ -122,6 +122,14 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, · 121 unmodified lines
122 return 0;122 return 0;
123}123}
124 124
125int 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
125static int parse_key_value_pair(AVDictionary **pm, const char **buf,133static int parse_key_value_pair(AVDictionary **pm, const char **buf,
126 const char *key_val_sep, const char *pairs_sep,134 const char *key_val_sep, const char *pairs_sep,
127 int flags)135 int flags)
libavutil/dict.h+8−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
31#ifndef AVUTIL_DICT_H31#ifndef AVUTIL_DICT_H
32#define AVUTIL_DICT_H32#define AVUTIL_DICT_H
33 33
34#include <stdint.h>
35
34#include "version.h"36#include "version.h"
35 37
36/**38/**
@@ -122,6 +124,12 @@ int av_dict_count(const AVDictionary *m); · 85 unmodified lines
122 */124 */
123int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);125int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
124 126
127/**
128 * Convenience wrapper for av_dict_set that converts the value to a string
129 * and stores it.
130 */
131int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
132
125/**133/**
126 * Parse the key/value pairs list and add the parsed entries to a dictionary.134 * Parse the key/value pairs list and add the parsed entries to a dictionary.
127 *135 *
libavutil/version.h+1−1
@@ -56,7 +56,7 @@ · 55 unmodified lines
56 */56 */
57 57
58#define LIBAVUTIL_VERSION_MAJOR 5458#define LIBAVUTIL_VERSION_MAJOR 54
59#define LIBAVUTIL_VERSION_MINOR 359#define LIBAVUTIL_VERSION_MINOR 4
60#define LIBAVUTIL_VERSION_MICRO 10060#define LIBAVUTIL_VERSION_MICRO 100
61 61
62#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \62#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