diff mbox series

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

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

Commit Message

James Almer Jan. 13, 2022, 1:50 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/cdxl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Anton Khirnov Jan. 26, 2022, 1:53 p.m. UTC | #1
Quoting James Almer (2022-01-13 02:50:05)
> 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/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;

redundant after cba716f55e79ebb2db9627c6e3e11d6fc77ae737
diff mbox series

Patch

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;