From patchwork Fri Dec 6 10:17:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 16627 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 19BA944ABC2 for ; Fri, 6 Dec 2019 12:19:12 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F3E8968B682; Fri, 6 Dec 2019 12:19:11 +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 D89E468B65C for ; Fri, 6 Dec 2019 12:19:10 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 9153F2945B5 for ; Fri, 6 Dec 2019 11:19:10 +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 JMq4BKL6imiT for ; Fri, 6 Dec 2019 11:19:10 +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 455F22945B4 for ; Fri, 6 Dec 2019 11:19:10 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 7EDA87F85D for ; Fri, 6 Dec 2019 11:19:08 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id g4hcsFUpFUzT for ; Fri, 6 Dec 2019 11:19:07 +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 BA4887F993 for ; Fri, 6 Dec 2019 11:18:47 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id B92CC20E0166; Fri, 6 Dec 2019 11:17:49 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Dec 2019 11:17:08 +0100 Message-Id: <20191206101710.22028-14-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 014/244] ads: 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" --- libavformat/ads.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/ads.c b/libavformat/ads.c index f25141b3c6..20be40f499 100644 --- a/libavformat/ads.c +++ b/libavformat/ads.c @@ -47,11 +47,12 @@ static int ads_read_header(AVFormatContext *s) st->codecpar->sample_rate = avio_rl32(s->pb); if (st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; - st->codecpar->channels = avio_rl32(s->pb); - if (st->codecpar->channels <= 0) + st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb); + if (st->codecpar->ch_layout.nb_channels <= 0) return AVERROR_INVALIDDATA; align = avio_rl32(s->pb); - if (align <= 0 || align > INT_MAX / st->codecpar->channels) + if (align <= 0 || align > INT_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (codec == 1) @@ -59,11 +60,11 @@ static int ads_read_header(AVFormatContext *s) else st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; - st->codecpar->block_align = st->codecpar->channels * align; + st->codecpar->block_align = st->codecpar->ch_layout.nb_channels * align; avio_skip(s->pb, 12); size = avio_rl32(s->pb); if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX) - st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28; + st->duration = (size - 0x40) / 16 / st->codecpar->ch_layout.nb_channels * 28; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0;