From 333a48d6174ca7cb2ba71f248c326db93c3ff342 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Fri, 31 Mar 2017 13:25:52 +0200 Subject: [PATCH] aea: convert to new channel layout API Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- 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; }