diff mbox series

[FFmpeg-devel,122/281] pp_bnk: convert to new channel layout API

Message ID 20220113015806.519-4-jamrial@gmail.com
State Accepted
Commit 0b07a53170a71091586a625d351af655bd68c015
Headers show
Series New channel layout API | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

James Almer Jan. 13, 2022, 1:57 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/pp_bnk.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
index b1e1b6115e..c4172e2260 100644
--- a/libavformat/pp_bnk.c
+++ b/libavformat/pp_bnk.c
@@ -205,18 +205,12 @@  static int pp_bnk_read_header(AVFormatContext *s)
         par->codec_id               = AV_CODEC_ID_ADPCM_IMA_CUNNING;
         par->format                 = AV_SAMPLE_FMT_S16P;
 
-        if (ctx->is_music) {
-            par->channel_layout     = AV_CH_LAYOUT_STEREO;
-            par->channels           = 2;
-        } else {
-            par->channel_layout     = AV_CH_LAYOUT_MONO;
-            par->channels           = 1;
-        }
-
+        av_channel_layout_default(&par->ch_layout, ctx->is_music + 1);
         par->sample_rate            = hdr.sample_rate;
         par->bits_per_coded_sample  = 4;
         par->block_align            = 1;
-        par->bit_rate               = par->sample_rate * (int64_t)par->bits_per_coded_sample * par->channels;
+        par->bit_rate               = par->sample_rate * (int64_t)par->bits_per_coded_sample *
+                                      par->ch_layout.nb_channels;
 
         avpriv_set_pts_info(st, 64, 1, par->sample_rate);
         st->start_time              = 0;