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 042ca05f0fdc5f4d56a3e9b94bc9cd67bca9a4bc;
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: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-04-28 03:03:36 +02:00
parent ca0a38f2f7
commit 704d7c9f46
5 changed files with 10 additions and 10 deletions

View File

@ -76,7 +76,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
bytestream_put_byte(&p, last_block ? 0x84 : 0x04);
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);
av_freep(&p0);

View File

@ -643,7 +643,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb,
AV_WB24(data + 1, len);
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);

View File

@ -308,7 +308,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
p0 = p;
p += offset;
ff_vorbiscomment_write(&p, m, vendor, chapters, nb_chapters);
ff_vorbiscomment_write(&p, *m, vendor, chapters, nb_chapters);
if (framing_bit)
bytestream_put_byte(&p, 1);

View File

@ -38,7 +38,7 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
{ 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)
{
int64_t len = 8;
@ -62,7 +62,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string,
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,
AVChapter **chapters, unsigned int nb_chapters)
{
@ -74,11 +74,11 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m,
cm_count += av_dict_count(chapters[i]->metadata) + 1;
}
}
if (*m) {
int count = av_dict_count(*m) + cm_count;
if (m) {
int count = av_dict_count(m) + cm_count;
AVDictionaryEntry *tag = NULL;
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 len2 = strlen(tag->value);
if (len1+1+len2 > UINT32_MAX)

View File

@ -34,7 +34,7 @@
* For no string, set to an empty string.
* @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);
/**
@ -49,7 +49,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string,
* @param chapters The 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,
AVChapter **chapters, unsigned int nb_chapters);