diff mbox series

[FFmpeg-devel,230/281] libshine: convert to new channel layout API

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

Commit Message

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

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

Patch

diff --git a/libavcodec/libshine.c b/libavcodec/libshine.c
index fbc84846ae..ee8a63d66b 100644
--- a/libavcodec/libshine.c
+++ b/libavcodec/libshine.c
@@ -44,7 +44,7 @@  static av_cold int libshine_encode_init(AVCodecContext *avctx)
 {
     SHINEContext *s = avctx->priv_data;
 
-    if (avctx->channels <= 0 || avctx->channels > 2){
+    if (avctx->ch_layout.nb_channels <= 0 || avctx->ch_layout.nb_channels > 2){
         av_log(avctx, AV_LOG_ERROR, "only mono or stereo is supported\n");
         return AVERROR(EINVAL);
     }
@@ -52,9 +52,9 @@  static av_cold int libshine_encode_init(AVCodecContext *avctx)
     shine_set_config_mpeg_defaults(&s->config.mpeg);
     if (avctx->bit_rate)
         s->config.mpeg.bitr = avctx->bit_rate / 1000;
-    s->config.mpeg.mode = avctx->channels == 2 ? STEREO : MONO;
+    s->config.mpeg.mode = avctx->ch_layout.nb_channels == 2 ? STEREO : MONO;
     s->config.wave.samplerate = avctx->sample_rate;
-    s->config.wave.channels   = avctx->channels == 2 ? PCM_STEREO : PCM_MONO;
+    s->config.wave.channels   = avctx->ch_layout.nb_channels == 2 ? PCM_STEREO : PCM_MONO;
     if (shine_check_config(s->config.wave.samplerate, s->config.mpeg.bitr) < 0) {
         av_log(avctx, AV_LOG_ERROR, "invalid configuration\n");
         return AVERROR(EINVAL);