diff mbox series

[FFmpeg-devel,040/281] boa: convert to new channel layout API

Message ID 20220113015101.4-41-jamrial@gmail.com
State New
Headers show
Series New channel layout API | expand

Commit Message

James Almer Jan. 13, 2022, 1:50 a.m. UTC
From: Anton Khirnov <anton@khirnov.net>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/boadec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/boadec.c b/libavformat/boadec.c
index 536300a895..a5104bbed0 100644
--- a/libavformat/boadec.c
+++ b/libavformat/boadec.c
@@ -55,15 +55,17 @@  static int read_header(AVFormatContext *s)
     avio_rl32(s->pb);
     avio_rl32(s->pb);
     st->codecpar->sample_rate = avio_rl32(s->pb);
-    st->codecpar->channels    = avio_rl32(s->pb);
-    if (st->codecpar->channels > FF_SANE_NB_CHANNELS || st->codecpar->channels <= 0)
+    st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+    st->codecpar->ch_layout.nb_channels    = avio_rl32(s->pb);
+    if (st->codecpar->ch_layout.nb_channels > FF_SANE_NB_CHANNELS ||
+        st->codecpar->ch_layout.order <= 0)
         return AVERROR(ENOSYS);
     ffformatcontext(s)->data_offset = data_offset = avio_rl32(s->pb);
     avio_r8(s->pb);
     st->codecpar->block_align = avio_rl32(s->pb);
     if (st->codecpar->block_align > INT_MAX / FF_SANE_NB_CHANNELS || st->codecpar->block_align <= 0)
         return AVERROR_INVALIDDATA;
-    st->codecpar->block_align *= st->codecpar->channels;
+    st->codecpar->block_align *= st->codecpar->ch_layout.nb_channels;
 
     avio_seek(s->pb, data_offset, SEEK_SET);