[FFmpeg-devel] [PATCH 037/281] bink: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:49:59 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/bink.c  | 8 +++-----
 libavformat/binka.c | 3 ++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 6627a17e71..4f413bd986 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -186,11 +186,9 @@ static int read_header(AVFormatContext *s)
             ast->codecpar->codec_id = flags & BINK_AUD_USEDCT ?
                                    AV_CODEC_ID_BINKAUDIO_DCT : AV_CODEC_ID_BINKAUDIO_RDFT;
             if (flags & BINK_AUD_STEREO) {
-                ast->codecpar->channels       = 2;
-                ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
+                ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
             } else {
-                ast->codecpar->channels       = 1;
-                ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
+                ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
             }
             if ((ret = ff_alloc_extradata(ast->codecpar, 4)) < 0)
                 return ret;
@@ -283,7 +281,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
                (in bytes). We use this value to calculate the audio PTS */
             if (pkt->size >= 4)
                 bink->audio_pts[bink->current_track -1] +=
-                    AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codecpar->channels);
+                    AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codecpar->ch_layout.nb_channels);
             return 0;
         } else {
             avio_skip(pb, audio_size);
diff --git a/libavformat/binka.c b/libavformat/binka.c
index d4cfee0368..babd5e240a 100644
--- a/libavformat/binka.c
+++ b/libavformat/binka.c
@@ -44,7 +44,8 @@ static int binka_read_header(AVFormatContext *s)
 
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
-    st->codecpar->channels = avio_r8(pb);
+    st->codecpar->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
+    st->codecpar->ch_layout.nb_channels = avio_r8(pb);
     st->codecpar->sample_rate = avio_rl16(pb);
     st->duration = avio_rl32(pb);
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list