From patchwork Thu Aug 29 08:50:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:402a:b0:48e:c0f8:d0de with SMTP id ky42csp211280vqb; Thu, 29 Aug 2024 02:00:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXg2lCLW4Op2pcqx4EQTJLSt9pyuHrDQT+lnzwcL05WMbuYNCH/SPAIoEjM6mcmJCcvoEzEn9qUJKTU7Ws0t5pp@gmail.com X-Google-Smtp-Source: AGHT+IG0k9anf4IADHraYdvB9ndL+rEEaMUYiP4o/Y/ZkmCLKp7tCQCpBBOjbfeJ98DIBvasAfCg X-Received: by 2002:a05:651c:19a3:b0:2ef:c8a1:ff4 with SMTP id 38308e7fff4ca-2f6105c49a9mr18204261fa.7.1724922014630; Thu, 29 Aug 2024 02:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724922014; cv=none; d=google.com; s=arc-20240605; b=U4KySBT73B5Rs8EzOmxIrnbhDSfLrFwx0m7cDvzeXa//4bctaDhvaOXie63FMm/sW7 OHRuUt0luTmiEhtOlnTlMTAWQfP6U7vn4aezU1dSh0DMfgqGj/sLp7J6SJSJKRXkeR1d 1KO/3P9yF63PW+x3NMcRd+2GQDjsB7cxU+19tFJVHD8mzCcPCKDe1GK+VdpfOGpMmTK9 6uuULxTwQu8CE0m06lMcg368tummOoHArq/PRBDeYeWYQZu6aKQUF99q3KHDSILuczrV JDR9ImKd761SZa9jK/4xqdq5XxC+cqo9XAJ41lbOrnBEFg2G+ikEVgL/s3AaC85MNzXu JHuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=bXsRmWMjeNhrEHUSVj78tqVJmokeiNfdfuzbbrWl3PM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=X/dYNB06D9oTd5/msmQP5VpESsHbw7J+FLJSDHoon0YdODMlRqmbFivI0YB5SMbcam PnujQDzGV6suUrXxar6U3+AMnVrUwcq2ekWc5CJncOM1n59bUNOE2T678VjD/WJcQd70 K+SovS4n6X/U2HKjnRF5ogjtfw34UsnnTcfHzLjclnDZnZrTBOkDUfL28IfwswRI5W92 dyRj+iPwvd18GgbgB8A+Pa9lK195UybyTQwnt1NE58GmbjflCOHQ86KAuapKxqirKCOL U11JknSVhagGsWimijTpDF/m76c3He74gAllrblKDZzaXLj9sV0eEbT8LQLS+MQZhJyd hQIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=kAMvIQgr; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a89891f63c7si79987266b.949.2024.08.29.02.00.13; Thu, 29 Aug 2024 02:00:14 -0700 (PDT) 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=@khirnov.net header.s=mail header.b=kAMvIQgr; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DA9C668DCE7; Thu, 29 Aug 2024 11:52:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6087468DC73 for ; Thu, 29 Aug 2024 11:51:57 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=kAMvIQgr; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id E7CDC4DFC for ; Thu, 29 Aug 2024 10:51:56 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id IRlhz-NEwD-J for ; Thu, 29 Aug 2024 10:51:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1724921514; bh=w3DaWd7ZU2pGb11sBhIrvF7osxTGhuxP1267Pe4y+dI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kAMvIQgrXDPLoNtZhRMUUTXZnEMcucCK2GoNYz5240KgjFnWtuKyyQzri/VmgzXbe 8OIzZMyJjQnbOylyq/mlxZ8QFEAS0xf/X8MYZ6Bsf216pE2YHI4nP5Ck+xyx07hDFa 1ch+QpJbFVBlnzzP7HUKE6SuZLdbX4wErQHlbkgkzop9cm/ZL0tRffMZC3wxwiCVnm rz0p2L5cGpGBFrF6JzSb+5EgN7vCIgwCxtzmFjuOyhTSuAgzPXWLMUfW0xB/bNm8rm Afa1jmbci/FKAIS7RFNFgxCdjhQCo8oexHRZzZhjgfRMWMNSc9AZQj1xH9JZPBiZfo gUbWxMKvzBnYg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 94A064DFE for ; Thu, 29 Aug 2024 10:51:54 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 588F33A27C7 for ; Thu, 29 Aug 2024 10:51:48 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Aug 2024 10:50:50 +0200 Message-ID: <20240829085052.533-6-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240829085052.533-1-anton@khirnov.net> References: <20240829085052.533-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] lavfi/af_afir: convert to query_func2() 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: TlpwgdBqMFG1 Drop redundant ff_set_common_all_channel_counts() / ff_set_common_all_samplerates() calls, since those happen implicitly in generic code. --- libavfilter/af_afir.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 8ab4d544a8..c641893d4a 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -539,9 +539,11 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - AudioFIRContext *s = ctx->priv; + const AudioFIRContext *s = ctx->priv; static const enum AVSampleFormat sample_fmts[3][3] = { { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }, { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, @@ -549,32 +551,29 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - if (s->ir_format) { - ret = ff_set_common_all_channel_counts(ctx); - if (ret < 0) - return ret; - } else { + if (!s->ir_format) { AVFilterChannelLayouts *mono = NULL; AVFilterChannelLayouts *layouts = ff_all_channel_counts(); - if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0) + if ((ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts)) < 0) return ret; - if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) + if ((ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts)) < 0) return ret; ret = ff_add_channel_layout(&mono, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO); if (ret) return ret; for (int i = 1; i < ctx->nb_inputs; i++) { - if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[i]->outcfg.channel_layouts)) < 0) + if ((ret = ff_channel_layouts_ref(mono, &cfg_in[i]->channel_layouts)) < 0) return ret; } } - if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts[s->precision])) < 0) + if ((ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, + sample_fmts[s->precision])) < 0) return ret; - return ff_set_common_all_samplerates(ctx); + return 0; } static int config_output(AVFilterLink *outlink) @@ -783,7 +782,7 @@ const AVFilter ff_af_afir = { .description = NULL_IF_CONFIG_SMALL("Apply Finite Impulse Response filter with supplied coefficients in additional stream(s)."), .priv_size = sizeof(AudioFIRContext), .priv_class = &afir_class, - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), FILTER_OUTPUTS(outputs), .init = init, .activate = activate,