diff mbox series

[FFmpeg-devel,111/281] nistspheredec: convert to new channel layout API

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

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

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

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

Patch

diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index b606ce72aa..43b7d9bc47 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -80,7 +80,8 @@  static int nist_read_header(AVFormatContext *s)
 
             avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 
-            st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;
+            st->codecpar->block_align = st->codecpar->bits_per_coded_sample *
+                                        st->codecpar->ch_layout.nb_channels / 8;
 
             if (avio_tell(s->pb) > header_size)
                 return AVERROR_INVALIDDATA;
@@ -89,8 +90,9 @@  static int nist_read_header(AVFormatContext *s)
 
             return 0;
         } else if (!memcmp(buffer, "channel_count", 13)) {
-            sscanf(buffer, "%*s %*s %u", &st->codecpar->channels);
-            if (st->codecpar->channels <= 0 || st->codecpar->channels > INT16_MAX)
+            st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+            sscanf(buffer, "%*s %*s %u", &st->codecpar->ch_layout.nb_channels);
+            if (st->codecpar->ch_layout.nb_channels <= 0 || st->codecpar->ch_layout.nb_channels > INT16_MAX)
                 return AVERROR_INVALIDDATA;
         } else if (!memcmp(buffer, "sample_byte_format", 18)) {
             sscanf(buffer, "%*s %*s %31s", format);