From patchwork Wed Sep 25 09:39:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51832 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9548:0:b0:48e:c0f8:d0de with SMTP id t8csp349616vqk; Wed, 25 Sep 2024 03:09:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUtkmfBwxJFm/THtK3FSK6skto1BGzdDk+hGyorjk4zQQOFmlgGJ+nR1HIUAtb4dUWDAWGdyH3yljSBOJUjl0Nr@gmail.com X-Google-Smtp-Source: AGHT+IEogsXSBWn54EeSQwVcVeKRDHFWC0tpA1V5b0kNkm/uJ/sUTpOwYVdcSILNUz42tR4bhJU4 X-Received: by 2002:a2e:4e02:0:b0:2f3:fae3:83a7 with SMTP id 38308e7fff4ca-2f91ca70fadmr9171771fa.43.1727258958312; Wed, 25 Sep 2024 03:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727258958; cv=none; d=google.com; s=arc-20240605; b=BN7ZRBpxIl2Aivk4kzfE8RUvznt6umqnlWS83BCmx5rnetMYie9Vs6rcJkId59qwZY p+3gVS2efrO2pH1y5ajUxpPEV4HQZAyADv9qbxVQGYtGxCVOK6ykE2hqdgCGJdmmLuX9 TRW0B6otJlWfhkH7iJebUhfhbjCutXo71U1lVLpYGThrXfxa62BJOTbkgGnnPd+K9hD7 bVFLkfXVAr8sbrSf+VpGWEKYuhHMK/lyvSkpzIVlFcjarLIENl3ay8HkHI123H7KBe2y kkLuyQCc2qT0LSj1WLyEaFOEZl3LcwezOG2zDhlFc4YRTMVCYRylaxg8a6fAIIExe/wV IaHA== 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=O7QQmhaE7GJtRDdIWYJDKkgJc7/nhNYPbhfLUZwZmC4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=GO/7CKHl208xDqW94iNl2gLtgnVPwrO4tVJdI2ujH1C50Dyvq5Au86ClJiJMp0mQAm 9F+hrxt89OXH/a715UJRzACcxbEzRzke3UoV6XhV9AKPCR8bVKNxb9S/vetmRH6KSC2S mOvTQL3B8WfZRmztJmRLksNWtEuU30ao+vtQxyDF2b53GyjXcA3O9SgeQ9zjQLJjf3VC v3LIXLaeNr6j2tioz5j4nh7zNkwYqE6MWnxTPxBZDbxPrll4yvKI4NAzA95tiAk8IgsP fFWTPbq0sumfSESIUsYkmvYasYb5hKncAnYaDf6rUOR6QWdlUpMuD2/q9paNkDRXSVeV xGuA==; 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=NiAvkZ5H; 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-2f8d28b734bsi10501511fa.562.2024.09.25.03.09.17; Wed, 25 Sep 2024 03:09:18 -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=NiAvkZ5H; 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 82C2568DCBF; Wed, 25 Sep 2024 12:40:14 +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 8CFD668DAF3 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=NiAvkZ5H; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 3414C4E25 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 vAn53eZ2l-A8 for ; Wed, 25 Sep 2024 11:39:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727257179; bh=eBjBh6mB1wZMBSy2YNsyHvkkrIgkaYwVO6EhMJHXWLM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NiAvkZ5HTgK6S9bFeG/NTID+RITMbSI7lWOWjHOIEIFJhbXibuAMMxfD6nVSc1SYf Rlhzef1MJdw1F3cSeIEAnDsqOdGMAMvz79nzmU7PDxI4OmNk5Cgd9t0Ypvyhv2r9rK aig8efEZsH3dSgCzKMTkaTdslC5TJGa/xQCPu/dqa7HGTSH3kJkxUZlaMokqmS4gth 4Gi3042pqt3WRZK5MoLjBQAmP31sdKMytliZi4+3nrHgupGAs6f26ise6YFuiysOT9 fT+63NoE3MoUKF3wfcjYJ3Ke4VC3HcANGzpaq9jm6++y1CfldeOk5x0B3C/WiN+XKB OCMOL6bNmsf2w== 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 CCD444E2B for ; Wed, 25 Sep 2024 11:39:39 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 9210C3A2137 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:16 +0200 Message-ID: <20240925093919.22929-19-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 19/22] lavfi/avf_showspatial: 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: 9YrnWDM8ur/P Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/avf_showspatial.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libavfilter/avf_showspatial.c b/libavfilter/avf_showspatial.c index f7380f885a..285f2f1a81 100644 --- a/libavfilter/avf_showspatial.c +++ b/libavfilter/avf_showspatial.c @@ -80,28 +80,26 @@ static av_cold void uninit(AVFilterContext *ctx) av_audio_fifo_free(s->fifo); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layout = 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_GBRP, AV_PIX_FMT_NONE }; + static const AVChannelLayout layouts[] = { AV_CHANNEL_LAYOUT_STEREO, { .nb_channels = 0 } }; int ret; formats = ff_make_format_list(sample_fmts); - if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats )) < 0 || - (ret = ff_add_channel_layout (&layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || - (ret = ff_channel_layouts_ref (layout , &inlink->outcfg.channel_layouts)) < 0) + if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0) return ret; - formats = ff_all_samplerates(); - if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0) + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) return ret; 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; @@ -330,7 +328,7 @@ const AVFilter ff_avf_showspatial = { .priv_size = sizeof(ShowSpatialContext), FILTER_INPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(showspatial_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .activate = spatial_activate, .priv_class = &showspatial_class, .flags = AVFILTER_FLAG_SLICE_THREADS,