From patchwork Wed Sep 25 09:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51833 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9548:0:b0:48e:c0f8:d0de with SMTP id t8csp354598vqk; Wed, 25 Sep 2024 03:19:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXAUoSC4a9qlml8aNn4AVxNnrJ2/y1PlHMdA7aYkT4ZbjNuYzeweuAKfk4EQJbMRl2gNlCiPBFL1n/E5OPMkFUy@gmail.com X-Google-Smtp-Source: AGHT+IFqQTPcThHh93jX8J2BMltEMXYWr32RaFSaZJeSUPqsMlFieJgsf11reRf9qelLr7wBQUew X-Received: by 2002:a17:907:944e:b0:a86:96f5:fa81 with SMTP id a640c23a62f3a-a93a03e32c5mr221367366b.32.1727259560502; Wed, 25 Sep 2024 03:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727259560; cv=none; d=google.com; s=arc-20240605; b=ZlzHoJ5ZfEitxKzLrSz4dYDcuGf8yaWciiqd2ilFucpNCsIExkwc8gKFmgDyaBP5S/ 5eS0hR/7Ex2WboMQxEDZe1Xarpo0QzXsdEJ3PzX0wnh+aj82qheMTmisVOzstrzgU54F /6HUJFjbpBExVGdaYi7qoA2nvPt8yVsqe1YObY467UWebrnpOO/3EnsxKu91Xi1h9vLS HHd4e8QSWcB5pj+QK02M5GooFWSi+XVQhy9mH00HjBOwH3duMHqvke2G3ny6rfzR8F00 qVsBqfib832dm0gHNspy6vspXB/oAc4lau2yU8PZF8b5QoPMtW3mN+gcNqmES6bZyB+P NYFg== 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=Lx4JxF7qEfMyhObSuU8B1HT9L9JQhxQHDi2dVBPRKWk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=HaIT6qNsFE/PgIw0+aRfGqJVwLywMs+Z3z9nOIjOoesa075EWn9aCnlcs5uyZbUgLG RVR0O2mZni9U4zR2C/xEcvuuOqAHHBCeNc4/gut4CqVbt5R/SIjrfabbx8A2ZyWMStld mDujeT8bQVBPqujQBm+KyfvlVsR05Ws++P4eielTiICNIEw2MLUS+6VO74aT4gtS69ac 0CY/weuAgV5Y/hK8e5GQut9kGShtLX6QS6G1aCN5v1BYD8NULqQ00p8vbetf5RcVHtby oEwiah2sI/MLMn1//hBNQzL4Vq9WB3Www+t/Ezh9IQglQSQP4WlDJbM8qL1j7hmNANef d4zA==; 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="B/IfUkXW"; 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-a9392f2bbc4si212345266b.69.2024.09.25.03.19.20; Wed, 25 Sep 2024 03:19:20 -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="B/IfUkXW"; 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 A092B68DC7C; Wed, 25 Sep 2024 12:40:08 +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 4D79368DB2B for ; Wed, 25 Sep 2024 12:39:48 +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=B/IfUkXW; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 6B2824E27 for ; Wed, 25 Sep 2024 11:39:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id V5CooFuxUDgR for ; Wed, 25 Sep 2024 11:39:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727257180; bh=pr1EuiyMDTxPQ7LCYZCnRIRPVao8+lEX3/RuaKXJ1pI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B/IfUkXWimVJ1j86mPGH25MIYVnqUvV8Nk3CyuW+pyc8botEotnxPXr0znTbnqWcm oVsBeSb2XHoCqJm98jKIPeHfr52PtU12qtXz7zVIVyc2tDNsi04DWEgOYyAKpElk7K BwRfGT99TYxsY1BKlY51x3qt8J+1BnKWMz309QtbxphIDY5kqxRAzwJsfQuPUTaUmL fTAxxuIXvoFa7r13Np8d+TQ1OOEfDdJhgZYIQ2PenO0cnbDfmtc0at8FecFZPTQ2/k gxpPYShUMShFltH+KlY8WzmKbuoXePY8Zfkl+mAlFX2Rz2HyKMnqZAIofrUgMwwopB mticpgmwK7Yvg== 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 170A44E2C for ; Wed, 25 Sep 2024 11:39:40 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 8641C3A20DC for ; Wed, 25 Sep 2024 11:39:33 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Sep 2024 11:39:15 +0200 Message-ID: <20240925093919.22929-18-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240925093919.22929-1-anton@khirnov.net> References: <20240925093919.22929-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/22] lavfi/avf_showfreqs: 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: 1cKfAEo0k8T4 Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/avf_showfreqs.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c index da31b3215e..91e3a339e4 100644 --- a/libavfilter/avf_showfreqs.c +++ b/libavfilter/avf_showfreqs.c @@ -116,32 +116,23 @@ static const AVOption showfreqs_options[] = { AVFILTER_DEFINE_CLASS(showfreqs); -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE }; int ret; /* set input audio formats */ formats = ff_make_format_list(sample_fmts); - if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0) - return ret; - - layouts = ff_all_channel_counts(); - if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0) - return ret; - - formats = ff_all_samplerates(); - if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0) return ret; /* set output video format */ 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; return 0; @@ -566,6 +557,6 @@ const AVFilter ff_avf_showfreqs = { .activate = activate, FILTER_INPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(showfreqs_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &showfreqs_class, };