From patchwork Thu Jan 13 02:02:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33463 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp37907iog; Wed, 12 Jan 2022 18:34:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHlSWnJDoiOnrvpskTryIf8R0+yXu25wrpECjtm09GxAKRNzV806pkk8Ju8mZjZOcBcOl8 X-Received: by 2002:a05:6402:4316:: with SMTP id m22mr2391712edc.326.1642041272337; Wed, 12 Jan 2022 18:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642041272; cv=none; d=google.com; s=arc-20160816; b=oir2L5poWM+XXjQ8vTJBUvfTNsWriufQ8u8OMjfKWQBx9p8oYtleLRGMu/M+VlQuRP lG/1pYKNkVorwjT8TJs2VZLi75/7dgxvwGxwCwKd6JkQDeSh4akltvdSqRm48OdKab/c ex4zeDXnz0LkL6fv6DxvIKVyAONrf/OAyZwI8fOqjSvLzY9R2DCu6VANJ/wFQV+YpYWT oqgrJ6Y1Ee1dKdCi8onawdz/cNmf4m0Dnmk2tqAxBVL9yEGq4lvtSTBbFVbkQqqhI1EB thkOq58UCzeXsXGEhXcMXD6zjRn8bbnV9lf7ksH+pAwI+fcF5GCzdTg0huv/GyV/cBIX yE1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=f1yuCOnEJbzMuXberV2s8lslk1WBAK5HiUP+YZJWP+w=; b=dDMqmfhlfIpTyddqvEe/OY+TdBYsqqQsElGXJHEb4wTpGsEUxy1kaL1uEeXAUBggPJ Kavsqdj4PncS0EBlLg/qCZtpnoPJfW690YXDpAyICi7c77dZ7/WTvFfYYlyJJbr0Y5l0 ZXVqqfT/s81dAKokcKZfvOlSjp26UZtVFrlEeUHWccP9GISfUg4RmV33IBWBb7kf/q3j YFm0f+rjqKNJOL9Daj5G85T3x1FuxJQa7spMsy98lm4cwBWuLc/U7/5KaUi2ykxOqY9M BRIS/m1F0aYYewE5Jcuo43iKkc5xvjbUVoECroUaPLryMwQ0FJUPGfTuLwUp0bUZoXTH 10Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=F4CUV+Zk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sb11si286272ejc.141.2022.01.12.18.34.32; Wed, 12 Jan 2022 18:34:32 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=F4CUV+Zk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4CCF68B620; Thu, 13 Jan 2022 04:03:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7F4C68B5D7 for ; Thu, 13 Jan 2022 04:03:10 +0200 (EET) Received: by mail-qv1-f51.google.com with SMTP id kl12so5106011qvb.5 for ; Wed, 12 Jan 2022 18:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cYFh/SmmulOgipZsnQZflo6MVW8WYLz2/bV1qQyhgz8=; b=F4CUV+Zk60dHU/FLOyw7Etkaz4oztBHcfU8Ul5fnyu7NQZssUpRG9ZEPfAn+6FP9bI U3lC9CPdyKZyHtK3FnW8enHxmlR8qauo1pP+afZ+JO7NvPoMBPs77AWHf2vm+b1loLQ8 0SChoRZxff4nrsxL88OdK0yj5SteitRRXGHfGxmFMEYgYSgzKrM5kg9uOJhcIzHMIw8g m9EvroMNqALDuMydFDx6Sy1PL5F8cTo8OIhOym4FMy78ZEQvNsE5tzSV4WMemSHx83x8 R1vmqlgoy2k81w+VOl4o6dQ9TuRhvgrqZn9OQL3Q0wMWDn1v0WHQ+feN648Us/2L4uFz GDNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cYFh/SmmulOgipZsnQZflo6MVW8WYLz2/bV1qQyhgz8=; b=vJdlBuUPaTG84R2P0GoglPa3OxML7HITDPOTD9tRdptXPgPvoUtqi4bsctQ+M9TEtg cajOgZAmaKK5Qy61Ko0yNa9+k3VuzCt1SAhAwHJOtl1T+gyp+mT2aB7v+wOm1skwl51J BTT34Fo+aZBe2CWjTxFi0tKvwQYFAaoNjkjFqV5tdXaNw7La5I8wpLFhhKMBhwIWAnV3 2MHUkRYOGrR4Xw2CRGKWWHkn2yie27hU127oOgUtgbFxhZ9JpEC5bD4SAvXCCmyypSR/ 7F6hh0h3KYoIE/VPzYPAs6yWklaivsAQCC+WjD7Evq2fpQT+EfTR2JYYntr7IAf2idZv YHxw== X-Gm-Message-State: AOAM533Xvpp5T4ATCU+YvX8pfvGocp5Fm39lPLSKb72tQ9Scbesiyjmq NeLMq+dJstw45uO6n3AczC6Z5zJncC0= X-Received: by 2002:a05:6214:5196:: with SMTP id kl22mr2379572qvb.96.1642039389400; Wed, 12 Jan 2022 18:03:09 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id v1sm1045961qtc.95.2022.01.12.18.03.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:03:09 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:02:23 -0300 Message-Id: <20220113020242.661-11-jamrial@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113015101.4-1-jamrial@gmail.com> References: <20220113015101.4-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 190/281] atrac1: convert to new channel layout API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: y9iON1cNC+np From: Vittorio Giovara Signed-off-by: James Almer --- libavcodec/atrac1.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 228477d778..6ec96a4644 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -279,11 +279,12 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AT1Ctx *q = avctx->priv_data; + int channels = avctx->ch_layout.nb_channels; int ch, ret; GetBitContext gb; - if (buf_size < 212 * avctx->channels) { + if (buf_size < 212 * channels) { av_log(avctx, AV_LOG_ERROR, "Not enough data to decode!\n"); return AVERROR_INVALIDDATA; } @@ -293,7 +294,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (ch = 0; ch < avctx->channels; ch++) { + for (ch = 0; ch < channels; ch++) { AT1SUCtx* su = &q->SUs[ch]; init_get_bits(&gb, &buf[212 * ch], 212 * 8); @@ -335,13 +336,14 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) { AT1Ctx *q = avctx->priv_data; AVFloatDSPContext *fdsp; + int channels = avctx->ch_layout.nb_channels; int ret; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - if (avctx->channels < 1 || avctx->channels > AT1_MAX_CHANNELS) { + if (channels < 1 || channels > AT1_MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", - avctx->channels); + channels); return AVERROR(EINVAL); }