Commit c35207052d for ffmpeg
commit c35207052d357da2f5c0ff2a1ae32ccbefd14389
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Sun Nov 22 19:12:02 2026 -0500
avformat/ogg/muxer: name the codec header builders after their codec
Give the header builders and the Theora frame rate check the <codec>_
prefix of the other functions of their codec, as in the demuxer mappings,
so that moving them to their own files changes nothing else.
diff --git a/libavformat/ogg/muxer.c b/libavformat/ogg/muxer.c
index b0ad9f82d3..0a2a8f9519 100644
--- a/libavformat/ogg/muxer.c
+++ b/libavformat/ogg/muxer.c
@@ -349,9 +349,9 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
return p;
}
-static int ogg_build_flac_headers(AVCodecParameters *par,
- OGGStreamContext *oggstream, int bitexact,
- AVDictionary **m)
+static int flac_build_headers(AVCodecParameters *par,
+ OGGStreamContext *oggstream, int bitexact,
+ AVDictionary **m)
{
uint8_t *p;
@@ -387,9 +387,9 @@ static int ogg_build_flac_headers(AVCodecParameters *par,
static int flac_init(AVFormatContext *s, AVStream *st)
{
- int err = ogg_build_flac_headers(st->codecpar, st->priv_data,
- s->flags & AVFMT_FLAG_BITEXACT,
- &st->metadata);
+ int err = flac_build_headers(st->codecpar, st->priv_data,
+ s->flags & AVFMT_FLAG_BITEXACT,
+ &st->metadata);
if (err)
av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
return err;
@@ -403,9 +403,9 @@ static const OGGMuxerMapping flac_mapping = {
#define SPEEX_HEADER_SIZE 80
-static int ogg_build_speex_headers(AVCodecParameters *par,
- OGGStreamContext *oggstream, int bitexact,
- AVDictionary **m)
+static int speex_build_headers(AVCodecParameters *par,
+ OGGStreamContext *oggstream, int bitexact,
+ AVDictionary **m)
{
uint8_t *p;
@@ -432,9 +432,9 @@ static int ogg_build_speex_headers(AVCodecParameters *par,
static int speex_init(AVFormatContext *s, AVStream *st)
{
- int err = ogg_build_speex_headers(st->codecpar, st->priv_data,
- s->flags & AVFMT_FLAG_BITEXACT,
- &st->metadata);
+ int err = speex_build_headers(st->codecpar, st->priv_data,
+ s->flags & AVFMT_FLAG_BITEXACT,
+ &st->metadata);
if (err)
av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
return err;
@@ -447,10 +447,10 @@ static const OGGMuxerMapping speex_mapping = {
#define OPUS_HEADER_SIZE 19
-static int ogg_build_opus_headers(AVCodecParameters *par,
- OGGStreamContext *oggstream, int bitexact,
- AVDictionary **m, AVChapter **chapters,
- unsigned int nb_chapters)
+static int opus_build_headers(AVCodecParameters *par,
+ OGGStreamContext *oggstream, int bitexact,
+ AVDictionary **m, AVChapter **chapters,
+ unsigned int nb_chapters)
{
uint8_t *p;
@@ -481,9 +481,9 @@ static int opus_init(AVFormatContext *s, AVStream *st)
int err;
avpriv_set_pts_info(st, 64, 1, OPUS_TIMESTAMP_RATE);
- err = ogg_build_opus_headers(st->codecpar, oggstream,
- s->flags & AVFMT_FLAG_BITEXACT,
- &st->metadata, s->chapters, s->nb_chapters);
+ err = opus_build_headers(st->codecpar, oggstream,
+ s->flags & AVFMT_FLAG_BITEXACT,
+ &st->metadata, s->chapters, s->nb_chapters);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
return err;
@@ -502,8 +502,8 @@ static const OGGMuxerMapping opus_mapping = {
#define VP8_HEADER_SIZE 26
-static int ogg_build_vp8_headers(AVFormatContext *s, AVStream *st,
- OGGStreamContext *oggstream, int bitexact)
+static int vp8_build_headers(AVFormatContext *s, AVStream *st,
+ OGGStreamContext *oggstream, int bitexact)
{
AVCodecParameters *par = st->codecpar;
uint8_t *p;
@@ -552,8 +552,8 @@ static int ogg_build_vp8_headers(AVFormatContext *s, AVStream *st,
static int vp8_init(AVFormatContext *s, AVStream *st)
{
OGGStreamContext *oggstream = st->priv_data;
- int err = ogg_build_vp8_headers(s, st, oggstream,
- s->flags & AVFMT_FLAG_BITEXACT);
+ int err = vp8_build_headers(s, st, oggstream,
+ s->flags & AVFMT_FLAG_BITEXACT);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing VP8 headers\n");
return err;
@@ -681,7 +681,7 @@ static int theora_init(AVFormatContext *s, AVStream *st)
* Whether Theora headers set a frame rate other than the stream time base,
* which packets keep across links.
*/
-static int ogg_theora_rate_changed(const AVStream *st, const uint8_t *extradata, size_t size)
+static int theora_rate_changed(const AVStream *st, const uint8_t *extradata, size_t size)
{
const uint8_t *header[3];
int header_len[3];
@@ -699,7 +699,7 @@ static const char *theora_new_link_refused(const AVStream *st, const AVPacket *p
{
if (!new_extradata && !(pkt->flags & AV_PKT_FLAG_KEY))
return "New Theora links must start on a keyframe";
- if (new_extradata && ogg_theora_rate_changed(st, new_extradata, size))
+ if (new_extradata && theora_rate_changed(st, new_extradata, size))
return "New Theora links cannot change the frame rate";
return NULL;
}