mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/vorbiscomment: use av_dict_iterate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
aa4edbb633
commit
734acfde4c
|
@ -45,17 +45,17 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string
|
||||||
len += strlen(vendor_string);
|
len += strlen(vendor_string);
|
||||||
if (chapters && nb_chapters) {
|
if (chapters && nb_chapters) {
|
||||||
for (int i = 0; i < nb_chapters; i++) {
|
for (int i = 0; i < nb_chapters; i++) {
|
||||||
AVDictionaryEntry *tag = NULL;
|
const AVDictionaryEntry *tag = NULL;
|
||||||
len += 4 + 12 + 1 + 10;
|
len += 4 + 12 + 1 + 10;
|
||||||
while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
|
||||||
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
|
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
|
||||||
len += 4 + 10 + len1 + 1 + strlen(tag->value);
|
len += 4 + 10 + len1 + 1 + strlen(tag->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m) {
|
if (m) {
|
||||||
AVDictionaryEntry *tag = NULL;
|
const AVDictionaryEntry *tag = NULL;
|
||||||
while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
while ((tag = av_dict_iterate(m, tag))) {
|
||||||
len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
|
len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,9 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
|
||||||
}
|
}
|
||||||
if (m) {
|
if (m) {
|
||||||
int count = av_dict_count(m) + cm_count;
|
int count = av_dict_count(m) + cm_count;
|
||||||
AVDictionaryEntry *tag = NULL;
|
const AVDictionaryEntry *tag = NULL;
|
||||||
avio_wl32(pb, count);
|
avio_wl32(pb, count);
|
||||||
while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
while ((tag = av_dict_iterate(m, tag))) {
|
||||||
int64_t len1 = strlen(tag->key);
|
int64_t len1 = strlen(tag->key);
|
||||||
int64_t len2 = strlen(tag->value);
|
int64_t len2 = strlen(tag->value);
|
||||||
if (len1+1+len2 > UINT32_MAX)
|
if (len1+1+len2 > UINT32_MAX)
|
||||||
|
@ -109,7 +109,7 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
|
||||||
avio_write(pb, chapter_time, 12);
|
avio_write(pb, chapter_time, 12);
|
||||||
|
|
||||||
tag = NULL;
|
tag = NULL;
|
||||||
while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
|
||||||
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
|
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
|
||||||
int64_t len2 = strlen(tag->value);
|
int64_t len2 = strlen(tag->value);
|
||||||
if (len1+1+len2+10 > UINT32_MAX)
|
if (len1+1+len2+10 > UINT32_MAX)
|
||||||
|
|
Loading…
Reference in New Issue