[FFmpeg-devel] [PATCH 115/281] nuv: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:56:08 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/nuv.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 5f5cc50302..2cb1df368f 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -116,10 +116,10 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst,
                     return AVERROR_INVALIDDATA;
                 }
                 ast->codecpar->bits_per_coded_sample = avio_rl32(pb);
-                ast->codecpar->channels              = avio_rl32(pb);
-                ast->codecpar->channel_layout        = 0;
-                if (ast->codecpar->channels <= 0) {
-                    av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->channels);
+                ast->codecpar->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
+                ast->codecpar->ch_layout.nb_channels = avio_rl32(pb);
+                if (ast->codecpar->ch_layout.nb_channels <= 0) {
+                    av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->ch_layout.nb_channels);
                     return AVERROR_INVALIDDATA;
                 }
 
@@ -227,8 +227,7 @@ static int nuv_header(AVFormatContext *s)
 
         ast->codecpar->codec_type            = AVMEDIA_TYPE_AUDIO;
         ast->codecpar->codec_id              = AV_CODEC_ID_PCM_S16LE;
-        ast->codecpar->channels              = 2;
-        ast->codecpar->channel_layout        = AV_CH_LAYOUT_STEREO;
+        ast->codecpar->ch_layout             = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
         ast->codecpar->sample_rate           = 44100;
         ast->codecpar->bit_rate              = 2 * 2 * 44100 * 8;
         ast->codecpar->block_align           = 2 * 2;
-- 
2.34.1



More information about the ffmpeg-devel mailing list