From patchwork Thu Sep 5 10:07:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51359 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp282812vqb; Thu, 5 Sep 2024 03:11:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQqw5B822mVRwXXah/9Dwz4NCZTl0tsCFFLVaAMkqHbtlVoP4gOkY/KKMw0Cg3ngYxaTbhalTViSEPxJiZLd49@gmail.com X-Google-Smtp-Source: AGHT+IHrdDDJZb1McvIb3qqxoNi5xPzfY34wzn1ZiafQJzaMsrDySsvdxVbSZcptYwNqj17hx7Bg X-Received: by 2002:a05:6512:159e:b0:52e:7542:f469 with SMTP id 2adb3069b0e04-53546a56629mr13975418e87.0.1725531114570; Thu, 05 Sep 2024 03:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531114; cv=none; d=google.com; s=arc-20240605; b=ffZRZ4L8TbeF2Uuw0bLIr5Vr3ahL8PeZSSP0ZYWDf26K4Lzo/oV/bDZTe8sILKEbEn gHbW7mefa+lU0SwJFn1XHcdovfy/ZO2P82SwnOOCPgMPq4Gwv6/W/OkBoKBbyvw855Wn iQcxUIDS7RNAXQUPwP//VsWh5XQ+Kyuk9twCnM4nJdDygOQ4AGX1dOixuvLPZoLQ7z7u 0h7LLZ6HKAq2sSEe0CYQKdwuVeG0qGtNZd8dNcPRQRPIq3S4nvPs/r9z2NsYJMAlDsvY ZAOP7dnjsLkowPFfankV8GOlMFVMWqrh/XU0KPcPF61Aa6Vh7Ak7g3nQYGgMnTllZ3u4 B6UQ== 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=C9RJVYwhP4Wu/1e4ZvqP/dK3MlLHraT7bdzGtZ+EuSs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=aopNN+f2C03IEWRwZQo2WYx8PoNeqKxXuV/oD6C3pCxvpKf2GImpegCS1n1E7uqPGg ERvSQCXY92dC+x/9wnp+xGvpPCxpageNgCy5thZqSuYCEacKu7sSV1rqxACUHCCcr2Ch 2c/SkQVrEIjLQjcXPy365ZpxIP0Q4Eg23VjeOG8oWu5Pl1fG9r5j4VIfNp07I/N/4Q+w 6iSgMUpibhBvHXwM1PnfNRdR4Io7k0jrOJK5T8TxO2aXm6g/DPPEgzaxwlxK1zg44bWi Kcl7WbEI99ld9yoN+qulRxJyLLKk+dqn/XXUmr/v6WGkbQ6jxxyRi7TCs5E+HegR0LzR 7S9g==; 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=s7IYQzio; 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 2adb3069b0e04-5354077d276si4963419e87.17.2024.09.05.03.11.53; Thu, 05 Sep 2024 03:11:54 -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=s7IYQzio; 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 DC6C668DFA3; Thu, 5 Sep 2024 13:08:16 +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 704A768DD9D for ; Thu, 5 Sep 2024 13:07: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=s7IYQzio; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 981914DF8 for ; Thu, 5 Sep 2024 12:07:43 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id lLn08s_8hrQV for ; Thu, 5 Sep 2024 12:07:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=peTMpjCRK6uuEY4Nfs8xSWgVW1BDi4BmBjt50rW7CZ8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s7IYQzioEpfrZwYfF9uUQrFBYyPNa+JpXqQWVvS3x1Ma2kxpJd0UzSQ9SFnWTg2ka mMOayPGaAI7QW9eLmen8ECbtR1kD4oKIQFCfPTKYlrFfuwxfy573q7DR8QLrrG8b+N Tf13bNfyI6yegAu2ARHLlGQjwjgfWdFRPiHi9NhJxD8EH/NCai0xwEZhEZatWkKaQd WNQsNN8FDIqQ4tGSzTAXnB1bphJevweQ+kFbseqF8Q7VM/tCxnGQZ+mLBL9bggmc8i 1iQ37nKykslk7Ye1lTFmAG/GvLfoqSeaX05Xmzy+t1mfDluJrI5UkZ0OdP849Bc9Qi vmFuYT2BwV//w== 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 63DBC4E08 for ; Thu, 5 Sep 2024 12:07:41 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 2D8503A20DB for ; Thu, 05 Sep 2024 12:07:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:13 +0200 Message-ID: <20240905100729.6030-9-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240905100729.6030-1-anton@khirnov.net> References: <20240905100729.6030-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/25] lavfi/af_haas: convert 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: 3J+61eyZtmNY Also, drop a redundant call that also happens implicitly in generic code. --- libavfilter/af_haas.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_haas.c b/libavfilter/af_haas.c index 6385b328e4..81643cfd9d 100644 --- a/libavfilter/af_haas.c +++ b/libavfilter/af_haas.c @@ -81,19 +81,29 @@ static const AVOption haas_options[] = { AVFILTER_DEFINE_CLASS(haas); -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; + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_DBL, + AV_SAMPLE_FMT_NONE, + }; + static const AVChannelLayout layouts[] = { + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, + (AVChannelLayout){ .nb_channels = 0 }, + }; int ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBL )) < 0 || - (ret = ff_set_common_formats (ctx , formats )) < 0 || - (ret = ff_add_channel_layout (&layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || - (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); + if (ret < 0) return ret; - return ff_set_common_all_samplerates(ctx); + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) + return ret; + + return 0; } static int config_input(AVFilterLink *inlink) @@ -216,5 +226,5 @@ const AVFilter ff_af_haas = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), };