From patchwork Thu Jan 13 02:02:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33466 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp38208iog; Wed, 12 Jan 2022 18:35:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxY6rwmeB/OYurmWsHWE3pvHX4QGZjBJ8Wra/XTjBBCZcx4x6Ep443z2Eh9nnlZI+O0/EB7 X-Received: by 2002:a17:906:dc8c:: with SMTP id cs12mr1939546ejc.769.1642041312796; Wed, 12 Jan 2022 18:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642041312; cv=none; d=google.com; s=arc-20160816; b=ffCp0CcdPgnOplryms78ScgmpOUDJJq6GsakvCOYHPODBP5ZrR22zTxRhPLNWh/Jc/ skAs3crgQIcwZNyWXcEXT4vXwr6xbYcd9DHo/hE+eOxbFA9BNPcCLAwgaNk4oFV0GBfp NjZST7fC0U1mfhognit0F4jxZMItrxqESTK/2gRMdpDBOX/acFGWKGmd2Hlm5QY9G/J5 TTTEDeQoVYXganzfm33w+tcGfli2Dm91JGQwPiHlgBCPK4+CwbA1VAqyn+STCwbHKuj3 usn6fwwHnjh99/l1l+aa4eSDqid5sTC0iZEIdATlI2KVSEL/SQ0X2eOh2rUQhpDZoCdP mbAQ== 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=sDQ4aU3mkErBERtFk7YFI56qnIl39y/z9rMNPLLZ8CA=; b=NW2o28dpbV+sXXP28RP96ZhmkhInpUj2GOJd8V90AyV4xrqMgPafOvCYffQ5DhpQBU fBoHNFgTnEwYej6tXhzOCnDOcFAQEELK6WTC4Yes6QknktJcE7TMi4CFHphrCIHEzB4B vqZdsi1XGjlneoWDjmULWwuhRSwxNNAtHH3raLhaoiMfYuSDJPgWcZHCmXpTeKXB9Kck rWBSqvu/iQLUNf0afjWaTqOc58ksI9/l1ZEeonbUotGXToWwabwwYLgtDNPkKFyx1jad 0r/h1HdKjhiJ1qIHiISq7pVLt7FlGDirkFbTFW6IfeyWzr0FQ+OeerhdnKs4QdR7sG4b aNEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=aude5soD; 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 n26si741433ejg.794.2022.01.12.18.35.12; Wed, 12 Jan 2022 18:35:12 -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=aude5soD; 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 24EF268B63A; Thu, 13 Jan 2022 04:03:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4082068B608 for ; Thu, 13 Jan 2022 04:03:13 +0200 (EET) Received: by mail-qt1-f176.google.com with SMTP id c19so5361647qtx.3 for ; Wed, 12 Jan 2022 18:03:13 -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=bYGWFSNl/XXXJ32M76Zwk+8fqQSiGCrOr37fMLhcRkQ=; b=aude5soDkliThcXL0CuMT2hM+/5nUHqZy/OaRPqxPvtg4+lvI2MgqYQSosmCkDUNWT LLlN31O3C1Xe+a1i4y43MfO4P5Qv+d3iLdWVy0RksnjJ5toJkiLnp/uj6RNb0dKp1ZHr UTwo76JmHKc94BBA02eZGTIkv5suAm8kj4uOnV3mLWHEyj5BDBZLcqIlZoAOZsq3Of4a gIZJmUmSWtYhnkJ6tlr2SkN7ZTb0rS8Yd59COhjEeSezi5mtoQVM/ZqZcRfLTsO1v5dq iXKOKSsQ/iTYpfyd66TjLGxE/vWZnetgSJzSnCjnncwuFSO7FG3o6rd9Y5GsXy/cMAeM UVPg== 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=bYGWFSNl/XXXJ32M76Zwk+8fqQSiGCrOr37fMLhcRkQ=; b=O9v9j4G9vJWFfhxmkhKdz4O929mNwPS90L3O7MSk3wPxO6UoNw8ol/YAScSz3FI8H3 XIULkgGTINu2fwqkEqeq3JLiiegpWswHfV7HZlv8C7gK4HTVZqtl+4tYK99CeLh6ja4M BEIEUvj+zCMo7dTBsEXaHKFlE2xbOhsHTrgcoNWuK+MJ6VQIIz4fjUl+wRhRJgqnAzjZ orRLqzPw490bxuW0Vz0kOjTiHW9R4ZTDkEjhJI1ey6RW3Ekg+X0hBi7xBfD/95dn41o4 evlOyOXWGWEW6CYLPoM3KQQOva4CCZatNoqVZM/lRYarrbC/fIdQ2YPhqzqKftl7z/77 kpUA== X-Gm-Message-State: AOAM531WpCKDnjqcDK2R0aIMAXksG1BZNOQBZ47JSKLtW4LsNSY/q3Ep Mk4YGBBqEr69J2kaACNn+dzAxM00F+o= X-Received: by 2002:a05:622a:1811:: with SMTP id t17mr2032327qtc.525.1642039391784; Wed, 12 Jan 2022 18:03:11 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id v1sm1045961qtc.95.2022.01.12.18.03.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:03:11 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:02:25 -0300 Message-Id: <20220113020242.661-13-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 192/281] atrac3plus: 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: yGLPPGpyjlu6 From: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/atrac3plusdec.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c index e342f09fdb..3f0f08ee00 100644 --- a/libavcodec/atrac3plusdec.c +++ b/libavcodec/atrac3plusdec.c @@ -64,7 +64,6 @@ typedef struct ATRAC3PContext { int num_channel_blocks; ///< number of channel blocks uint8_t channel_blocks[5]; ///< channel configuration descriptor - uint64_t my_channel_layout; ///< current channel layout } ATRAC3PContext; static av_cold int atrac3p_decode_close(AVCodecContext *avctx) @@ -83,36 +82,36 @@ static av_cold int atrac3p_decode_close(AVCodecContext *avctx) static av_cold int set_channel_params(ATRAC3PContext *ctx, AVCodecContext *avctx) { + int channels = avctx->ch_layout.nb_channels; memset(ctx->channel_blocks, 0, sizeof(ctx->channel_blocks)); - switch (avctx->channels) { + av_channel_layout_uninit(&avctx->ch_layout); + switch (channels) { case 1: - if (avctx->channel_layout != AV_CH_FRONT_LEFT) - avctx->channel_layout = AV_CH_LAYOUT_MONO; - + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; ctx->num_channel_blocks = 1; ctx->channel_blocks[0] = CH_UNIT_MONO; break; case 2: - avctx->channel_layout = AV_CH_LAYOUT_STEREO; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; ctx->num_channel_blocks = 1; ctx->channel_blocks[0] = CH_UNIT_STEREO; break; case 3: - avctx->channel_layout = AV_CH_LAYOUT_SURROUND; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND; ctx->num_channel_blocks = 2; ctx->channel_blocks[0] = CH_UNIT_STEREO; ctx->channel_blocks[1] = CH_UNIT_MONO; break; case 4: - avctx->channel_layout = AV_CH_LAYOUT_4POINT0; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0; ctx->num_channel_blocks = 3; ctx->channel_blocks[0] = CH_UNIT_STEREO; ctx->channel_blocks[1] = CH_UNIT_MONO; ctx->channel_blocks[2] = CH_UNIT_MONO; break; case 6: - avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK; ctx->num_channel_blocks = 4; ctx->channel_blocks[0] = CH_UNIT_STEREO; ctx->channel_blocks[1] = CH_UNIT_MONO; @@ -120,7 +119,7 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, ctx->channel_blocks[3] = CH_UNIT_MONO; break; case 7: - avctx->channel_layout = AV_CH_LAYOUT_6POINT1_BACK; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1_BACK; ctx->num_channel_blocks = 5; ctx->channel_blocks[0] = CH_UNIT_STEREO; ctx->channel_blocks[1] = CH_UNIT_MONO; @@ -129,7 +128,7 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, ctx->channel_blocks[4] = CH_UNIT_MONO; break; case 8: - avctx->channel_layout = AV_CH_LAYOUT_7POINT1; + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1; ctx->num_channel_blocks = 5; ctx->channel_blocks[0] = CH_UNIT_STEREO; ctx->channel_blocks[1] = CH_UNIT_MONO; @@ -139,7 +138,7 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, break; default: av_log(avctx, AV_LOG_ERROR, - "Unsupported channel count: %d!\n", avctx->channels); + "Unsupported channel count: %d!\n", channels); return AVERROR_INVALIDDATA; } @@ -173,8 +172,6 @@ static av_cold int atrac3p_decode_init(AVCodecContext *avctx) if ((ret = set_channel_params(ctx, avctx)) < 0) return ret; - ctx->my_channel_layout = avctx->channel_layout; - ctx->ch_units = av_calloc(ctx->num_channel_blocks, sizeof(*ctx->ch_units)); ctx->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);