From patchwork Fri Dec 6 10:17:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 16631 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 13DEA44ABC2 for ; Fri, 6 Dec 2019 12:19:18 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ED30668B6A8; Fri, 6 Dec 2019 12:19:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 169EF68B68F for ; Fri, 6 Dec 2019 12:19:16 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id D1B072945B5 for ; Fri, 6 Dec 2019 11:19:15 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Co3FMRl4Q6gV for ; Fri, 6 Dec 2019 11:19:15 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 36D0A2945B4 for ; Fri, 6 Dec 2019 11:19:15 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id C6CCC7F85D for ; Fri, 6 Dec 2019 11:19:13 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id NmeDaXKWdKno for ; Fri, 6 Dec 2019 11:19:13 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id B886B7F979 for ; Fri, 6 Dec 2019 11:18:47 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 0023620E0173; Fri, 6 Dec 2019 11:17:49 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Dec 2019 11:17:10 +0100 Message-Id: <20191206101710.22028-16-anton@khirnov.net> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191206101710.22028-1-anton@khirnov.net> References: <20191206101710.22028-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 016/244] aea: convert to new channel layout API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Vittorio Giovara Signed-off-by: Vittorio Giovara --- libavformat/aea.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/aea.c b/libavformat/aea.c index bdeed64254..8acfbce4fc 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; }