From patchwork Tue Oct 1 10:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51960 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cb8a:0:b0:48e:c0f8:d0de with SMTP id d10csp178505vqv; Tue, 1 Oct 2024 04:01:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU48p3beFSeJzEKLaHirRpBX8O2LeKTanGhIZc5Z1k4ow6rUlVf3JBOu6Sjzvt0IN/UfmmmSTXqCuLQzoyK8rVI@gmail.com X-Google-Smtp-Source: AGHT+IEh+rLu7LwGUaPzpN/ihdk1M71OSmyqLl/8OZKDiirjrNz5psTbuYvzWIemcUWFoS9/gfQa X-Received: by 2002:a05:6402:2552:b0:5c2:609d:397e with SMTP id 4fb4d7f45d1cf-5c8825fe1eemr12710644a12.15.1727780474809; Tue, 01 Oct 2024 04:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727780474; cv=none; d=google.com; s=arc-20240605; b=cWCfDLLFymH94cGfGr/xubqhuVI3lqovNtm0Ru7jRqLAJwxn7l7fHZxyScAyiV6JUW FKbpdvEQ40+1xCHb5VD1+bsaVPa1jJDIpOhXuLa7jLcuXEydt7wBX3bkDozrF8D8wRr3 iwvfGdt/bP2Jej9mlW9FhE04hyzdw6OzK6xNPLo+OSmDwrpkHT3DE52955R+P2h7I+18 c1WsM87YK4d+WC7WxzlM5iTK5WAEY0KPEc6tj6NqKKucJsuQBSiZqOQg3SrdXEmXkcwQ kDhwsvA80rU+1P3J8hzt9pqr65LygDeT3dns+AK6/dYmY7NW9HprFzQmr3bUBVVl5w5M wtAw== 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=Xgke2hc1ATsbj9BoUTxgWxPyz+ZnZVrHK0jv6ESI6BU=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=PIoHNxbAKjnygvEOkSnDd48mzjrUpEVlmNeVPzlg2x0cW2TIL9gjtydw/Sj6wnpIA0 Dhnnji+gYxXoAJsUQvfJ6X5p9ah7bbKX3AGDvVd+7ZF2eomOXUK3xS2BMHh+ax0BtjbP Dsi+whB/wCu8PEMSE9n8QopIt15L7BO58QmDXHb8o83dRRi6q9nGfl7NrO6JqPPSMuDf aVSakDZgLscBZVrn8wDIrKH7cj2M6fksDpgY1XfNfxQS6S6WDs8zirn3lHWv/bdyA942 hdn4GugJQ64VAs31Q+W95eKjQnall8Okl/MiRjDOu/V4NRDcF/5IaMORPY94y06t/ka4 zvOw==; 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=Dtz0kbBg; 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 4fb4d7f45d1cf-5c88249000csi6955974a12.307.2024.10.01.04.01.14; Tue, 01 Oct 2024 04:01: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=Dtz0kbBg; 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 1206768DB63; Tue, 1 Oct 2024 13:54:43 +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 0639868DA91 for ; Tue, 1 Oct 2024 13:54:36 +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=Dtz0kbBg; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 664774E0C for ; Tue, 1 Oct 2024 12:54:34 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id a4t7QKDSNPch for ; Tue, 1 Oct 2024 12:54:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727780072; bh=Yu/hFvRC1INexuNpv1Md8VCneFu0+6TfXqAiTikJlto=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Dtz0kbBgOT+NySSg+e+iX6+USSCcVyAUpsS2ur13t2mQ5Q+E6EdMZCgcUIatp/ULG ciZfi9Dema2VMIZXenogZQyXRxNkJp3ibvklyxC4ttPnqn4+vGGEnClwDu3VljC3tJ JbTgZmSgGkpXmAeB6yLZxcvHxF6CTptGLSXnr+4aaT6m9EHXSyI1rz8lmyrzRE3jZ9 6dKJI7+YpQ2xMYblLFPrL6RorlMNRZab4Si+vmSPssmh1D0ZJWho+DuajEewvxDKZo xzUULxW/uymC3NbZKPQzxJGLmekoYGfPOJkHbJ+0im/8xge8ZZXPTs34KzFlnnntA5 FeUZj1TnIJy6A== 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 CEF2B4E0F for ; Tue, 1 Oct 2024 12:54:32 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 0B02A3A1E08 for ; Tue, 01 Oct 2024 12:54:26 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Oct 2024 12:54:12 +0200 Message-ID: <20241001105421.28967-7-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001105421.28967-1-anton@khirnov.net> References: <20241001105421.28967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/16] lavfi/f_ebur128: switch 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: wuLWpxDrWZTN Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/f_ebur128.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index f71c230b45..8760c74f78 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -1005,13 +1005,13 @@ static int activate(AVFilterContext *ctx) return ret; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - EBUR128Context *ebur128 = ctx->priv; + const EBUR128Context *ebur128 = ctx->priv; AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; + int out_idx = 0; int ret; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; @@ -1020,27 +1020,17 @@ static int query_formats(AVFilterContext *ctx) /* set optional output video format */ if (ebur128->do_video) { formats = ff_make_format_list(pix_fmts); - if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0) return ret; - outlink = ctx->outputs[1]; + out_idx = 1; } /* set input and output audio formats * Note: ff_set_common_* functions are not used because they affect all the * links, and thus break the video format negotiation */ formats = ff_make_format_list(sample_fmts); - if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0 || - (ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0) - return ret; - - layouts = ff_all_channel_layouts(); - if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0 || - (ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts)) < 0) - return ret; - - formats = ff_all_samplerates(); - if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0 || - (ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0 || + (ret = ff_formats_ref(formats, &cfg_out[out_idx]->formats)) < 0) return ret; return 0; @@ -1128,7 +1118,7 @@ const AVFilter ff_af_ebur128 = { .activate = activate, FILTER_INPUTS(ebur128_inputs), .outputs = NULL, - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &ebur128_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, };