Commit d49af2ac59 for ffmpeg
commit d49af2ac596dfd69d936d6e2b644694a26cdf3c6
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Thu Nov 5 10:16:29 2026 -0600
avformat/vorbis/comment: name the functions after their path
The functions take the ff_vorbis_comment_ prefix of vorbis/comment, with the reader named ff_vorbis_comment_read().
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index a07c8bacba..e3c2229e40 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -201,7 +201,7 @@ static int flac_read_header(AVFormatContext *s)
if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
AVDictionaryEntry *chmask;
- ret = ff_vorbis_comment(s, &s->metadata, buffer, metadata_size, 1);
+ ret = ff_vorbis_comment_read(s, &s->metadata, buffer, metadata_size, 1);
if (ret < 0) {
av_log(s, AV_LOG_WARNING, "error parsing VorbisComment metadata\n");
} else if (ret > 0) {
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b9e6f6d32a..8f6bda1b04 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -66,9 +66,9 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
int len;
- ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
+ ff_metadata_conv(m, ff_vorbis_comment_metadata_conv, NULL);
- len = ff_vorbiscomment_length(*m, vendor, NULL, 0);
+ len = ff_vorbis_comment_length(*m, vendor, NULL, 0);
if (len < 0)
return len;
if (len >= ((1<<24) - 4))
@@ -76,7 +76,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
avio_w8(pb, last_block ? 0x84 : 0x04);
avio_wb24(pb, len);
- ff_vorbiscomment_write(pb, *m, vendor, NULL, 0);
+ ff_vorbis_comment_write(pb, *m, vendor, NULL, 0);
return 0;
}
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2aa4f83e78..0963962797 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2183,7 +2183,7 @@ static int matroska_parse_flac(AVFormatContext *s,
AVDictionary *dict = NULL;
AVDictionaryEntry *chmask;
- ff_vorbis_comment(s, &dict, p, block_size, 0);
+ ff_vorbis_comment_read(s, &dict, p, block_size, 0);
chmask = av_dict_get(dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
if (chmask) {
uint64_t mask = strtol(chmask->value, NULL, 0);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 795c65b601..f08fee0c9a 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1097,7 +1097,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb,
snprintf(buf, sizeof(buf), "0x%"PRIx64, par->ch_layout.u.mask);
av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
- len = ff_vorbiscomment_length(dict, vendor, NULL, 0);
+ len = ff_vorbis_comment_length(dict, vendor, NULL, 0);
if (len < 0)
return len;
av_assert1(len < (1 << 24) - 4);
@@ -1105,7 +1105,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb,
avio_w8(pb, 0x84);
avio_wb24(pb, len);
- ff_vorbiscomment_write(pb, dict, vendor, NULL, 0);
+ ff_vorbis_comment_write(pb, dict, vendor, NULL, 0);
av_dict_free(&dict);
}
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index b38da89236..da57c7bafc 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -305,9 +305,9 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
int64_t size;
uint8_t *p;
- ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
+ ff_metadata_conv(m, ff_vorbis_comment_metadata_conv, NULL);
- size = ff_vorbiscomment_length(*m, vendor, chapters, nb_chapters);
+ size = ff_vorbis_comment_length(*m, vendor, chapters, nb_chapters);
if (size < 0)
return NULL;
size += offset + framing_bit;
@@ -318,7 +318,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
return NULL;
ffio_init_write_context(&pb, p + offset, size - offset);
- ff_vorbiscomment_write(&pb.pub, *m, vendor, chapters, nb_chapters);
+ ff_vorbis_comment_write(&pb.pub, *m, vendor, chapters, nb_chapters);
if (framing_bit)
avio_w8(&pb.pub, 1);
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 9926c5ebbb..0a8f965188 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -77,7 +77,7 @@ flac_header (AVFormatContext * s, int idx)
avpriv_set_pts_info(st, 64, 1, samplerate);
} else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
- ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, os->psize - 4);
+ ff_vorbis_comment_read_stream(s, st, os->buf + os->pstart + 4, os->psize - 4);
}
return 1;
diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index 371a05a2c6..d0106203b4 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -122,7 +122,7 @@ ogm_header(AVFormatContext *s, int idx)
} else if (bytestream2_peek_byte(&p) == 3) {
bytestream2_skip(&p, 7);
if (bytestream2_get_bytes_left(&p) > 1)
- ff_vorbis_stream_comment(s, st, p.buffer, bytestream2_get_bytes_left(&p) - 1);
+ ff_vorbis_comment_read_stream(s, st, p.buffer, bytestream2_get_bytes_left(&p) - 1);
}
return 1;
diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index a9ef988c45..4323dba958 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -102,7 +102,7 @@ static int opus_header(AVFormatContext *avf, int idx)
if (priv->need_comments) {
if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
return AVERROR_INVALIDDATA;
- ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
+ ff_vorbis_comment_read_stream(avf, st, packet + 8, os->psize - 8);
priv->need_comments--;
return 1;
}
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 79ec881835..e0953cc8d0 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -96,7 +96,7 @@ static int speex_header(AVFormatContext *s, int idx) {
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
} else
- ff_vorbis_stream_comment(s, st, p, os->psize);
+ ff_vorbis_comment_read_stream(s, st, p, os->psize);
spxp->seq++;
return 1;
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index c0ddbff8a3..1f39489a9e 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -118,7 +118,7 @@ static int theora_header(AVFormatContext *s, int idx)
}
break;
case 0x81:
- ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 7, os->psize - 7);
+ ff_vorbis_comment_read_stream(s, st, os->buf + os->pstart + 7, os->psize - 7);
av_fallthrough;
case 0x82:
if (!thp->version)
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index d50a8e01f7..6bfec70c13 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -131,7 +131,7 @@ int ff_vorbis_update_metadata(AVFormatContext *s, AVStream *st,
/* New metadata packet; release old data. */
av_dict_free(&st->metadata);
- ret = ff_vorbis_stream_comment(s, st, buf, size);
+ ret = ff_vorbis_comment_read_stream(s, st, buf, size);
if (ret < 0)
return ret;
diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c
index 39ab927500..b6fdf6c775 100644
--- a/libavformat/oggparsevp8.c
+++ b/libavformat/oggparsevp8.c
@@ -67,7 +67,7 @@ static int vp8_header(AVFormatContext *s, int idx)
case 0x02:
if (p[6] != 0x20)
return AVERROR_INVALIDDATA;
- ff_vorbis_stream_comment(s, st, p + 7, os->psize - 7);
+ ff_vorbis_comment_read_stream(s, st, p + 7, os->psize - 7);
break;
default:
av_log(s, AV_LOG_ERROR, "Unknown VP8 header type 0x%02X\n", p[5]);
diff --git a/libavformat/vorbis/comment.h b/libavformat/vorbis/comment.h
index 2256632348..59ac016929 100644
--- a/libavformat/vorbis/comment.h
+++ b/libavformat/vorbis/comment.h
@@ -27,20 +27,20 @@
/**
* Calculate the length in bytes of a VorbisComment. This is the minimum
- * size required by ff_vorbiscomment_write().
+ * size required by ff_vorbis_comment_write().
*
* @param m The metadata structure to be parsed. For no metadata, set to NULL.
* @param vendor_string The vendor string to be added into the VorbisComment.
* For no string, set to an empty string.
* @return The length in bytes.
*/
-int ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
- AVChapter **chapters, unsigned int nb_chapters);
+int ff_vorbis_comment_length(const AVDictionary *m, const char *vendor_string,
+ AVChapter **chapters, unsigned int nb_chapters);
/**
* Write a VorbisComment into an AVIOContext. The output size can be obtained
* in advance by passing the same chapters, AVDictionary and vendor_string to
- * ff_vorbiscomment_length()
+ * ff_vorbis_comment_length()
*
* @param pb The AVIOContext to write the output.
* @param m The metadata struct to write.
@@ -48,11 +48,11 @@ int ff_vorbiscomment_length(const 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(AVIOContext *pb, const AVDictionary *m,
- const char *vendor_string,
- AVChapter **chapters, unsigned int nb_chapters);
+int ff_vorbis_comment_write(AVIOContext *pb, const AVDictionary *m,
+ const char *vendor_string,
+ AVChapter **chapters, unsigned int nb_chapters);
-extern const AVMetadataConv ff_vorbiscomment_metadata_conv[];
+extern const AVMetadataConv ff_vorbis_comment_metadata_conv[];
/**
* Parse Vorbis comments
@@ -62,8 +62,8 @@ extern const AVMetadataConv ff_vorbiscomment_metadata_conv[];
* by a single byte (not counted in size).
* All changes will have been reverted upon return.
*/
-int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m,
- const uint8_t *buf, int size, int parse_picture);
+int ff_vorbis_comment_read(AVFormatContext *ms, AVDictionary **m,
+ const uint8_t *buf, int size, int parse_picture);
/**
* Parse Vorbis comments and add metadata to an AVStream
@@ -73,7 +73,7 @@ int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m,
* by a single byte (not counted in size).
* All changes will have been reverted upon return.
*/
-int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st,
- const uint8_t *buf, int size);
+int ff_vorbis_comment_read_stream(AVFormatContext *as, AVStream *st,
+ const uint8_t *buf, int size);
#endif /* AVFORMAT_VORBIS_COMMENT_H */
diff --git a/libavformat/vorbis/comment/reader.c b/libavformat/vorbis/comment/reader.c
index 2e7215b9a8..8c06477404 100644
--- a/libavformat/vorbis/comment/reader.c
+++ b/libavformat/vorbis/comment/reader.c
@@ -70,10 +70,10 @@ static int ogm_chapter(AVFormatContext *as, const uint8_t *key, const uint8_t *v
return 1;
}
-int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st,
- const uint8_t *buf, int size)
+int ff_vorbis_comment_read_stream(AVFormatContext *as, AVStream *st,
+ const uint8_t *buf, int size)
{
- int updates = ff_vorbis_comment(as, &st->metadata, buf, size, 1);
+ int updates = ff_vorbis_comment_read(as, &st->metadata, buf, size, 1);
if (updates > 0) {
st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
@@ -145,9 +145,9 @@ end:
return 0;
}
-int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
- const uint8_t *buf, int size,
- int parse_picture)
+int ff_vorbis_comment_read(AVFormatContext *as, AVDictionary **m,
+ const uint8_t *buf, int size,
+ int parse_picture)
{
const uint8_t *p = buf;
const uint8_t *end = buf + size;
@@ -188,7 +188,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
av_log(as, AV_LOG_INFO,
"truncated comment header, %i comments not found\n", n);
- ff_metadata_conv(m, NULL, ff_vorbiscomment_metadata_conv);
+ ff_metadata_conv(m, NULL, ff_vorbis_comment_metadata_conv);
return updates;
}
diff --git a/libavformat/vorbis/comment/writer.c b/libavformat/vorbis/comment/writer.c
index c0b8f02a80..8681b30960 100644
--- a/libavformat/vorbis/comment/writer.c
+++ b/libavformat/vorbis/comment/writer.c
@@ -31,7 +31,7 @@
* from Ogg Vorbis I format specification: comment field and header specification
* http://xiph.org/vorbis/doc/v-comment.html
*/
-const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
+const AVMetadataConv ff_vorbis_comment_metadata_conv[] = {
{ "ALBUMARTIST", "album_artist" },
{ "TRACKNUMBER", "track" },
{ "DISCNUMBER", "disc" },
@@ -41,8 +41,8 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
{ 0 }
};
-int ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
- AVChapter **chapters, unsigned int nb_chapters)
+int ff_vorbis_comment_length(const AVDictionary *m, const char *vendor_string,
+ AVChapter **chapters, unsigned int nb_chapters)
{
AVIOContext *avio_buf;
int ret, len;
@@ -51,7 +51,7 @@ int ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
if (ret < 0)
return ret;
- ret = ff_vorbiscomment_write(avio_buf, m, vendor_string, chapters, nb_chapters);
+ ret = ff_vorbis_comment_write(avio_buf, m, vendor_string, chapters, nb_chapters);
len = ffio_close_null_buf(avio_buf);
if (ret < 0)
return ret;
@@ -59,9 +59,9 @@ int ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string,
return len;
}
-int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *dict,
- const char *vendor_string,
- AVChapter **chapters, unsigned int nb_chapters)
+int ff_vorbis_comment_write(AVIOContext *pb, const AVDictionary *dict,
+ const char *vendor_string,
+ AVChapter **chapters, unsigned int nb_chapters)
{
size_t vendor_string_length = strlen(vendor_string);
int cm_count = 0;