Commit 704d7c9f authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary *

ff_vorbiscomment_write() used an AVDictionary ** parameter for a
dictionary whose contents ought to be written; yet this can be replaced
by AVDictionary * since commit 042ca05f;
and this in turn can be replaced by const AVDictionary * to indicate
that the dictionary isn't modified; the latter also applies to
ff_vorbiscomment_length().
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent ca0a38f2
...@@ -76,7 +76,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, ...@@ -76,7 +76,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
bytestream_put_byte(&p, last_block ? 0x84 : 0x04); bytestream_put_byte(&p, last_block ? 0x84 : 0x04);
bytestream_put_be24(&p, len); bytestream_put_be24(&p, len);
ff_vorbiscomment_write(&p, m, vendor, NULL, 0); ff_vorbiscomment_write(&p, *m, vendor, NULL, 0);
avio_write(pb, p0, len+4); avio_write(pb, p0, len+4);
av_freep(&p0); av_freep(&p0);
......
...@@ -643,7 +643,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb, ...@@ -643,7 +643,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb,
AV_WB24(data + 1, len); AV_WB24(data + 1, len);
p = data + 4; p = data + 4;
ff_vorbiscomment_write(&p, &dict, vendor, NULL, 0); ff_vorbiscomment_write(&p, dict, vendor, NULL, 0);
avio_write(pb, data, len + 4); avio_write(pb, data, len + 4);
......
...@@ -308,7 +308,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact, ...@@ -308,7 +308,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
p0 = p; p0 = p;
p += offset; p += offset;
ff_vorbiscomment_write(&p, m, vendor, chapters, nb_chapters); ff_vorbiscomment_write(&p, *m, vendor, chapters, nb_chapters);
if (framing_bit) if (framing_bit)
bytestream_put_byte(&p, 1); bytestream_put_byte(&p, 1);
......
...@@ -38,7 +38,7 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { ...@@ -38,7 +38,7 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
{ 0 } { 0 }
}; };
int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
AVChapter **chapters, unsigned int nb_chapters) AVChapter **chapters, unsigned int nb_chapters)
{ {
int64_t len = 8; int64_t len = 8;
...@@ -62,7 +62,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, ...@@ -62,7 +62,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string,
return len; return len;
} }
int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, int ff_vorbiscomment_write(uint8_t **p, const AVDictionary *m,
const char *vendor_string, const char *vendor_string,
AVChapter **chapters, unsigned int nb_chapters) AVChapter **chapters, unsigned int nb_chapters)
{ {
...@@ -74,11 +74,11 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, ...@@ -74,11 +74,11 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m,
cm_count += av_dict_count(chapters[i]->metadata) + 1; cm_count += av_dict_count(chapters[i]->metadata) + 1;
} }
} }
if (*m) { if (m) {
int count = av_dict_count(*m) + cm_count; int count = av_dict_count(m) + cm_count;
AVDictionaryEntry *tag = NULL; AVDictionaryEntry *tag = NULL;
bytestream_put_le32(p, count); bytestream_put_le32(p, count);
while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) { while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
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)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* For no string, set to an empty string. * For no string, set to an empty string.
* @return The length in bytes. * @return The length in bytes.
*/ */
int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
AVChapter **chapters, unsigned int nb_chapters); AVChapter **chapters, unsigned int nb_chapters);
/** /**
...@@ -49,7 +49,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, ...@@ -49,7 +49,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string,
* @param chapters The chapters to write. * @param chapters The chapters to write.
* @param nb_chapters The number of chapters to write. * @param nb_chapters The number of chapters to write.
*/ */
int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, int ff_vorbiscomment_write(uint8_t **p, const AVDictionary *m,
const char *vendor_string, const char *vendor_string,
AVChapter **chapters, unsigned int nb_chapters); AVChapter **chapters, unsigned int nb_chapters);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment