diff options
author | James Almer <jamrial@gmail.com> | 2024-07-16 20:32:40 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2024-07-18 23:27:20 -0300 |
commit | 7dabad079b783e921747de96597ea47cab244a11 (patch) | |
tree | 8a6f6e3a902ab1f9628480bdc99a5eec09fcd489 /libavformat/iamf_parse.c | |
parent | 54b8d5e201c97464625cfb6cfd851ed80976aa44 (diff) | |
download | ffmpeg-7dabad079b783e921747de96597ea47cab244a11.tar.gz |
avformat/iamf: byteswap values in OpusHeader
Clause 3.11.1 of IAMF[1] states the values are stored in big endian, in
contrast to the Ogg Encapsulation for Opus[2] where they are in little endian.
[1]https://aomediacodec.github.io/iamf/v1.0.0-errata.html#opus-specific
[2]https://datatracker.ietf.org/doc/html/rfc7845#section-5.1
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/iamf_parse.c')
-rw-r--r-- | libavformat/iamf_parse.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c index 7ad3318833..a176c7d13a 100644 --- a/libavformat/iamf_parse.c +++ b/libavformat/iamf_parse.c @@ -272,6 +272,9 @@ static int update_extradata(AVCodecParameters *codecpar) switch(codecpar->codec_id) { case AV_CODEC_ID_OPUS: AV_WB8(codecpar->extradata + 9, codecpar->ch_layout.nb_channels); + AV_WL16(codecpar->extradata + 10, AV_RB16(codecpar->extradata + 10)); // Byte swap pre-skip + AV_WL32(codecpar->extradata + 12, AV_RB32(codecpar->extradata + 12)); // Byte swap sample rate + AV_WL16(codecpar->extradata + 16, AV_RB16(codecpar->extradata + 16)); // Byte swap Output Gain break; case AV_CODEC_ID_AAC: { uint8_t buf[5]; |