This adds a function to retrieve the number of entries in a dictionary and updates the places directly accessing what should be an opaque struct to use this new function instead.
Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | API changes, most recent first: |
| 15 | 15 | |
| 16 | +2012-08-08 - xxxxxxx - lavu 51.38 - dict.h | |
| 17 | + Add av_dict_count(). | |
| 18 | + | |
| 16 | 19 | 2012-08-xx - xxxxxxx - lavc 54.25 - avcodec.h |
| 17 | 20 | Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. |
| 18 | 21 | |
| @@ -316,7 +316,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data · 315 unmodified lines | ||
| 316 | 316 | |
| 317 | 317 | duration = asf->duration + PREROLL_TIME * 10000; |
| 318 | 318 | has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; |
| 319 | − metadata_count = s->metadata ? s->metadata->count : 0; | |
| 319 | + metadata_count = av_dict_count(s->metadata); | |
| 320 | 320 | |
| 321 | 321 | bit_rate = 0; |
| 322 | 322 | for(n=0;n<s->nb_streams;n++) { |
| @@ -3306,7 +3306,7 @@ static void print_fps(double d, const char *postfix){ · 3305 unmodified lines | ||
| 3306 | 3306 | |
| 3307 | 3307 | static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) |
| 3308 | 3308 | { |
| 3309 | − if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){ | |
| 3309 | + if(m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))){ | |
| 3310 | 3310 | AVDictionaryEntry *tag=NULL; |
| 3311 | 3311 | |
| 3312 | 3312 | av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); |
| @@ -23,6 +23,11 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "internal.h" |
| 24 | 24 | #include "mem.h" |
| 25 | 25 | |
| 26 | +int av_dict_count(const AVDictionary *m) | |
| 27 | +{ | |
| 28 | + return m ? m->count : 0; | |
| 29 | +} | |
| 30 | + | |
| 26 | 31 | AVDictionaryEntry * |
| 27 | 32 | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) |
| 28 | 33 | { |
| @@ -86,6 +86,14 @@ typedef struct AVDictionary AVDictionary; · 85 unmodified lines | ||
| 86 | 86 | AVDictionaryEntry * |
| 87 | 87 | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); |
| 88 | 88 | |
| 89 | +/** | |
| 90 | + * Get number of entries in dictionary. | |
| 91 | + * | |
| 92 | + * @param m dictionary | |
| 93 | + * @return number of entries in dictionary | |
| 94 | + */ | |
| 95 | +int av_dict_count(const AVDictionary *m); | |
| 96 | + | |
| 89 | 97 | /** |
| 90 | 98 | * Set the given entry in *pm, overwriting an existing entry. |
| 91 | 99 | * |
| @@ -37,8 +37,8 @@ · 36 unmodified lines | ||
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | 39 | #define LIBAVUTIL_VERSION_MAJOR 51 |
| 40 | −#define LIBAVUTIL_VERSION_MINOR 37 | |
| 41 | −#define LIBAVUTIL_VERSION_MICRO 1 | |
| 40 | +#define LIBAVUTIL_VERSION_MINOR 38 | |
| 41 | +#define LIBAVUTIL_VERSION_MICRO 0 | |
| 42 | 42 | |
| 43 | 43 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 44 | 44 | LIBAVUTIL_VERSION_MINOR, \ |