[FFmpeg-devel] [PATCH 152/281] svag: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:59:59 EET 2022


From: Anton Khirnov <anton at khirnov.net>

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/svag.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/svag.c b/libavformat/svag.c
index 0774eae112..e907dc6adc 100644
--- a/libavformat/svag.c
+++ b/libavformat/svag.c
@@ -47,14 +47,16 @@ static int svag_read_header(AVFormatContext *s)
     st->codecpar->sample_rate = avio_rl32(s->pb);
     if (st->codecpar->sample_rate <= 0)
         return AVERROR_INVALIDDATA;
-    st->codecpar->channels    = avio_rl32(s->pb);
-    if (st->codecpar->channels <= 0 || st->codecpar->channels > 8)
+    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 <= 0 ||
+        st->codecpar->ch_layout.nb_channels > 8)
         return AVERROR_INVALIDDATA;
-    st->duration           = size / (16 * st->codecpar->channels) * 28;
+    st->duration           = size / (16 * st->codecpar->ch_layout.nb_channels) * 28;
     align                  = avio_rl32(s->pb);
-    if (align <= 0 || align > INT_MAX / st->codecpar->channels)
+    if (align <= 0 || align > INT_MAX / st->codecpar->ch_layout.nb_channels)
         return AVERROR_INVALIDDATA;
-    st->codecpar->block_align = align * st->codecpar->channels;
+    st->codecpar->block_align = align * st->codecpar->ch_layout.nb_channels;
     avio_skip(s->pb, 0x800 - avio_tell(s->pb));
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list