aea: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara 2017-03-31 13:25:52 +02:00 committed by James Almer
parent 5e9dd31e2d
commit 333a48d617
1 changed files with 6 additions and 5 deletions

View File

@ -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;
}