diff mbox series

[FFmpeg-devel,172/281] xa: convert to new channel layout API

Message ID 20220113020026.590-24-jamrial@gmail.com
State New
Headers show
Series New channel layout API
Related show

Commit Message

James Almer Jan. 13, 2022, 2 a.m. UTC
From: Vittorio Giovara <vittorio.giovara@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/xa.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/xa.c b/libavformat/xa.c
index 762e90246a..af99c1f327 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -78,16 +78,17 @@  static int xa_read_header(AVFormatContext *s)
     avio_skip(pb, 4);       /* Skip the XA ID */
     xa->out_size            =  avio_rl32(pb);
     avio_skip(pb, 2);       /* Skip the tag */
-    st->codecpar->channels     = avio_rl16(pb);
+    st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+    st->codecpar->ch_layout.nb_channels = avio_rl16(pb);
     st->codecpar->sample_rate  = avio_rl32(pb);
     avio_skip(pb, 4);       /* Skip average byte rate */
     avio_skip(pb, 2);       /* Skip block align */
     avio_skip(pb, 2);       /* Skip bits-per-sample */
 
-    if (!st->codecpar->channels || !st->codecpar->sample_rate)
+    if (!st->codecpar->ch_layout.nb_channels || !st->codecpar->sample_rate)
         return AVERROR_INVALIDDATA;
 
-    st->codecpar->bit_rate = av_clip(15LL * st->codecpar->channels * 8 *
+    st->codecpar->bit_rate = av_clip(15LL * st->codecpar->ch_layout.nb_channels * 8 *
                                   st->codecpar->sample_rate / 28, 0, INT_MAX);
 
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
@@ -108,7 +109,7 @@  static int xa_read_packet(AVFormatContext *s,
     if (xa->sent_bytes >= xa->out_size)
         return AVERROR_EOF;
     /* 1 byte header and 14 bytes worth of samples * number channels per block */
-    packet_size = 15*st->codecpar->channels;
+    packet_size = 15*st->codecpar->ch_layout.nb_channels;
 
     ret = av_get_packet(pb, pkt, packet_size);
     if(ret < 0)