Browse Source

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>
tags/n2.4
Reimar Döffinger 11 years ago
parent
commit
c2829dc925
4 changed files with 20 additions and 1 deletions
  1. +3
    -0
      doc/APIchanges
  2. +8
    -0
      libavutil/dict.c
  3. +8
    -0
      libavutil/dict.h
  4. +1
    -1
      libavutil/version.h

+ 3
- 0
doc/APIchanges View File

@@ -15,6 +15,9 @@ libavutil: 2014-08-09


API changes, most recent first: API changes, most recent first:


2014-xx-xx - xxxxxxx - lavu 54.4.100 - dict.h
Add av_dict_set_int helper function.

2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h 2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
Add av_strndup(). Add av_strndup().




+ 8
- 0
libavutil/dict.c View File

@@ -122,6 +122,14 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
return 0; 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, static int parse_key_value_pair(AVDictionary **pm, const char **buf,
const char *key_val_sep, const char *pairs_sep, const char *key_val_sep, const char *pairs_sep,
int flags) int flags)


+ 8
- 0
libavutil/dict.h View File

@@ -31,6 +31,8 @@
#ifndef AVUTIL_DICT_H #ifndef AVUTIL_DICT_H
#define AVUTIL_DICT_H #define AVUTIL_DICT_H


#include <stdint.h>

#include "version.h" #include "version.h"


/** /**
@@ -122,6 +124,12 @@ int av_dict_count(const AVDictionary *m);
*/ */
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); 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. * Parse the key/value pairs list and add the parsed entries to a dictionary.
* *


+ 1
- 1
libavutil/version.h View File

@@ -56,7 +56,7 @@
*/ */


#define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MAJOR 54
#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MINOR 4
#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_MICRO 100


#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \


Loading…
Cancel
Save