diff mbox series

[FFmpeg-devel,038/281] bit: convert to new channel layout API

Message ID 20220113015101.4-39-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: Anton Khirnov <anton@khirnov.net>

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

Patch

diff --git a/libavformat/bit.c b/libavformat/bit.c
index 380cbd37cd..c8d02c6bb8 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -63,7 +63,8 @@  static int read_header(AVFormatContext *s)
     st->codecpar->codec_id=AV_CODEC_ID_G729;
     st->codecpar->sample_rate=8000;
     st->codecpar->block_align = 16;
-    st->codecpar->channels=1;
+    st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+    st->codecpar->ch_layout.nb_channels = 1;
 
     avpriv_set_pts_info(st, 64, 1, 100);
     return 0;
@@ -124,14 +125,14 @@  static int write_header(AVFormatContext *s)
 {
     AVCodecParameters *par = s->streams[0]->codecpar;
 
-    if ((par->codec_id != AV_CODEC_ID_G729) || par->channels != 1) {
+    if ((par->codec_id != AV_CODEC_ID_G729) || par->ch_layout.nb_channels != 1) {
         av_log(s, AV_LOG_ERROR,
                "only codec g729 with 1 channel is supported by this format\n");
         return AVERROR(EINVAL);
     }
 
     par->bits_per_coded_sample = 16;
-    par->block_align = (par->bits_per_coded_sample * par->channels) >> 3;
+    par->block_align = (par->bits_per_coded_sample * par->ch_layout.nb_channels) >> 3;
 
     return 0;
 }