[FFmpeg-devel] [PATCH 019/281] aea: convert to new channel layout API
James Almer
jamrial at gmail.com
Thu Jan 13 03:49:41 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/aea.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavformat/aea.c b/libavformat/aea.c
index 14d0840cf3..f4b39e4f9e 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -62,12 +62,13 @@ static int aea_read_probe(const AVProbeData *p)
static int aea_read_header(AVFormatContext *s)
{
AVStream *st = avformat_new_stream(s, NULL);
+ int channels;
if (!st)
return AVERROR(ENOMEM);
/* Parse the amount of channels and skip to pos 2048(0x800) */
avio_skip(s->pb, 264);
- st->codecpar->channels = avio_r8(s->pb);
+ channels = avio_r8(s->pb);
avio_skip(s->pb, 1783);
@@ -76,14 +77,14 @@ static int aea_read_header(AVFormatContext *s)
st->codecpar->sample_rate = 44100;
st->codecpar->bit_rate = 292000;
- if (st->codecpar->channels != 1 && st->codecpar->channels != 2) {
- av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", st->codecpar->channels);
+ if (channels != 1 && channels != 2) {
+ av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", channels);
return AVERROR_INVALIDDATA;
}
- st->codecpar->channel_layout = (st->codecpar->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
+ av_channel_layout_default(&st->codecpar->ch_layout, channels);
- st->codecpar->block_align = AT1_SU_SIZE * st->codecpar->channels;
+ st->codecpar->block_align = AT1_SU_SIZE * st->codecpar->ch_layout.nb_channels;
return 0;
}
--
2.34.1
More information about the ffmpeg-devel
mailing list