From patchwork Mon Sep 2 13:50: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: 51322 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4027:b0:48e:c0f8:d0de with SMTP id ky39csp1885271vqb; Mon, 2 Sep 2024 08:09:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGmtyIssk/4pUdOOngc2iLlwNtbvuqex11msfIAofkx2p0H/cIFd8bBgk8IuE9JurpAD95OPWiTrEDWKR5uflm@gmail.com X-Google-Smtp-Source: AGHT+IFueBDpF4Mi2vnshvkufXiBdoaB27e09GarBrPaHEIVkgtah6eJTPKuy7UBQR8aLXi2LNkx X-Received: by 2002:a2e:a544:0:b0:2f6:1d35:1491 with SMTP id 38308e7fff4ca-2f61e034afbmr93635141fa.15.1725289744536; Mon, 02 Sep 2024 08:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725289744; cv=none; d=google.com; s=arc-20240605; b=flBC6jTj5hVU2/dAWbtbSSTrOeRbjTbVUZPuyYanqxW+E/3jRiJIwbOU7YK81jpHZp ndEqEmx25AHY3l8zt6GGENdin0BXCRLPMDYNtEbny3b/G93eBCoSauE8topUxfF83xNH ht9WEr7ieEJZkEsBiYYh4oS2IrdZcGXXOFX2OnaFz9hBWhNpUCvB3LT1fCLziA81GHZS yRIYlsp3A5I87MLKCvEEYIduFlFw1EjThkXI8hfENOvaZdXeVxbrtPAQKIWIusgeVRlZ r0n6JLZcfv25QKE8R8pXqrfSbzXQ0mwZ+dwp2tYkE+1ekHU7lA+KRz0DMTMge2+qqJnF e89g== 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=Oxnek7WDLIYZmqM5dV+PXFyetMtDtS+chBT7lFqgx+o=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=S6I4CvKhN4yOuaTWQpCBMCOinbbNXgKcM5ZYmeDVjpRCydJLVSTAz/w9MsmrQ8B+dK NJ6WbeIRFl/IFtLxqvBhUmzu5mJqBO8s+Fz9w66HFpo/ldbf3aBO88Ttkq43Qyv32xSo v3iPWUfTXoMcZ2z/LEAMCDH5gZG6Q6bhlH8ODbLSDuNoBuEmjQL3K1BMGuzXhhNgyc67 X4aOXU+jOISpkaYwhD6uFmB6U0pmCYb8OT+7LXmGe50KOedfDM6SQq9gbFiEEGO0xKEj 4apwdKLq5K6IYoSTScfGtnzcarQXz+o7anvOozathcIegeM7hJrASnfOAcwotGwS2cei O1gg==; 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="UbgbPf/f"; 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 4fb4d7f45d1cf-5c226d6eb75si7490412a12.644.2024.09.02.08.09.04; Mon, 02 Sep 2024 08:09:04 -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="UbgbPf/f"; 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 00F5768E0FE; Mon, 2 Sep 2024 16:51:02 +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 0D07668DF01 for ; Mon, 2 Sep 2024 16:50:46 +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=UbgbPf/f; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id A76994DE2 for ; Mon, 2 Sep 2024 15:50:41 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id a_OD6LYUJbDW for ; Mon, 2 Sep 2024 15:50:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725285038; bh=W99EBUceqNFz2mjwKu7h41QPqcjhQIrhXogOBnStmu0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UbgbPf/fnQACwwcya7Ekwj+6vuT1IPcefG3rkrZyD2VC3Klx+YH/hCiybNe9JLbo6 qOhiSLaGSM5dg5VrYXPMKRl/Y8/jJpOW0+noYGFrEvDEZ/lTRgYECC8WMH4QfApyZd q+nn4BptNAbeJjFC2XKywc0bOQIEMldLmu51vyNJ4aBpBSih6qeYzdvQgtiFuempoI xiNoY1I1ZAgRPcr8R0pVWvdier/ymgbiMUIkOZMFnc8UlZzxObJTDBQDj8vMUuH/mJ 5ySAX9Dg/wxzpEktM8Q1NI1VMUnNVUfSqyVfId8XzJd93/m/Te1GduqVNHEmcEPByf qAHTtlgY8OkEg== 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 81B804E08 for ; Mon, 2 Sep 2024 15:50:38 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 2E8063A2DB4 for ; Mon, 02 Sep 2024 15:50:32 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Sep 2024 15:50:13 +0200 Message-ID: <20240902135013.13803-13-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240902135013.13803-1-anton@khirnov.net> References: <20240902135013.13803-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/13] lavfi/af_channelmap: 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: iHNceNkysv9q Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_channelmap.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 8d65fb3cd2..3f02a7fd8f 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -321,21 +321,28 @@ static av_cold int channelmap_init(AVFilterContext *ctx) return 0; } -static int channelmap_query_formats(AVFilterContext *ctx) +static int channelmap_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - ChannelMapContext *s = ctx->priv; + const ChannelMapContext *s = ctx->priv; AVFilterChannelLayouts *channel_layouts = NULL; + int ret; - if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_all_samplerates(ctx )) < 0 || - (ret = ff_add_channel_layout(&channel_layouts, &s->output_layout)) < 0 || - (ret = ff_channel_layouts_ref(channel_layouts, - &ctx->outputs[0]->incfg.channel_layouts)) < 0) + ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts()); + if (ret < 0) return ret; - return ff_channel_layouts_ref(ff_all_channel_counts(), - &ctx->inputs[0]->outcfg.channel_layouts); + ret = ff_add_channel_layout(&channel_layouts, &s->output_layout); + if (ret < 0) + return ret; + + ret = ff_channel_layouts_ref(channel_layouts, &cfg_out[0]->channel_layouts); + if (ret < 0) + return ret; + + return 0; } static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) @@ -425,5 +432,5 @@ const AVFilter ff_af_channelmap = { .priv_class = &channelmap_class, FILTER_INPUTS(avfilter_af_channelmap_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(channelmap_query_formats), + FILTER_QUERY_FUNC2(channelmap_query_formats), };