[FFmpeg-devel] [PATCH 043/281] cdxl: convert to new channel layout API

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


From: Vittorio Giovara <vittorio.giovara at gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/cdxl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index c42e0d3545..76dc1d18c9 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -171,6 +171,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (cdxl->read_chunk && audio_size) {
         if (cdxl->audio_stream_index == -1) {
+            int channels = !!(cdxl->header[1] & 0x10) + 1;
             AVStream *st = avformat_new_stream(s, NULL);
             if (!st)
                 return AVERROR(ENOMEM);
@@ -178,8 +179,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
             st->codecpar->codec_type    = AVMEDIA_TYPE_AUDIO;
             st->codecpar->codec_tag     = 0;
             st->codecpar->codec_id      = AV_CODEC_ID_PCM_S8_PLANAR;
-            st->codecpar->channels      = channels;
-            st->codecpar->channel_layout = channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+            av_channel_layout_default(&st->codecpar->ch_layout, channels);
             st->codecpar->sample_rate= cdxl->srate;
             st->start_time           = 0;
             cdxl->audio_stream_index = st->index;
-- 
2.34.1



More information about the ffmpeg-devel mailing list