[FFmpeg-devel] [PATCH 158/281] tmv: convert to new channel layout API

James Almer jamrial at gmail.com
Thu Jan 13 04:00:05 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/tmv.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 507f6cd032..ea39954190 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -113,19 +113,13 @@ static int tmv_read_header(AVFormatContext *s)
 
     ast->codecpar->codec_type            = AVMEDIA_TYPE_AUDIO;
     ast->codecpar->codec_id              = AV_CODEC_ID_PCM_U8;
-    if (features & TMV_STEREO) {
-        ast->codecpar->channels       = 2;
-        ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
-    } else {
-        ast->codecpar->channels       = 1;
-        ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
-    }
+    av_channel_layout_default(&ast->codecpar->ch_layout, !!(features & TMV_STEREO) + 1);
     ast->codecpar->bits_per_coded_sample = 8;
     ast->codecpar->bit_rate              = ast->codecpar->sample_rate *
                                            ast->codecpar->bits_per_coded_sample;
     avpriv_set_pts_info(ast, 32, 1, ast->codecpar->sample_rate);
 
-    fps.num = ast->codecpar->sample_rate * ast->codecpar->channels;
+    fps.num = ast->codecpar->sample_rate * ast->codecpar->ch_layout.nb_channels;
     fps.den = tmv->audio_chunk_size;
     av_reduce(&fps.num, &fps.den, fps.num, fps.den, 0xFFFFFFFFLL);
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list