From patchwork Thu Sep 5 10:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp294360vqb; Thu, 5 Sep 2024 03:34:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQMf8/UIKg3EIha5e3aoXGCZXuWL1LaLsoQjEjS/MqgCR9ikX0GTQE8eheS7DO6axgo830sTG+yCSTPqfY1gkD@gmail.com X-Google-Smtp-Source: AGHT+IFYc44V4o5zQdGVz7qV94De47qZQj+7jdMR2C5CbEOk17YtH8Kmw3Xn11c+zWcplc3ug8Fl X-Received: by 2002:a17:907:3f9c:b0:a86:8b2f:49b3 with SMTP id a640c23a62f3a-a89d8848df0mr1212447566b.46.1725532463193; Thu, 05 Sep 2024 03:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725532463; cv=none; d=google.com; s=arc-20240605; b=LKMdibsv1wO3+o9K93K/0YWtB9V38l0/YcHVK3Y/gjCwMvpAoiKudat1zKUBxDlhD4 sIJ/ilqoelAdDqkDwyPVZaToyFqb2uVzSzNK5BCDKsmHi84J3c1S7ZTzqVuVKlhFRizx V5kTGJOhr11cr7RlC56ISJZI4xLRCnuX60zJhNZDAOPUarFU+FMMfjcFK/eH9luaHwxa 2sSXUTEtsWAvH8GD4ordgXAmWNwbaBwcZIN670FYNnT5RHn5CatsUxUZoNeS0YgpJm+c JnHpf0sxGxCxpVgJ7HvU20qgsx8fsRBuggydUfalHo/hIWSvA7M7X25CIDz1mQ1/4wuL nT/w== 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=ofwXJhFzKJ/93BQ4ENx4C/Ok86CntWmGhxkgE5e0nh0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=B0BOKZt/p3C/HJuonGSpaPDB7QeS7vOwiVjlkxIXFOZmV9y9um/lfHoYOSDuY0LDe0 EJI65nKCRkrvhakZElLDycXlWHzXtCOnOKLbsbGzCK5tGRxPlAiCv0VLwgVV+B58/49Z cErP6fuK/qhhTJS0SXNAHPdzgcfUCyp2SY2igtl+ejSSf7L9C49rEmRuAj28X6Qv2TV7 fiDevqUK3pJJRIZv6gKFoTWN99XH39RmcluOsLp9GXJJmGJMYQFDP6k5/Xke/Tzca7PE 1jGDKEUQQw7d5sO06WZ9qmGtr0szlpOq+8XvAuxUQpxZdO59JdL/6FDB2IIkeAOGw2Z1 GKaw==; 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=nVaUi5w2; 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-a8a7d084c59si6750166b.460.2024.09.05.03.34.22; Thu, 05 Sep 2024 03:34:23 -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=nVaUi5w2; 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 61B4768DF5C; Thu, 5 Sep 2024 13:08:12 +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 34D1868DD05 for ; Thu, 5 Sep 2024 13:07:49 +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=nVaUi5w2; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C0D144E1E for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id SwkcsDtSXg-d for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530862; bh=80FbwUS8vAfOBOHDSMyBYAGnjYvz5SA57IY9KQEjE1o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nVaUi5w2XYhyz+hVP4/H6RRORT00Xb/nMQN/OaaZndF5p1z0OmRlgpeazXd48/vzU 7swuc74PTTskpMJweZyXyQXk+m095IY4XxhH1VpzZMdvn1ccsX0f9HqoOJ1RXeZw1O iN2X7c4Da7vClyBUVyWY0iHrBawFPCIerLFkN83KfcH72dKaVJyW9/Fml0B+fuG6FV bx2ium4nC+G3AUC6pgT2L1JVaT0l2OqtbHJklksOASlCFnb/uD/teX27YnKR/5AjGn zxb+kYwrd2aLsfCVMRPAIWhFwhT4vGVdK8p1jg4XaiV36tPileZNCUXSaq+Y7AjbVl U9VDu7emDyYwA== 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 820794E0C for ; Thu, 5 Sep 2024 12:07:41 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 682193A2DB3 for ; Thu, 05 Sep 2024 12:07:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:18 +0200 Message-ID: <20240905100729.6030-14-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240905100729.6030-1-anton@khirnov.net> References: <20240905100729.6030-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/25] lavfi/af_loudnorm: 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: DGybuh2wXpf9 Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_loudnorm.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index d28c4556df..d63a713818 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -728,7 +728,9 @@ 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) { LoudNormContext *s = ctx->priv; static const int input_srate[] = {192000, -1}; @@ -736,19 +738,16 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret = ff_set_common_all_channel_counts(ctx); + int ret; + + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret < 0) return ret; - ret = ff_set_common_formats_from_list(ctx, sample_fmts); - if (ret < 0) - return ret; - - if (s->frame_type == LINEAR_MODE) { - return ff_set_common_all_samplerates(ctx); - } else { - return ff_set_common_samplerates_from_list(ctx, input_srate); + if (s->frame_type != LINEAR_MODE) { + return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, input_srate); } + return 0; } static int config_input(AVFilterLink *inlink) @@ -937,5 +936,5 @@ const AVFilter ff_af_loudnorm = { .uninit = uninit, FILTER_INPUTS(avfilter_af_loudnorm_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), };