[FFmpeg-devel] [PATCH 147/281] smjpegenc: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 03:58:04 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/smjpegdec.c | 3 ++-
 libavformat/smjpegenc.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/smjpegdec.c b/libavformat/smjpegdec.c
index dc95a822c5..d449162705 100644
--- a/libavformat/smjpegdec.c
+++ b/libavformat/smjpegdec.c
@@ -94,7 +94,8 @@ static int smjpeg_read_header(AVFormatContext *s)
             ast->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
             ast->codecpar->sample_rate = avio_rb16(pb);
             ast->codecpar->bits_per_coded_sample = avio_r8(pb);
-            ast->codecpar->channels    = avio_r8(pb);
+            ast->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+            ast->codecpar->ch_layout.nb_channels = avio_r8(pb);
             ast->codecpar->codec_tag   = avio_rl32(pb);
             ast->codecpar->codec_id    = ff_codec_get_id(ff_codec_smjpeg_audio_tags,
                                                          ast->codecpar->codec_tag);
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index ac5576fa76..8b40c09329 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -68,7 +68,7 @@ static int smjpeg_write_header(AVFormatContext *s)
             avio_wb32(pb, 8);
             avio_wb16(pb, par->sample_rate);
             avio_w8(pb, par->bits_per_coded_sample);
-            avio_w8(pb, par->channels);
+            avio_w8(pb, par->ch_layout.nb_channels);
             avio_wl32(pb, tag);
             avpriv_set_pts_info(st, 32, 1, 1000);
         } else if (par->codec_type == AVMEDIA_TYPE_VIDEO) {
-- 
2.34.1



More information about the ffmpeg-devel mailing list