From efcde917af407a6031ecff68edd51fce7b83d104 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 26 May 2014 13:30:10 +0200 Subject: vorbiscomment: simplify API by using av_dict_count() --- libavformat/vorbiscomment.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libavformat/vorbiscomment.c') diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c index 56936d7666..ee06a57336 100644 --- a/libavformat/vorbiscomment.c +++ b/libavformat/vorbiscomment.c @@ -37,28 +37,26 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { { 0 } }; -int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, - unsigned *count) +int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string) { int len = 8; len += strlen(vendor_string); - *count = 0; if (m) { AVDictionaryEntry *tag = NULL; while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) { len += 4 +strlen(tag->key) + 1 + strlen(tag->value); - (*count)++; } } return len; } int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, - const char *vendor_string, const unsigned count) + const char *vendor_string) { bytestream_put_le32(p, strlen(vendor_string)); bytestream_put_buffer(p, vendor_string, strlen(vendor_string)); if (*m) { + int count = av_dict_count(*m); AVDictionaryEntry *tag = NULL; bytestream_put_le32(p, count); while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) { -- cgit v1.2.3