diff mbox series

[FFmpeg-devel,178/281] xvag: convert to new channel layout API

Message ID 20220113020026.590-30-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/xvag.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/xvag.c b/libavformat/xvag.c
index 994b710f8d..61f33ddaf8 100644
--- a/libavformat/xvag.c
+++ b/libavformat/xvag.c
@@ -45,6 +45,7 @@  static int xvag_read_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
 
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+    st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
 
     offset     = avio_rl32(s->pb);
     big_endian = offset > av_bswap32(offset);
@@ -52,7 +53,7 @@  static int xvag_read_header(AVFormatContext *s)
         offset                 = av_bswap32(offset);
         avio_skip(s->pb, 28);
         codec                  = avio_rb32(s->pb);
-        st->codecpar->channels = avio_rb32(s->pb);
+        st->codecpar->ch_layout.nb_channels = avio_rb32(s->pb);
         avio_skip(s->pb, 4);
         st->duration           = avio_rb32(s->pb);
         avio_skip(s->pb, 8);
@@ -60,7 +61,7 @@  static int xvag_read_header(AVFormatContext *s)
     } else {
         avio_skip(s->pb, 28);
         codec                  = avio_rl32(s->pb);
-        st->codecpar->channels = avio_rl32(s->pb);
+        st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb);
         avio_skip(s->pb, 4);
         st->duration           = avio_rl32(s->pb);
         avio_skip(s->pb, 8);
@@ -69,13 +70,14 @@  static int xvag_read_header(AVFormatContext *s)
 
     if (st->codecpar->sample_rate <= 0)
         return AVERROR_INVALIDDATA;
-    if (st->codecpar->channels <= 0 || st->codecpar->channels > FF_SANE_NB_CHANNELS)
+    if (st->codecpar->ch_layout.nb_channels <= 0 ||
+        st->codecpar->ch_layout.nb_channels > FF_SANE_NB_CHANNELS)
         return AVERROR_INVALIDDATA;
 
     switch (codec) {
     case 0x1c:
         st->codecpar->codec_id    = AV_CODEC_ID_ADPCM_PSX;
-        st->codecpar->block_align = 16 * st->codecpar->channels;
+        st->codecpar->block_align = 16 * st->codecpar->ch_layout.nb_channels;
         break;
     default:
         avpriv_request_sample(s, "codec %X", codec);