From patchwork Tue Oct 1 10:54:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51957 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cb8a:0:b0:48e:c0f8:d0de with SMTP id d10csp175205vqv; Tue, 1 Oct 2024 03:55:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW939/EQu/pf9enR9OyAOlFi0GLsyN5lpzqQdid7SD5xPHNsyCSlrtalwkZkrEVx5fbB2IiH1oLKcUReRwe7Y1M@gmail.com X-Google-Smtp-Source: AGHT+IFA8rWQ08E29ECqe1P7g8nTgNbXpeNKpo7G4nortHThRnqpGVf2BGRdJpis0yBIMH3TXfDN X-Received: by 2002:a2e:f1a:0:b0:2fa:bd19:b821 with SMTP id 38308e7fff4ca-2fabd19ba48mr54092261fa.9.1727780117475; Tue, 01 Oct 2024 03:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727780117; cv=none; d=google.com; s=arc-20240605; b=fPkuT1DJa2mwNHcpMWHGWdQzRxzjUFpPGS0HfmxfJ8U3rUbd30KEDzqK3d1rRhWy5K fNbbMIEV5Y1RUSsDE9WYjEdiLDPWREpVxfmFxAeDI+4DQaxPbDWI/Dgao/YYgwvxGr6o gywmXaQwca9S5N+EfF3jiWp03pDXGcwXDf+3xLNbAGDSd5ML5SDfA1ZxLb7L3uyeFnx3 B35N7PbwrgapoApqRqd73sRLnLY+qnBWLz5PRnJqvbUcxmLL0retapnXGvehDD3BwBB7 34gOuykbLUOGUnRS8AA8rJ6ERMzDOM0w5zOnpYgsnbY15vizaj1GZ4QEHJPSk1viJh14 SbjQ== 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=uHIOm6vu0rhqQ9fTGts4hoThMxSy2nIa7ieaQtQrvWI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Qr+OJgqF74rTdxbL/tiAAQTPd1lDOxdWgOEXlbUgtWawNELfVUu4TxOpTo45u43yks f7zsLxu1a+oobrCGcomtvmLvEotRQEObBp2twqncynQ0ACsFOwoz3nfZXV1Tgl3nd60P eN2O7YsT8lbyL7u/NrUKSZe5tiQgjIqL30HzN06Cdc2XAm5jpMM8ETRv8pXY1p9AUWZo pOeuRX8FszZ+eqheQrsnoZLcaW9TGeHd4yCILeGYXkFXhLi5mxGD0/j7PBglIQ77SCnY PshtLCfprOSPy6/a9sJkzOKyIAXMpN/jEIpsk+B/7XqLXNO/fSOWrw9qv7jMtYDsFlZs T0IA==; 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=KqDKx8uF; 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 38308e7fff4ca-2f9d4625decsi31975911fa.445.2024.10.01.03.55.16; Tue, 01 Oct 2024 03:55:17 -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=KqDKx8uF; 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 1874868DA28; Tue, 1 Oct 2024 13:54:44 +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 281FA68DB16 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=KqDKx8uF; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id AE5FD4E0F 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 B3yJ7ZDjk_iF 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=/utqs2FZnyrjF5p2mKHqb/hfKTT4Gtnd2+fizdaEtqY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KqDKx8uFQn2kH/a8Ogz6fNeaT2Zl/GlDf33YMKmUQpCCVf7VC46+l4vHpxRmhtH0S 2oHwMfgogikzUScMhXWmleka6mq+b9Ss2Zfn5wuX5Vw/Zo6cCN/qM8nXQolAdud/T3 R/gqA+wN6+t78XNTu2hnYQj4LRwAbw6KpbmuHUOp8h0dmdzyoyCBj7hwZMzLkMEv1E IVe0dmS9fvJv4p1RHFzs9rAG2+vDZI0bO1UaANJUcocXljznZBu7oyxfJ63rq+8pKQ LMZiQEq9/8kftt0046ZXaGnuNae2QAF+IlhSwk9Mwb14EuSCxe+mm2PEi2UpD0AHRy FfS7c0Ie0q/Aw== 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 D57514E13 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 21D403A20DC 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:14 +0200 Message-ID: <20241001105421.28967-9-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 09/16] lavfi/f_select: 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: Bvq7MM1bZlk4 Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/f_select.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index ba0ae31f1b..744fef6906 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -515,13 +515,13 @@ const AVFilter ff_af_aselect = { #if CONFIG_SELECT_FILTER -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - SelectContext *select = ctx->priv; + const SelectContext *select = ctx->priv; - if (!select->do_scene_detect) { - return ff_default_query_formats(ctx); - } else { + if (select->do_scene_detect) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, @@ -530,8 +530,9 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P10, AV_PIX_FMT_NONE }; - return ff_set_common_formats_from_list(ctx, pix_fmts); + return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts); } + return 0; } DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM); @@ -564,7 +565,7 @@ const AVFilter ff_vf_select = { .priv_size = sizeof(SelectContext), .priv_class = &select_class, FILTER_INPUTS(avfilter_vf_select_inputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_METADATA_ONLY, }; #endif /* CONFIG_SELECT_FILTER */