From patchwork Tue Oct 1 10:54:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51967 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cb8a:0:b0:48e:c0f8:d0de with SMTP id d10csp192178vqv; Tue, 1 Oct 2024 04:21:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmdvFUoOzy/yB+BVKb5EhXcUT8VjW4aCYU0UUX9nv731yXdEs2+RBwY+aa/wifb9SBtfVOEO+1GJrPM5NW7KEf@gmail.com X-Google-Smtp-Source: AGHT+IEsAoa6gaZJLi84OYgxbu6wKuppXGID0fnFOv/W1ltxZB0CKuA/qI1sTm6czNXBwzxfIuzK X-Received: by 2002:a17:907:1c9d:b0:a8b:6ee7:ba12 with SMTP id a640c23a62f3a-a93c492f900mr1498958566b.27.1727781683586; Tue, 01 Oct 2024 04:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727781683; cv=none; d=google.com; s=arc-20240605; b=V9++l+e9lE59NovaqFeIixqX2BCM3MoAnh9Mgfq4hOxXR5gp5LkuTDWSTChJL1dRrE +/uP4fntI/Y4tbsym80TFgbKkf1V+PFsT0gJa+/vpGQNrQGgU3EQrJRscmHpX+Nqr0wf KUKpXIBswyik6i7634p6eUm0VHYiHWOgpHM5Zx6o0kIBqZMfoeW4hnty71Wfczv1k2PQ j+CNHs6MCnP6jqcpohtboN5Kr5FLlVkSaXIJ7XpGCMESUMX6Odzb3HezYzfcjtj7hu0w K2VqYBWqvalttFlgdcMA6hCj2QiLDDXpalkC9n2DkM4RwxLKmI7w2NfQ9UfF1PLV+9gv YW/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=ezwvILSft72JKdUEr0xymjCXITFFFCRBhsF+RVspFGs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=YD3R4YKWvXAA93n04JOgbzd0DC53PSDD7lbH4zOO9Qdc7J4YEAy6lovFdkk2p0uIDL TSljD5YT+ur8qll3e2Edg3i9SCun22xl+S0JpYkg9u04Mkbf/QnwAeaOA9LDZV//JoLU WQJU4QHnUS9pFOOhH09VM8FGNC/pHAG2RIDSz8CWQSw93DDPsADQsk9/jiPljToteYCS Tx1FGPjgy1uz829mTd63wXaQvU//6gGD6lOjevOcw7oasZNi1OLXFYhbUTtdoU97hwHv BCpjw+Vabcu7vv2owTQe5pm2ws0jkeOqMvZwVkcBrCfsGc3Y8UUyGIbzSZlBI4WRoJMk jv7w==; 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=detIXLE9; 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-a93c29ee46csi742521966b.630.2024.10.01.04.21.21; Tue, 01 Oct 2024 04:21: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=detIXLE9; 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 C2F2E68D9B9; Tue, 1 Oct 2024 13:54:52 +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 5C82D68DBB2 for ; Tue, 1 Oct 2024 13:54:41 +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=detIXLE9; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id B1CB74E13 for ; Tue, 1 Oct 2024 12:54:35 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id HgoAEJZDsnxH for ; Tue, 1 Oct 2024 12:54:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727780072; bh=skzg0mxYZwbJgP02YU0Mk4/RtOiz+LVYbd3nmtExv4g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=detIXLE9p92I5wekQO4fsk3EuQJ4h3yT2cRPBw4SdU10Pd7VQiV2CqT64khom+uz8 vegXd8G8s5FrZNLg6i6Vw2guNkxHDY9EW21674qaMLEOnTzlaFFeu1fYDAFeCv1MVi 3RYvNN8bIKE/wKwogBF683vVBXz5OwocVXjkr77WZBnKhdgsbSWYnUFXO+AXUk40l7 6IkKWvAJQDJbj+47hC+zyBAsCjfiz0cGqRwacn1b66TJppNtyrIjhWfbgpmLyJaif7 7QXs50frY9WOyyzP9HfC4Sym+fJDdLcHcp946VkkpwvlfmIfpxebQ3CnbT89OuDh5G A2/Fee3/vcczQ== 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 E792B4E20 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 682883A272A 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:20 +0200 Message-ID: <20241001105421.28967-15-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 15/16] lavfi/vaf_spectrumsynth: 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: U4CAKUWUG4BW --- libavfilter/vaf_spectrumsynth.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavfilter/vaf_spectrumsynth.c b/libavfilter/vaf_spectrumsynth.c index a62151aa4f..c8d3525b7b 100644 --- a/libavfilter/vaf_spectrumsynth.c +++ b/libavfilter/vaf_spectrumsynth.c @@ -93,14 +93,18 @@ static const AVOption spectrumsynth_options[] = { AVFILTER_DEFINE_CLASS(spectrumsynth); -static int query_formats(AVFilterContext *ctx) +enum { + MAGNITUDE = 0, + PHASE = 1, +}; + +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - SpectrumSynthContext *s = ctx->priv; + const SpectrumSynthContext *s = ctx->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layout = NULL; - AVFilterLink *magnitude = ctx->inputs[0]; - AVFilterLink *phase = ctx->inputs[1]; - 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_GRAY8, AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, @@ -108,28 +112,28 @@ static int query_formats(AVFilterContext *ctx) int ret, sample_rates[] = { 48000, -1 }; formats = ff_make_format_list(sample_fmts); - if ((ret = ff_formats_ref (formats, &outlink->incfg.formats )) < 0 || + if ((ret = ff_formats_ref (formats, &cfg_out[0]->formats )) < 0 || (ret = ff_add_channel_layout (&layout, &FF_COUNT2LAYOUT(s->channels))) < 0 || - (ret = ff_channel_layouts_ref (layout , &outlink->incfg.channel_layouts)) < 0) + (ret = ff_channel_layouts_ref (layout , &cfg_out[0]->channel_layouts)) < 0) return ret; sample_rates[0] = s->sample_rate; formats = ff_make_format_list(sample_rates); if (!formats) return AVERROR(ENOMEM); - if ((ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_out[0]->samplerates)) < 0) return ret; formats = ff_make_format_list(pix_fmts); if (!formats) return AVERROR(ENOMEM); - if ((ret = ff_formats_ref(formats, &magnitude->outcfg.formats)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_in[MAGNITUDE]->formats)) < 0) return ret; formats = ff_make_format_list(pix_fmts); if (!formats) return AVERROR(ENOMEM); - if ((ret = ff_formats_ref(formats, &phase->outcfg.formats)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_in[PHASE]->formats)) < 0) return ret; return 0; @@ -543,6 +547,6 @@ const AVFilter ff_vaf_spectrumsynth = { .priv_size = sizeof(SpectrumSynthContext), FILTER_INPUTS(spectrumsynth_inputs), FILTER_OUTPUTS(spectrumsynth_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &spectrumsynth_class, };