Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavformat/aea.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/aea.c b/libavformat/aea.c
index fc914f08fb..3e519832db 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -57,12 +57,13 @@ static int aea_read_probe(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);
 
 
@@ -71,14 +72,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.12.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to