diff mbox series

[FFmpeg-devel,v4,7/7] avformat/movenc: limit ISOBMFF AC-3 mapping to bsids <=8

Message ID 20220623072408.38977-8-jeebjp@gmail.com
State New
Headers show
Series avformat/movenc: normalize on AC-3 parser usage | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Jan Ekström June 23, 2022, 7:24 a.m. UTC
From: Jan Ekström <jan.ekstrom@24i.com>

This leaves out RealAudio DolbyNet, which utilizes bsids 9 and 10,

It is not clear whether the interpreted bit rate value (divided by
2 or 4 depending on the variant), or the original bit rate value
should be utilized to receive the bit_rate_code index.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
---
 libavformat/movenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 58ba0bc545..a3e108c5af 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -375,6 +375,14 @@  static int mov_write_ac3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *trac
         return AVERROR(EINVAL);
     }
 
+    if (info->substream[0].bsid > 8) {
+        av_log(s, AV_LOG_ERROR,
+               "RealAudio AC-3/DolbyNet with bsid %d is not defined by the "
+               "ISOBMFF specification in ETSI TS 102 366!\n",
+               info->substream[0].bsid);
+        return AVERROR(EINVAL);
+    }
+
     for (unsigned int i = 0; i < FF_ARRAY_ELEMS(ff_ac3_bitrate_tab); i++) {
         if (info->data_rate == ff_ac3_bitrate_tab[i]) {
             ac3_bit_rate_code = i;