[FFmpeg-devel] [PATCH 131/281] rm: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:57:48 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/rmdec.c | 6 +++---
 libavformat/rmenc.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 3a3f6aaf09..49c2645ecf 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -152,8 +152,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
         if (bytes_per_minute)
             st->codecpar->bit_rate = 8LL * bytes_per_minute / 60;
         st->codecpar->sample_rate = 8000;
-        st->codecpar->channels = 1;
-        st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
+        st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
         st->codecpar->codec_id = AV_CODEC_ID_RA_144;
         ast->deint_id = DEINT_ID_INT0;
@@ -189,7 +188,8 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
         }
         st->codecpar->sample_rate = avio_rb16(pb);
         avio_rb32(pb);
-        st->codecpar->channels = avio_rb16(pb);
+        st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+        st->codecpar->ch_layout.nb_channels = avio_rb16(pb);
         if (version == 5) {
             ast->deint_id = avio_rl32(pb);
             avio_read(pb, buf, 4);
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 1b2b0ecf38..1fba092b88 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -228,7 +228,7 @@ static int rv10_write_header(AVFormatContext *ctx,
             avio_wb32(s, 0); /* unknown */
             avio_wb16(s, stream->par->sample_rate); /* sample rate */
             avio_wb32(s, 0x10); /* unknown */
-            avio_wb16(s, stream->par->channels);
+            avio_wb16(s, stream->par->ch_layout.nb_channels);
             put_str8(s, "Int0"); /* codec name */
             if (stream->par->codec_tag) {
                 avio_w8(s, 4); /* tag length */
-- 
2.34.1



More information about the ffmpeg-devel mailing list