From patchwork Thu Sep 5 10:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51360 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp283863vqb; Thu, 5 Sep 2024 03:14:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUI+vKD3IP9uSQhZThBKax52sZnTJDNXvzMP5bprlk4jjy83+ZHQl50tc5l3kz50dmq1v8+Ap7plac0g4YgTLj/@gmail.com X-Google-Smtp-Source: AGHT+IHZyjaQjzw5r8OcqI0jQVxpckh2Fudjj2Y2L/ERoNRX/LS/k88VOV2olgRp7jxjd/J6jmLK X-Received: by 2002:a05:651c:b23:b0:2ef:29fc:f950 with SMTP id 38308e7fff4ca-2f61e0ac3b3mr81407321fa.6.1725531251862; Thu, 05 Sep 2024 03:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531251; cv=none; d=google.com; s=arc-20240605; b=X3vcOBnLK3vZKjSXWBhoyyzszP0wv0ZvRHy0MEKG2art9/OjEvr8ZLfwYOus3Zg/Zs xb58gT5MNXp4VOh+la0xN5G8i1SeyxRpz+FxxHgNtsu0By0FbRrOKuRChgF/gnYR3u5W AGMgr0wP2A2d9jOw9imu3usRGYiP/cL7V/1WegkcnigmzR9F7B19P+v/BsnizGC7Ox2/ mXx2B8k/gRlaJzVgWtNRJiPpe6xIss0QOsAwedgArfBU+zIy6K1NczHxHMfnO/EQooD8 cpLUD+5cJwGWrXmO04mHOMbyWk+F9kgqp1kw7cMzpqe1PuGboM9kOuJyfYxq9hZ9UuTP yPPw== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=40GLC9RnJovIvGH1KBGeMXgBxVHZO6EzwUOeDdRZJxg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OFi5CSMjrlUN7/hbRL/1tMgTPyPegQ87p1LW5Znk7dBfIf9mjJgWa/ERBeajI/QYMj X+DESwuGU5B5ftNxLH2eRMxrTzhfrlQ51jpqTgzkDVKilKPGQoAPkL6JCYOWRsIxYRnl v0DPd9qv+DbEmkBiaBoBv838ZAQZOqrIqz8J3NQ8FKSysiDflmM89XP5JMNqbwDQki06 huhdYUZdkNY0i7aynP3R2qCXx5viIiq2A8e7YN4Ld3+zTFnTIA4qw8GykpCviN2JFG/N He9bUDP7kKrlG/qS92lCar+rjHKsTj04oS9/Id0pWyoQYnw7ey+orG9yJY+8UDKFUXze Ppfg==; 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=GxKm4G8X; 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-2f74e99adc1si679871fa.564.2024.09.05.03.14.11; Thu, 05 Sep 2024 03:14:11 -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=GxKm4G8X; 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 4E96A68DD3D; Thu, 5 Sep 2024 13:07:53 +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 15D8C68DC5F for ; Thu, 5 Sep 2024 13:07:43 +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=GxKm4G8X; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 53E0A4E14 for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id K58OuHbqkzDO for ; Thu, 5 Sep 2024 12:07:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=lsRSSS5ciY/GSHtcKqH3ji0tOEiTzLFjE6wJnL/Rnqg=; h=From:To:Subject:Date:From; b=GxKm4G8XQu7C6NGwT/aRpU7ZMTMyic+iHkcA4ncaE+HW7jpexHuNxObWSbXiqLYBQ 4QTtLDGzfYcNWu+ssoxg1rnST3wiD+8xNcm7Pd7wn4RdKwCxmaSefNWgJWXonPI/XL QD7m6c0DU43CQg1OPitIRSgaKX/9RPZ4NMmauRp2WKJhalPqdGXYfJRlTecGxHqsqi uB4Z63KUXCID1asCzqVbQYCJhzItU7LiXXb2mJv8lPwFeCPlLpAkAgTCan15J7CXxY /jRVtUNnP0A7Ie1DR4p2Tgg0CeEq0uhXrUKHamUrJ7s1YS+6Cy73VdBY5fe/HGdDiB lADcNGehxlXTw== 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 324E6EFE 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 C635D3A071E for ; Thu, 05 Sep 2024 12:07:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:05 +0200 Message-ID: <20240905100729.6030-1-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/25] lavfi/af_channelmap: remove an arbitrary limit on channel count 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: KnEoY8waSYsj --- libavfilter/af_channelmap.c | 87 +++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 3f02a7fd8f..f5209a10cd 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -55,14 +55,15 @@ enum MappingMode { MAP_PAIR_STR_STR }; -#define MAX_CH 64 typedef struct ChannelMapContext { const AVClass *class; char *mapping_str; AVChannelLayout output_layout; - struct ChannelMap map[MAX_CH]; + struct ChannelMap *map; int nch; enum MappingMode mode; + + uint8_t **source_planes; } ChannelMapContext; #define OFFSET(x) offsetof(ChannelMapContext, x) @@ -78,6 +79,13 @@ static const AVOption channelmap_options[] = { AVFILTER_DEFINE_CLASS(channelmap); +static void channelmap_uninit(AVFilterContext *ctx) +{ + ChannelMapContext *s = ctx->priv; + av_freep(&s->map); + av_freep(&s->source_planes); +} + static char* split(char *message, char delim) { char *next = strchr(message, delim); if (next) @@ -85,7 +93,7 @@ static char* split(char *message, char delim) { return next; } -static int get_channel_idx(char **map, int *ch, char delim, int max_nb_channels) +static int get_channel_idx(char **map, int *ch, char delim) { char *next; int len; @@ -99,7 +107,7 @@ static int get_channel_idx(char **map, int *ch, char delim, int max_nb_channels) sscanf(*map, "%d%n", ch, &n); if (n != len) return AVERROR(EINVAL); - if (*ch < 0 || *ch >= max_nb_channels) + if (*ch < 0) return AVERROR(EINVAL); *map = next; return 0; @@ -148,7 +156,8 @@ static av_cold int channelmap_init(AVFilterContext *ctx) int map_entries = 0; enum MappingMode mode; int64_t out_ch_mask = 0; - uint64_t presence_mask; + uint8_t *presence_map = NULL; + int ret = 0; int i; mapping = s->mapping_str; @@ -182,27 +191,25 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if (*++sep) // Allow trailing comma map_entries++; } - } - if (map_entries > MAX_CH) { - av_log(ctx, AV_LOG_ERROR, "Too many channels mapped: '%d'.\n", map_entries); - return AVERROR(EINVAL); - } - - for (i = 0; i < MAX_CH; i++) { - s->map[i].in_channel_idx = -1; - s->map[i].out_channel_idx = -1; - s->map[i].in_channel = -1; - s->map[i].out_channel = -1; + s->map = av_malloc_array(map_entries, sizeof(*s->map)); + if (!s->map) + return AVERROR(ENOMEM); } for (i = 0; i < map_entries; i++) { int in_ch_idx = -1, out_ch_idx = -1; int in_ch = -1, out_ch = -1; static const char err[] = "Failed to parse channel map\n"; + + s->map[i].in_channel_idx = -1; + s->map[i].out_channel_idx = -1; + s->map[i].in_channel = -1; + s->map[i].out_channel = -1; + switch (mode) { case MAP_ONE_INT: - if (get_channel_idx(&mapping, &in_ch_idx, separator, MAX_CH) < 0) { + if (get_channel_idx(&mapping, &in_ch_idx, separator) < 0) { av_log(ctx, AV_LOG_ERROR, err); return AVERROR(EINVAL); } @@ -218,8 +225,8 @@ static av_cold int channelmap_init(AVFilterContext *ctx) s->map[i].out_channel_idx = i; break; case MAP_PAIR_INT_INT: - if (get_channel_idx(&mapping, &in_ch_idx, '-', MAX_CH) < 0 || - get_channel_idx(&mapping, &out_ch_idx, separator, MAX_CH) < 0) { + if (get_channel_idx(&mapping, &in_ch_idx, '-') < 0 || + get_channel_idx(&mapping, &out_ch_idx, separator) < 0) { av_log(ctx, AV_LOG_ERROR, err); return AVERROR(EINVAL); } @@ -227,7 +234,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) s->map[i].out_channel_idx = out_ch_idx; break; case MAP_PAIR_INT_STR: - if (get_channel_idx(&mapping, &in_ch_idx, '-', MAX_CH) < 0 || + if (get_channel_idx(&mapping, &in_ch_idx, '-') < 0 || get_channel(&mapping, &out_ch, separator) < 0) { av_log(ctx, AV_LOG_ERROR, err); return AVERROR(EINVAL); @@ -241,7 +248,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx) break; case MAP_PAIR_STR_INT: if (get_channel(&mapping, &in_ch, '-') < 0 || - get_channel_idx(&mapping, &out_ch_idx, separator, MAX_CH) < 0) { + get_channel_idx(&mapping, &out_ch_idx, separator) < 0) { av_log(ctx, AV_LOG_ERROR, err); return AVERROR(EINVAL); } @@ -275,6 +282,11 @@ static av_cold int channelmap_init(AVFilterContext *ctx) if (mode == MAP_NONE) { int i; s->nch = s->output_layout.nb_channels; + + s->map = av_malloc_array(s->nch, sizeof(*s->map)); + if (!s->map) + return AVERROR(ENOMEM); + for (i = 0; i < s->nch; i++) { s->map[i].in_channel_idx = i; s->map[i].out_channel_idx = i; @@ -301,22 +313,25 @@ static av_cold int channelmap_init(AVFilterContext *ctx) } } - presence_mask = 0; + presence_map = av_calloc(s->nch, sizeof(*presence_map)); for (i = 0; i < s->nch; i++) { - uint64_t idx_mask; - int ret = check_idx_and_id(ctx, s->map[i].out_channel_idx, s->map[i].out_channel, &s->output_layout, "out"); + const int out_idx = s->map[i].out_channel_idx; + int ret = check_idx_and_id(ctx, out_idx, s->map[i].out_channel, &s->output_layout, "out"); if (ret < 0) - return ret; - idx_mask = (1ULL << s->map[i].out_channel_idx); - if (presence_mask & idx_mask) { + break; + if (presence_map[out_idx]) { char layout_name[256]; av_channel_layout_describe(&s->output_layout, layout_name, sizeof(layout_name)); av_log(ctx, AV_LOG_ERROR, "Mapping %d assigns channel #%d twice in output layout '%s'.\n", i + 1, s->map[i].out_channel_idx, layout_name); - return AVERROR(EINVAL); + ret = AVERROR(EINVAL); + break; } - presence_mask |= idx_mask; + presence_map[out_idx] = 1; } + av_freep(&presence_map); + if (ret < 0) + return ret; return 0; } @@ -353,10 +368,9 @@ static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) const int nch_in = inlink->ch_layout.nb_channels; const int nch_out = s->nch; int ch, ret; - uint8_t *source_planes[MAX_CH]; - memcpy(source_planes, buf->extended_data, - nch_in * sizeof(source_planes[0])); + memcpy(s->source_planes, buf->extended_data, + nch_in * sizeof(s->source_planes[0])); if (nch_out > nch_in) { if (nch_out > FF_ARRAY_ELEMS(buf->data)) { @@ -380,7 +394,7 @@ static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) for (ch = 0; ch < nch_out; ch++) { buf->extended_data[s->map[ch].out_channel_idx] = - source_planes[s->map[ch].in_channel_idx]; + s->source_planes[s->map[ch].in_channel_idx]; } if (buf->data != buf->extended_data) @@ -411,6 +425,12 @@ static int channelmap_config_input(AVFilterLink *inlink) err = AVERROR(EINVAL); } + av_freep(&s->source_planes); + s->source_planes = av_calloc(inlink->ch_layout.nb_channels, + sizeof(*s->source_planes)); + if (!s->source_planes) + return AVERROR(ENOMEM); + return err; } @@ -428,6 +448,7 @@ const AVFilter ff_af_channelmap = { .name = "channelmap", .description = NULL_IF_CONFIG_SMALL("Remap audio channels."), .init = channelmap_init, + .uninit = channelmap_uninit, .priv_size = sizeof(ChannelMapContext), .priv_class = &channelmap_class, FILTER_INPUTS(avfilter_af_channelmap_inputs), From patchwork Thu Sep 5 10:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51358 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp280965vqb; Thu, 5 Sep 2024 03:08:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHnQg6Dr7ykI80vX1FBMCuHRzm3o7Z5nErpnLptm6j+g+PSye/NlbQR+qwc5trf8Zf47B94d8DBiQWUMlJm/KT@gmail.com X-Google-Smtp-Source: AGHT+IHKn2tcT0Jp5KGoHqF4PIRo/XPpsc+K13kt8apEW0JKJwU6UGpBtDom6wxC4DhJnB/K9YQm X-Received: by 2002:a17:907:d2a:b0:a80:a3a8:9867 with SMTP id a640c23a62f3a-a89a398a22amr738073766b.9.1725530913615; Thu, 05 Sep 2024 03:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725530913; cv=none; d=google.com; s=arc-20240605; b=RHeVzByaav6LuguVO/hztjJciJT9Ej09qJYbgUKG6MTyivwaSwW9fAkBmXqo6/Q6YD m9mNYBw3TfRN06BeIZTXTxUKzpxnm5LNDKO8uLcv2+GUFnLBfi+vXWNUaVjShyOIa9Qu u5Q3mZotxhMdZD2J+tzlRkVt816QDAhD5p+ctO7WGChYzNJG9VygJ/G8ywIuMNGpyitb PayS7qQe9hUfww1mWDxcVt7BqWalLhFU+TJXmxTGQ2v8zHjnEyXIh2Nqzm67MVm7BKE8 MyEV3tdiLZUZVIn7q0n9OS6tAD9wslVY/+03n/IOKBAtU8pm04HPE0R0B2HzWNa7vP9H hEbQ== 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=01lmycGGeUsnkFpah8Oh8huOLin/WKmLiWvLmhxGEmM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=AxKMzlfR09/IPPShi3V+/T4enNXgCrobaMffh4l21r8P7ddttoxf4nE7XpyxKVFDzS QIl1dG4+KAMw/6Z9Cs/2M7dRCxiTIYin5ZBiDpy95HkaEmvZGo2I1fXsZNWWhsgwwPYn D/PSjoOClNETaZqjA28NvEO4V8OtWywRCbFYbsxe0ldZifJRqAq7P1RL9OU49rprxDBo 5g+o8Fc9LdRtyoqBFZmGypcKWAAwcTQYC4cZJp+u8ZkP6N2UstSr6pWYOnbiprk/+6Q+ KRyEdwme5H5l1VBFCnOqwbCwriGBOmNIvt7skx+DjqLEUBawDtA+YJGdp8N2g+iuM74y DJaw==; 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=jx7POCBH; 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-a8a623d8a3fsi127980166b.697.2024.09.05.03.08.33; Thu, 05 Sep 2024 03:08:33 -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=jx7POCBH; 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 3DF7068DCD3; Thu, 5 Sep 2024 13:07:56 +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 5E36A68DC5F for ; Thu, 5 Sep 2024 13:07:43 +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=jx7POCBH; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 07148EFE 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 hFlVRf4gaBx5 for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=thP9HSf/fvKdek8TwOvInfy4CrUKmhQu81QXs5eEZ94=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jx7POCBHrIdvyP7PkhY5c7Hb8irZS8rvaQXWZiSd00fuZqlZPI5gpigOhecDOwc+v 8mrqtCWRdCo5VoNKjKuWwPjgk6pByTjH4ggYS4xwK31vj2Qbfr0U7pV9fQusR7ZU0V MxhvLUStT/7C1OhZHBPooUvHPpXn6smymW41u6ViBUrlzmFnC3kXK1ZgPB9LBTp/Bv ki+HDPNj3F8GLnATLfNb50EyVSp9uUP8y4o4lZF2RKBMfS6sT8/3TdktKA/NDsmZwe ApJv/gq0tvq5Cq3cyztbPnFCqG1eQf+xWQux3eU4xm8UTklxDKBG6o77oXvJwSba39 H46luHd4zvbJw== 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 3443F4DE4 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 D2E433A1676 for ; Thu, 05 Sep 2024 12:07:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:06 +0200 Message-ID: <20240905100729.6030-2-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 02/25] lavfi/af_channelsplit: support arbitrary channel layouts 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: emjAYchRQTma Not just those containing channel values under 64. Also, remove an arbitrary limitation on channel count. --- libavfilter/af_channelsplit.c | 43 +++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 63ffdc3d9b..527c197fa6 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -34,15 +34,13 @@ #include "filters.h" #include "formats.h" -#define MAX_CH 64 - typedef struct ChannelSplitContext { const AVClass *class; AVChannelLayout channel_layout; char *channels_str; - int map[64]; + int *map; } ChannelSplitContext; #define OFFSET(x) offsetof(ChannelSplitContext, x) @@ -71,10 +69,9 @@ static av_cold int init(AVFilterContext *ctx) goto fail; } - if (channel_layout.nb_channels > MAX_CH) { - av_log(ctx, AV_LOG_ERROR, "Too many channels\n"); - goto fail; - } + s->map = av_calloc(channel_layout.nb_channels, sizeof(*s->map)); + if (!s->map) + return AVERROR(ENOMEM); for (i = 0; i < channel_layout.nb_channels; i++) { enum AVChannel channel = av_channel_layout_channel_from_index(&channel_layout, i); @@ -118,6 +115,7 @@ static av_cold void uninit(AVFilterContext *ctx) ChannelSplitContext *s = ctx->priv; av_channel_layout_uninit(&s->channel_layout); + av_freep(&s->map); } static int query_formats(AVFilterContext *ctx) @@ -139,9 +137,27 @@ static int query_formats(AVFilterContext *ctx) AVFilterChannelLayouts *out_layouts = NULL; enum AVChannel channel = av_channel_layout_channel_from_index(&s->channel_layout, s->map[i]); - if ((ret = av_channel_layout_from_mask(&channel_layout, 1ULL << channel)) < 0 || - (ret = ff_add_channel_layout(&out_layouts, &channel_layout)) < 0 || - (ret = ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->incfg.channel_layouts)) < 0) + channel_layout.u.map = av_mallocz(sizeof(*channel_layout.u.map)); + if (!channel_layout.u.map) + return AVERROR(ENOMEM); + + channel_layout.u.map[0].id = channel; + channel_layout.nb_channels = 1; + channel_layout.order = AV_CHANNEL_ORDER_CUSTOM; + + ret = av_channel_layout_retype(&channel_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + if (ret < 0) { + av_channel_layout_uninit(&channel_layout); + return ret; + } + + ret = ff_add_channel_layout(&out_layouts, &channel_layout); + av_channel_layout_uninit(&channel_layout); + if (ret < 0) + return ret; + + ret = ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->incfg.channel_layouts); + if (ret < 0) return ret; } @@ -154,17 +170,16 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf) AVFilterContext *ctx = outlink->src; ChannelSplitContext *s = ctx->priv; const int i = FF_OUTLINK_IDX(outlink); - enum AVChannel channel = av_channel_layout_channel_from_index(&buf->ch_layout, s->map[i]); int ret; - av_assert1(channel >= 0); - buf_out = av_frame_clone(buf); if (!buf_out) return AVERROR(ENOMEM); buf_out->data[0] = buf_out->extended_data[0] = buf_out->extended_data[s->map[i]]; - ret = av_channel_layout_from_mask(&buf_out->ch_layout, 1ULL << channel); + + av_channel_layout_uninit(&buf_out->ch_layout); + ret = av_channel_layout_copy(&buf_out->ch_layout, &outlink->ch_layout); if (ret < 0) { av_frame_free(&buf_out); return ret; From patchwork Thu Sep 5 10:07:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51362 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp283860vqb; Thu, 5 Sep 2024 03:14:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8P49RnyxlxRkWQhexJ/hDz9bYeQD1A4IopQLuY95r9fu5E9JOFVgEtLhaFRU2hmGKstW99JO9wMcTCwvUS37M@gmail.com X-Google-Smtp-Source: AGHT+IE265r1Kqe0w55qZ8Woya69/7uL+qypo2r19HiLe3UM5CSIY/IVpBfXJjAyhZxto058r0yL X-Received: by 2002:a2e:be03:0:b0:2f4:f253:ec7 with SMTP id 38308e7fff4ca-2f6104270b5mr232352671fa.0.1725531251806; Thu, 05 Sep 2024 03:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531251; cv=none; d=google.com; s=arc-20240605; b=Q5lxwcRAcSvu68ld4YvKF4UPLxAcGU14hNIXeHkvC0BFdbPzcf7afkDD1dvR0OjvxX 0SZ54AoCcPKPkkAPJT1faeiV/qVs+1eT2Gu3a0ej4ds8Y6VZqxechYtCPIyjtjO9Jr44 v2X2qJZMpETLdxSNr5FWJcPEC0CQm3OzsTkeN1cmppqUnsbD8BsKDMSFAdyBhkht+g4n b3BFzMhlToz0oJvXoRG1d1DOoU6356FxCkOVLG0wD2sMUGANWk39Qk6cwYAfSmd3ynZk PZdx2G5jroMD2sSyiD4U7quqkLVUrCbdpkgQacqwqkzrUTzLYsbkdJI/zayUf3D+sgl6 wDnQ== 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=QcOwUEhcEs5yk8y3I4NE9byw1RmZwG+M7V2YuN/QPpk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=UiQRVwls8KqQPGCdvMjihDExUV2pTq3V1K3vPj7Q1fY6c8HnV/r7H5u3oxXEXzKjG0 yYVgFdUFkrF0NVeAhdUWbn0lflCv4EEySmay4d3ddAJTaglKapsK8bMmQKetNNp3J5Bp rO5Ikquqngz5GmDGSgiabbDXCKcje7nfZlCC9yo1I7emVcMKo9XDJIP2cTBSpicpd8GU ATiXv5lB19r5PFectXQJzbHjruS0006a9Jm356NSfuxru/xBbSqJ8H9Pu6Y9N+VEns21 fac7y3x8b3S3oXKff/iKIirhhCJrHdxF0Az0lPbaiPXpzb7iYjqsw0WGQh03whAEB9Hs n7uQ==; 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=FBozGil6; 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-2f74d43f002si1885961fa.86.2024.09.05.03.14.11; Thu, 05 Sep 2024 03:14:11 -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=FBozGil6; 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 D0FA168DCB7; Thu, 5 Sep 2024 13:07:51 +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 139FE68DBE9 for ; Thu, 5 Sep 2024 13:07:43 +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=FBozGil6; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4FC954E13 for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id NOG15KMTLi1e for ; Thu, 5 Sep 2024 12:07:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=5kWXrbEROeYikv3V9rdHLn/Q1gt7kuNfwbCK+lMbYHE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FBozGil6a1fzR6Um0d+l4o5cepZzFldeT/Cb4C8hq/mWBzBgpyO2ZnOue9r7TLhGT yU8+tpvuxxq39+WfAxJz73hUsmh8jEN+5CuX/8BW9hxWcindb3aqhyhAPwe55Gn7nt qHulv5f1tyvbAmIE3AXhbhnCHH03d7PzKyFakWHOUT5Rig9h5b3wFU9oEs0gzPcdGO Lf7G9TZDnlaMqNolyllveWenloj+Nw4xF+/PD28V86o0arLLIZFRufd8KfzcRuQxlu D0mgx6WfNjhTtLCMvKYjChtGsw5pQfL4m3EK5F1CXjKx0EjfB7QnWrUTMAUaV08Mhv tDWpUTkZRDrEQ== 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 366004DF1 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 DE2323A17A2 for ; Thu, 05 Sep 2024 12:07:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:07 +0200 Message-ID: <20240905100729.6030-3-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 03/25] tests/fate/filter-audio: add a test for handling more than 64 channels 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: QzPzxvfPt6F5 The test constructs 66 sine waves of different frequencies and joins them into a 7th order ambisonic layout with extra non-diegetic stereo. The channels are then shifted circularly with channelmap and separated into individual streams for muxing with channelsplit. Note that the last step is necessary because swr is not capable of interleaving planar to packed for more than 64 channels, which would be necessary to mux such a stream as PCM. --- tests/fate/filter-audio.mak | 4 + tests/filtergraphs/crazychannels | 79 ++++++ tests/ref/fate/filter-crazychannels | 396 ++++++++++++++++++++++++++++ 3 files changed, 479 insertions(+) create mode 100644 tests/filtergraphs/crazychannels create mode 100644 tests/ref/fate/filter-crazychannels diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak index a3f7aaddbf..eb8582ab31 100644 --- a/tests/fate/filter-audio.mak +++ b/tests/fate/filter-audio.mak @@ -418,6 +418,10 @@ fate-filter-atempo: CMD = pcm -i $(TARGET_PATH)/tests/data/asynth-44100-1.wav -a fate-filter-atempo: CMP = oneoff fate-filter-atempo: REF = $(SAMPLES)/filter-reference/atempo.pcm +fate-filter-crazychannels: tests/data/filtergraphs/crazychannels +fate-filter-crazychannels: CMD = framecrc -auto_conversion_filters -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/crazychannels +FATE_AFILTER-$(call FILTERFRAMECRC, SINE JOIN ATRIM CHANNELMAP CHANNELSPLIT) += fate-filter-crazychannels + FATE_AFILTER-yes += fate-filter-formats fate-filter-formats: libavfilter/tests/formats$(EXESUF) fate-filter-formats: CMD = run libavfilter/tests/formats$(EXESUF) diff --git a/tests/filtergraphs/crazychannels b/tests/filtergraphs/crazychannels new file mode 100644 index 0000000000..e48da7267c --- /dev/null +++ b/tests/filtergraphs/crazychannels @@ -0,0 +1,79 @@ +sine=frequency=400 * 0x0 [s0]; +sine=frequency=400 * 0x1 [s1]; +sine=frequency=400 * 0x2 [s2]; +sine=frequency=400 * 0x3 [s3]; +sine=frequency=400 * 0x4 [s4]; +sine=frequency=400 * 0x5 [s5]; +sine=frequency=400 * 0x6 [s6]; +sine=frequency=400 * 0x7 [s7]; +sine=frequency=400 * 0x8 [s8]; +sine=frequency=400 * 0x9 [s9]; +sine=frequency=400 * 0xa [sa]; +sine=frequency=400 * 0xb [sb]; +sine=frequency=400 * 0xc [sc]; +sine=frequency=400 * 0xd [sd]; +sine=frequency=400 * 0xe [se]; +sine=frequency=400 * 0xf [sf]; + +sine=frequency=400 * 0x10 [s10]; +sine=frequency=400 * 0x11 [s11]; +sine=frequency=400 * 0x12 [s12]; +sine=frequency=400 * 0x13 [s13]; +sine=frequency=400 * 0x14 [s14]; +sine=frequency=400 * 0x15 [s15]; +sine=frequency=400 * 0x16 [s16]; +sine=frequency=400 * 0x17 [s17]; +sine=frequency=400 * 0x18 [s18]; +sine=frequency=400 * 0x19 [s19]; +sine=frequency=400 * 0x1a [s1a]; +sine=frequency=400 * 0x1b [s1b]; +sine=frequency=400 * 0x1c [s1c]; +sine=frequency=400 * 0x1d [s1d]; +sine=frequency=400 * 0x1e [s1e]; +sine=frequency=400 * 0x1f [s1f]; + +sine=frequency=400 * 0x20 [s20]; +sine=frequency=400 * 0x21 [s21]; +sine=frequency=400 * 0x22 [s22]; +sine=frequency=400 * 0x23 [s23]; +sine=frequency=400 * 0x24 [s24]; +sine=frequency=400 * 0x25 [s25]; +sine=frequency=400 * 0x26 [s26]; +sine=frequency=400 * 0x27 [s27]; +sine=frequency=400 * 0x28 [s28]; +sine=frequency=400 * 0x29 [s29]; +sine=frequency=400 * 0x2a [s2a]; +sine=frequency=400 * 0x2b [s2b]; +sine=frequency=400 * 0x2c [s2c]; +sine=frequency=400 * 0x2d [s2d]; +sine=frequency=400 * 0x2e [s2e]; +sine=frequency=400 * 0x2f [s2f]; + +sine=frequency=400 * 0x30 [s30]; +sine=frequency=400 * 0x31 [s31]; +sine=frequency=400 * 0x32 [s32]; +sine=frequency=400 * 0x33 [s33]; +sine=frequency=400 * 0x34 [s34]; +sine=frequency=400 * 0x35 [s35]; +sine=frequency=400 * 0x36 [s36]; +sine=frequency=400 * 0x37 [s37]; +sine=frequency=400 * 0x38 [s38]; +sine=frequency=400 * 0x39 [s39]; +sine=frequency=400 * 0x3a [s3a]; +sine=frequency=400 * 0x3b [s3b]; +sine=frequency=400 * 0x3c [s3c]; +sine=frequency=400 * 0x3d [s3d]; +sine=frequency=400 * 0x3e [s3e]; +sine=frequency=400 * 0x3f [s3f]; + +sine=frequency=400 * 0x40 [s40]; +sine=frequency=400 * 0x41 [s41]; + +[s0] [s1] [s2] [s3] [s4] [s5] [s6] [s7] [s8] [s9] [sa] [sb] [sc] [sd] [se] [sf] +[s10][s11][s12][s13][s14][s15][s16][s17] [s18][s19][s1a][s1b][s1c][s1d][s1e][s1f] +[s20][s21][s22][s23][s24][s25][s26][s27] [s28][s29][s2a][s2b][s2c][s2d][s2e][s2f] +[s30][s31][s32][s33][s34][s35][s36][s37] [s38][s39][s3a][s3b][s3c][s3d][s3e][s3f] +[s40][s41] join=inputs=0x42:channel_layout=ambisonic 7+stereo, +atrim=end_sample=1024, +channelmap=channel_layout=ambisonic 7+stereo:map=AMBI0-AMBI1|AMBI1-AMBI2|AMBI2-AMBI3|AMBI3-AMBI4|AMBI4-AMBI5|AMBI5-AMBI6|AMBI6-AMBI7|AMBI7-AMBI8|AMBI8-AMBI9|AMBI9-AMBI10|AMBI10-AMBI11|AMBI11-AMBI12|AMBI12-AMBI13|AMBI13-AMBI14|AMBI14-AMBI15|AMBI15-AMBI16|AMBI16-AMBI17|AMBI17-AMBI18|AMBI18-AMBI19|AMBI19-AMBI20|AMBI20-AMBI21|AMBI21-AMBI22|AMBI22-AMBI23|AMBI23-AMBI24|AMBI24-AMBI25|AMBI25-AMBI26|AMBI26-AMBI27|AMBI27-AMBI28|AMBI28-AMBI29|AMBI29-AMBI30|AMBI30-AMBI31|AMBI31-AMBI32|AMBI32-AMBI33|AMBI33-AMBI34|AMBI34-AMBI35|AMBI35-AMBI36|AMBI36-AMBI37|AMBI37-AMBI38|AMBI38-AMBI39|AMBI39-AMBI40|AMBI40-AMBI41|AMBI41-AMBI42|AMBI42-AMBI43|AMBI43-AMBI44|AMBI44-AMBI45|AMBI45-AMBI46|AMBI46-AMBI47|AMBI47-AMBI48|AMBI48-AMBI49|AMBI49-AMBI50|AMBI50-AMBI51|AMBI51-AMBI52|AMBI52-AMBI53|AMBI53-AMBI54|AMBI54-AMBI55|AMBI55-AMBI56|AMBI56-AMBI57|AMBI57-AMBI58|AMBI58-AMBI59|AMBI59-AMBI60|AMBI60-AMBI61|AMBI61-AMBI62|AMBI62-AMBI63|AMBI63-FL|FL-FR|FR-AMBI0, +channelsplit=channel_layout=ambisonic 7+stereo diff --git a/tests/ref/fate/filter-crazychannels b/tests/ref/fate/filter-crazychannels new file mode 100644 index 0000000000..db4e63a833 --- /dev/null +++ b/tests/ref/fate/filter-crazychannels @@ -0,0 +1,396 @@ +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: pcm_s16le +#sample_rate 0: 44100 +#channel_layout_name 0: ambisonic 0 +#tb 1: 1/44100 +#media_type 1: audio +#codec_id 1: pcm_s16le +#sample_rate 1: 44100 +#channel_layout_name 1: 1 channels (AMBI1) +#tb 2: 1/44100 +#media_type 2: audio +#codec_id 2: pcm_s16le +#sample_rate 2: 44100 +#channel_layout_name 2: 1 channels (AMBI2) +#tb 3: 1/44100 +#media_type 3: audio +#codec_id 3: pcm_s16le +#sample_rate 3: 44100 +#channel_layout_name 3: 1 channels (AMBI3) +#tb 4: 1/44100 +#media_type 4: audio +#codec_id 4: pcm_s16le +#sample_rate 4: 44100 +#channel_layout_name 4: 1 channels (AMBI4) +#tb 5: 1/44100 +#media_type 5: audio +#codec_id 5: pcm_s16le +#sample_rate 5: 44100 +#channel_layout_name 5: 1 channels (AMBI5) +#tb 6: 1/44100 +#media_type 6: audio +#codec_id 6: pcm_s16le +#sample_rate 6: 44100 +#channel_layout_name 6: 1 channels (AMBI6) +#tb 7: 1/44100 +#media_type 7: audio +#codec_id 7: pcm_s16le +#sample_rate 7: 44100 +#channel_layout_name 7: 1 channels (AMBI7) +#tb 8: 1/44100 +#media_type 8: audio +#codec_id 8: pcm_s16le +#sample_rate 8: 44100 +#channel_layout_name 8: 1 channels (AMBI8) +#tb 9: 1/44100 +#media_type 9: audio +#codec_id 9: pcm_s16le +#sample_rate 9: 44100 +#channel_layout_name 9: 1 channels (AMBI9) +#tb 10: 1/44100 +#media_type 10: audio +#codec_id 10: pcm_s16le +#sample_rate 10: 44100 +#channel_layout_name 10: 1 channels (AMBI10) +#tb 11: 1/44100 +#media_type 11: audio +#codec_id 11: pcm_s16le +#sample_rate 11: 44100 +#channel_layout_name 11: 1 channels (AMBI11) +#tb 12: 1/44100 +#media_type 12: audio +#codec_id 12: pcm_s16le +#sample_rate 12: 44100 +#channel_layout_name 12: 1 channels (AMBI12) +#tb 13: 1/44100 +#media_type 13: audio +#codec_id 13: pcm_s16le +#sample_rate 13: 44100 +#channel_layout_name 13: 1 channels (AMBI13) +#tb 14: 1/44100 +#media_type 14: audio +#codec_id 14: pcm_s16le +#sample_rate 14: 44100 +#channel_layout_name 14: 1 channels (AMBI14) +#tb 15: 1/44100 +#media_type 15: audio +#codec_id 15: pcm_s16le +#sample_rate 15: 44100 +#channel_layout_name 15: 1 channels (AMBI15) +#tb 16: 1/44100 +#media_type 16: audio +#codec_id 16: pcm_s16le +#sample_rate 16: 44100 +#channel_layout_name 16: 1 channels (AMBI16) +#tb 17: 1/44100 +#media_type 17: audio +#codec_id 17: pcm_s16le +#sample_rate 17: 44100 +#channel_layout_name 17: 1 channels (AMBI17) +#tb 18: 1/44100 +#media_type 18: audio +#codec_id 18: pcm_s16le +#sample_rate 18: 44100 +#channel_layout_name 18: 1 channels (AMBI18) +#tb 19: 1/44100 +#media_type 19: audio +#codec_id 19: pcm_s16le +#sample_rate 19: 44100 +#channel_layout_name 19: 1 channels (AMBI19) +#tb 20: 1/44100 +#media_type 20: audio +#codec_id 20: pcm_s16le +#sample_rate 20: 44100 +#channel_layout_name 20: 1 channels (AMBI20) +#tb 21: 1/44100 +#media_type 21: audio +#codec_id 21: pcm_s16le +#sample_rate 21: 44100 +#channel_layout_name 21: 1 channels (AMBI21) +#tb 22: 1/44100 +#media_type 22: audio +#codec_id 22: pcm_s16le +#sample_rate 22: 44100 +#channel_layout_name 22: 1 channels (AMBI22) +#tb 23: 1/44100 +#media_type 23: audio +#codec_id 23: pcm_s16le +#sample_rate 23: 44100 +#channel_layout_name 23: 1 channels (AMBI23) +#tb 24: 1/44100 +#media_type 24: audio +#codec_id 24: pcm_s16le +#sample_rate 24: 44100 +#channel_layout_name 24: 1 channels (AMBI24) +#tb 25: 1/44100 +#media_type 25: audio +#codec_id 25: pcm_s16le +#sample_rate 25: 44100 +#channel_layout_name 25: 1 channels (AMBI25) +#tb 26: 1/44100 +#media_type 26: audio +#codec_id 26: pcm_s16le +#sample_rate 26: 44100 +#channel_layout_name 26: 1 channels (AMBI26) +#tb 27: 1/44100 +#media_type 27: audio +#codec_id 27: pcm_s16le +#sample_rate 27: 44100 +#channel_layout_name 27: 1 channels (AMBI27) +#tb 28: 1/44100 +#media_type 28: audio +#codec_id 28: pcm_s16le +#sample_rate 28: 44100 +#channel_layout_name 28: 1 channels (AMBI28) +#tb 29: 1/44100 +#media_type 29: audio +#codec_id 29: pcm_s16le +#sample_rate 29: 44100 +#channel_layout_name 29: 1 channels (AMBI29) +#tb 30: 1/44100 +#media_type 30: audio +#codec_id 30: pcm_s16le +#sample_rate 30: 44100 +#channel_layout_name 30: 1 channels (AMBI30) +#tb 31: 1/44100 +#media_type 31: audio +#codec_id 31: pcm_s16le +#sample_rate 31: 44100 +#channel_layout_name 31: 1 channels (AMBI31) +#tb 32: 1/44100 +#media_type 32: audio +#codec_id 32: pcm_s16le +#sample_rate 32: 44100 +#channel_layout_name 32: 1 channels (AMBI32) +#tb 33: 1/44100 +#media_type 33: audio +#codec_id 33: pcm_s16le +#sample_rate 33: 44100 +#channel_layout_name 33: 1 channels (AMBI33) +#tb 34: 1/44100 +#media_type 34: audio +#codec_id 34: pcm_s16le +#sample_rate 34: 44100 +#channel_layout_name 34: 1 channels (AMBI34) +#tb 35: 1/44100 +#media_type 35: audio +#codec_id 35: pcm_s16le +#sample_rate 35: 44100 +#channel_layout_name 35: 1 channels (AMBI35) +#tb 36: 1/44100 +#media_type 36: audio +#codec_id 36: pcm_s16le +#sample_rate 36: 44100 +#channel_layout_name 36: 1 channels (AMBI36) +#tb 37: 1/44100 +#media_type 37: audio +#codec_id 37: pcm_s16le +#sample_rate 37: 44100 +#channel_layout_name 37: 1 channels (AMBI37) +#tb 38: 1/44100 +#media_type 38: audio +#codec_id 38: pcm_s16le +#sample_rate 38: 44100 +#channel_layout_name 38: 1 channels (AMBI38) +#tb 39: 1/44100 +#media_type 39: audio +#codec_id 39: pcm_s16le +#sample_rate 39: 44100 +#channel_layout_name 39: 1 channels (AMBI39) +#tb 40: 1/44100 +#media_type 40: audio +#codec_id 40: pcm_s16le +#sample_rate 40: 44100 +#channel_layout_name 40: 1 channels (AMBI40) +#tb 41: 1/44100 +#media_type 41: audio +#codec_id 41: pcm_s16le +#sample_rate 41: 44100 +#channel_layout_name 41: 1 channels (AMBI41) +#tb 42: 1/44100 +#media_type 42: audio +#codec_id 42: pcm_s16le +#sample_rate 42: 44100 +#channel_layout_name 42: 1 channels (AMBI42) +#tb 43: 1/44100 +#media_type 43: audio +#codec_id 43: pcm_s16le +#sample_rate 43: 44100 +#channel_layout_name 43: 1 channels (AMBI43) +#tb 44: 1/44100 +#media_type 44: audio +#codec_id 44: pcm_s16le +#sample_rate 44: 44100 +#channel_layout_name 44: 1 channels (AMBI44) +#tb 45: 1/44100 +#media_type 45: audio +#codec_id 45: pcm_s16le +#sample_rate 45: 44100 +#channel_layout_name 45: 1 channels (AMBI45) +#tb 46: 1/44100 +#media_type 46: audio +#codec_id 46: pcm_s16le +#sample_rate 46: 44100 +#channel_layout_name 46: 1 channels (AMBI46) +#tb 47: 1/44100 +#media_type 47: audio +#codec_id 47: pcm_s16le +#sample_rate 47: 44100 +#channel_layout_name 47: 1 channels (AMBI47) +#tb 48: 1/44100 +#media_type 48: audio +#codec_id 48: pcm_s16le +#sample_rate 48: 44100 +#channel_layout_name 48: 1 channels (AMBI48) +#tb 49: 1/44100 +#media_type 49: audio +#codec_id 49: pcm_s16le +#sample_rate 49: 44100 +#channel_layout_name 49: 1 channels (AMBI49) +#tb 50: 1/44100 +#media_type 50: audio +#codec_id 50: pcm_s16le +#sample_rate 50: 44100 +#channel_layout_name 50: 1 channels (AMBI50) +#tb 51: 1/44100 +#media_type 51: audio +#codec_id 51: pcm_s16le +#sample_rate 51: 44100 +#channel_layout_name 51: 1 channels (AMBI51) +#tb 52: 1/44100 +#media_type 52: audio +#codec_id 52: pcm_s16le +#sample_rate 52: 44100 +#channel_layout_name 52: 1 channels (AMBI52) +#tb 53: 1/44100 +#media_type 53: audio +#codec_id 53: pcm_s16le +#sample_rate 53: 44100 +#channel_layout_name 53: 1 channels (AMBI53) +#tb 54: 1/44100 +#media_type 54: audio +#codec_id 54: pcm_s16le +#sample_rate 54: 44100 +#channel_layout_name 54: 1 channels (AMBI54) +#tb 55: 1/44100 +#media_type 55: audio +#codec_id 55: pcm_s16le +#sample_rate 55: 44100 +#channel_layout_name 55: 1 channels (AMBI55) +#tb 56: 1/44100 +#media_type 56: audio +#codec_id 56: pcm_s16le +#sample_rate 56: 44100 +#channel_layout_name 56: 1 channels (AMBI56) +#tb 57: 1/44100 +#media_type 57: audio +#codec_id 57: pcm_s16le +#sample_rate 57: 44100 +#channel_layout_name 57: 1 channels (AMBI57) +#tb 58: 1/44100 +#media_type 58: audio +#codec_id 58: pcm_s16le +#sample_rate 58: 44100 +#channel_layout_name 58: 1 channels (AMBI58) +#tb 59: 1/44100 +#media_type 59: audio +#codec_id 59: pcm_s16le +#sample_rate 59: 44100 +#channel_layout_name 59: 1 channels (AMBI59) +#tb 60: 1/44100 +#media_type 60: audio +#codec_id 60: pcm_s16le +#sample_rate 60: 44100 +#channel_layout_name 60: 1 channels (AMBI60) +#tb 61: 1/44100 +#media_type 61: audio +#codec_id 61: pcm_s16le +#sample_rate 61: 44100 +#channel_layout_name 61: 1 channels (AMBI61) +#tb 62: 1/44100 +#media_type 62: audio +#codec_id 62: pcm_s16le +#sample_rate 62: 44100 +#channel_layout_name 62: 1 channels (AMBI62) +#tb 63: 1/44100 +#media_type 63: audio +#codec_id 63: pcm_s16le +#sample_rate 63: 44100 +#channel_layout_name 63: 1 channels (AMBI63) +#tb 64: 1/44100 +#media_type 64: audio +#codec_id 64: pcm_s16le +#sample_rate 64: 44100 +#channel_layout_name 64: 1 channels (FL) +#tb 65: 1/44100 +#media_type 65: audio +#codec_id 65: pcm_s16le +#sample_rate 65: 44100 +#channel_layout_name 65: 1 channels (FR) +0, 0, 0, 1024, 2048, 0xd782fb56 +1, 0, 0, 1024, 2048, 0x00000000 +2, 0, 0, 1024, 2048, 0xd501f2b4 +3, 0, 0, 1024, 2048, 0x3281ecb5 +4, 0, 0, 1024, 2048, 0xffb00086 +5, 0, 0, 1024, 2048, 0xe9b7f252 +6, 0, 0, 1024, 2048, 0x53e6f849 +7, 0, 0, 1024, 2048, 0xacb9f526 +8, 0, 0, 1024, 2048, 0xa79b0dcb +9, 0, 0, 1024, 2048, 0xa4eaf5c8 +10, 0, 0, 1024, 2048, 0x31010ff1 +11, 0, 0, 1024, 2048, 0xdfaa053a +12, 0, 0, 1024, 2048, 0x7321fac9 +13, 0, 0, 1024, 2048, 0x0786f54d +14, 0, 0, 1024, 2048, 0x32c7fcb7 +15, 0, 0, 1024, 2048, 0x23e8ee40 +16, 0, 0, 1024, 2048, 0xaddef714 +17, 0, 0, 1024, 2048, 0x1c6ffa69 +18, 0, 0, 1024, 2048, 0x493bfb48 +19, 0, 0, 1024, 2048, 0x8e26106e +20, 0, 0, 1024, 2048, 0x0d47f953 +21, 0, 0, 1024, 2048, 0x49a90415 +22, 0, 0, 1024, 2048, 0x5349cdcf +23, 0, 0, 1024, 2048, 0x20410430 +24, 0, 0, 1024, 2048, 0xd3f7ffbe +25, 0, 0, 1024, 2048, 0xca8902f8 +26, 0, 0, 1024, 2048, 0xfe9ffcff +27, 0, 0, 1024, 2048, 0xf1c0fd21 +28, 0, 0, 1024, 2048, 0x6007e947 +29, 0, 0, 1024, 2048, 0x33310ce6 +30, 0, 0, 1024, 2048, 0x04f103a1 +31, 0, 0, 1024, 2048, 0xf84bf6df +32, 0, 0, 1024, 2048, 0xc597027d +33, 0, 0, 1024, 2048, 0x7391ff47 +34, 0, 0, 1024, 2048, 0xd6ab0226 +35, 0, 0, 1024, 2048, 0x4b98fd12 +36, 0, 0, 1024, 2048, 0xb2510d31 +37, 0, 0, 1024, 2048, 0x11e0e994 +38, 0, 0, 1024, 2048, 0xfa5cfa07 +39, 0, 0, 1024, 2048, 0x494cf951 +40, 0, 0, 1024, 2048, 0xf87401ca +41, 0, 0, 1024, 2048, 0x188ffd8f +42, 0, 0, 1024, 2048, 0xc673f7fd +43, 0, 0, 1024, 2048, 0x3020cead +44, 0, 0, 1024, 2048, 0x0f34f9ec +45, 0, 0, 1024, 2048, 0x2f15053e +46, 0, 0, 1024, 2048, 0x4cc9e880 +47, 0, 0, 1024, 2048, 0xa7d0015a +48, 0, 0, 1024, 2048, 0x20c3fcb7 +49, 0, 0, 1024, 2048, 0xb6f80160 +50, 0, 0, 1024, 2048, 0x28f88d75 +51, 0, 0, 1024, 2048, 0xf20502a2 +52, 0, 0, 1024, 2048, 0x7f88f6f8 +53, 0, 0, 1024, 2048, 0x02690489 +54, 0, 0, 1024, 2048, 0x306af8c2 +55, 0, 0, 1024, 2048, 0xbe9a1052 +56, 0, 0, 1024, 2048, 0x344bfc0b +57, 0, 0, 1024, 2048, 0xb2a00b99 +58, 0, 0, 1024, 2048, 0x0cbe045d +59, 0, 0, 1024, 2048, 0x5830fd09 +60, 0, 0, 1024, 2048, 0x8c7900bd +61, 0, 0, 1024, 2048, 0x4a20f705 +62, 0, 0, 1024, 2048, 0x282201f6 +63, 0, 0, 1024, 2048, 0xfbb2fafa +64, 0, 0, 1024, 2048, 0x308b8f8f +65, 0, 0, 1024, 2048, 0x187bfced From patchwork Thu Sep 5 10:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51374 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp294240vqb; Thu, 5 Sep 2024 03:34:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+Qpr9m2sPiKusS+x5zndeUyWdaTQnnQpHJVyEOlZkJLYQdRNaMVzlY3KJGmNnepYjrysGLwrUvrJbm5tXevyT@gmail.com X-Google-Smtp-Source: AGHT+IFEVyBBb2tYwGaDUXAp2hv6b5dyf8KmbVKEE9ymDrHu6vnnC49oxI8KxEQHRKnfX83vaP+f X-Received: by 2002:a05:6512:224a:b0:52f:e5:3765 with SMTP id 2adb3069b0e04-53546b8f4c7mr8274737e87.6.1725532452704; Thu, 05 Sep 2024 03:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725532452; cv=none; d=google.com; s=arc-20240605; b=jJk7enEOnZ9RajIH4aoq3CtFtmFZn9RlpHG6UbM301t/wtQJJu+MUynBcmizwBZ0hh NP3Qy4OD1CZf2GY/bYViW7cHeKmBLXJoEK7e/tUHtVRnRYcRDoarLYNl90t7zfqhn7BI YAdFJOq6CNs8qFaggd1J9u+TRloHRfJmca8Hs0tpyAZDMRNg4DhblOFHnf+k7AO8P99I ov0RsgKs8ufHi/KP+EoIT4TIilb/ACd5n3N9n/++gZIKoKITe4U04ovYYruPYqsWdcxo Apz4JQ6NNwhnmvDI4eYyFIvKwxrKMdUuLV2mLutbql3N7QSwia0748oBBWb5anjAeSv/ mGLg== 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=ADNyT6QN1nmOBjHrAUkxbjHW/NlR1sy+rJONqy5rias=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=RorDroQWRC9DcAdesKONX1ZjB9ZFE4i2GzpH4uN9v48WhYFdhO0CNP9bPkfVooLmQo ewgnCHUIirOjYraiB1mOxNok2cyNNwM8NfyFKVwDTuWSqIyFW5PFfiZB6f2Ntj0nXbI1 LkJ6Uq8W0yNTKJFiy4NI10yEwSJ1vww2uRnzkdEFHJYfmjdWseDhm9SaIczgrcvjDpmD Vu3MugUtkFx+pkMye6S9o2VbnAmKo1/qzw8Q15O3slTWjYmsxPZA0z9pud7Qt57osdYp mQ6RZtxg6xJVgKH9/LITVibpAZNUmOlnJ/OhqB+KySM6qEMURi/2mK1ksPkfqaMfLnz0 SLPQ==; 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=h6kLFwn0; 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-535407eb8afsi5772374e87.327.2024.09.05.03.34.12; Thu, 05 Sep 2024 03:34:12 -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=h6kLFwn0; 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 9641C68DF6A; Thu, 5 Sep 2024 13:08:13 +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 37BD168DD28 for ; Thu, 5 Sep 2024 13:07:49 +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=h6kLFwn0; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 1657B4E25 for ; Thu, 5 Sep 2024 12:07:46 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id u9_K2CL_UpE2 for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530862; bh=3oKvmbYBpaSgCAQi929MqquBrmErvUpIu9od3DxkdNk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h6kLFwn0pTxyxVCo7mDvAZ9UHYiQPRznsCO++a9bUraJ/IztXoyFOD0D/Pu9Bynwh ypZapNKyZgU8bwNZm26zP04+ciCLsIRMEx+VXGxfAxkmYggZpRNEsVK0WpTdruJmRg 8fHv6DOkPA3vcWW1UCzL7xKLCmR+f0xzQBYC7n7NLkYntdwHXqDD9Ma7db+LGY++ix qAHVcWEe70uOlDFaSK9mA5txidoFmKIo6b1+VOJbMYnXk+tSDF9SAjBhWBS7MLIxEm DIgi/SpSn2sTf20K/9NEtru7/x6NXwmino6KD32T8qG086zaG4EIY4P6y6j1/BUCRx w42Su0wjrCD8w== 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 CBFAB4DF1 for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E99D13A181C for ; Thu, 05 Sep 2024 12:07:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2024 12:07:08 +0200 Message-ID: <20240905100729.6030-4-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 04/25] lavfi/af_channelsplit: 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: YwsjTP1rb6YF Also, drop a redundant call that also happens implicitly in generic code. --- libavfilter/af_channelsplit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 527c197fa6..64b6c7a1e1 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -118,18 +118,20 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->map); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { ChannelSplitContext *s = ctx->priv; AVFilterChannelLayouts *in_layouts = NULL; int i, ret; - if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_all_samplerates(ctx)) < 0) + ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts()); + if (ret < 0) return ret; if ((ret = ff_add_channel_layout(&in_layouts, &s->channel_layout)) < 0 || - (ret = ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0) + (ret = ff_channel_layouts_ref(in_layouts, &cfg_in[0]->channel_layouts)) < 0) return ret; for (i = 0; i < ctx->nb_outputs; i++) { @@ -156,7 +158,7 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - ret = ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->incfg.channel_layouts); + ret = ff_channel_layouts_ref(out_layouts, &cfg_out[i]->channel_layouts); if (ret < 0) return ret; } @@ -249,6 +251,6 @@ const AVFilter ff_af_channelsplit = { .uninit = uninit, FILTER_INPUTS(ff_audio_default_filterpad), .outputs = NULL, - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; From patchwork Thu Sep 5 10:07:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51378 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp308815vqb; Thu, 5 Sep 2024 04:04:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUlcG9LySF0K3GOclZdJB6EPdVqgfxRRecOLMsYU9wGn6HyN4jbpiH0Ia9O1UTFbyMTSvMt4pxhsscZXixz5qkk@gmail.com X-Google-Smtp-Source: AGHT+IEK3s6PwIiKKbJwGUvKmK5Si+KeKVbWv1rGJwSXdQ4QMAjobjEA4yEzcp9FIq5I1s2RW1xc X-Received: by 2002:a17:907:9813:b0:a6f:593f:d336 with SMTP id a640c23a62f3a-a897f77ea6amr1672585266b.11.1725534257207; Thu, 05 Sep 2024 04:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725534257; cv=none; d=google.com; s=arc-20240605; b=EwtYuWV9UC1uhQEVHDWRv8WQbG+bpM16Yclor3HfK7WjYV7P4aFTtfT0xCXp1jI0O4 T9K8+6zEAiknAhyF7iNF0c93Hyw6RDCexLv7VrhKIbwq0OlYlfylqGVy35/jRcbZG8A2 Gad+khNXp5ZD4Qr+CAPZp9jmSobaMmWnBrCiN/UsnMT6M6DkwXz0dt+92L/tWHXSEA5O v+Yp094OgVE2oRWGsFApQsTcRZzfix+PCCui6F8n1tUOUMVI1nFgydWCVn4493OiKCQg GKbuBXoDvegNyMWWF73yp8EN6rpyftaGkEOSYnoCmMf9EBAArGguV4uovn5mXVe7m70P wvjg== 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=yt1CkUO6wwGv1goUF3Ov6+uKHZSPCsd94NTSKNcoUBQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=ePZuQ9ovh3eFHyVZ5l1EzdfnYlvu2jjwxZOOWgzuHwiXTQlGWuS/pUamMpeDgzNDUT ZkxR9S04PyKr3fzR7/W6G5YTdzthBKILx2AtQ7MEAHx6wXECKaELpkqm0vWFy/ZY2wbs 5jGj1csfopx8n2YaIWa0KdRYaWz/xMm5ZNOrBor2Y3QqR67fRRIIlza7RUp5lwlrVOmG Q7vUZGl/mQ5AXCm0LPQ84hJYQSsrCp5xWSPUNHOfDj78tqEqfrQ9ubKjgf5ehc8EXes5 HvSIAJmQthcrGZkDNcz5T8SuRKusyqSd5DQandBiZCd2KGtTaKnybVNJf6l0K1Biyf8g vY1Q==; 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=B4BO4dEZ; 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-a8a623c6677si128872766b.527.2024.09.05.04.04.16; Thu, 05 Sep 2024 04:04: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=B4BO4dEZ; 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 6A3E968DF7B; Thu, 5 Sep 2024 13:08: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 380FB68DD2F for ; Thu, 5 Sep 2024 13:07:49 +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=B4BO4dEZ; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 5CFC64DF1 for ; Thu, 5 Sep 2024 12:07:46 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id TuvttWijUig3 for ; Thu, 5 Sep 2024 12:07:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530862; bh=OwKt5u+y4rj1Y/eZm1VAmrO3YAD1V09WffZOjfvIaXw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B4BO4dEZfU1fIrO6g48lFOSh32htWyYXWh82EtcJ9uIpL1YXAYpR0qESsuLurZgfx Qv8euhTYV2hDzoxVXcJkscirNkqPq+DUkfPjfpv9mQfbo547hniHKtP4kifgDtZqTn p/rlhBZ8r9uMSROQrCj1gvbFc+qWD8ZVDEMevWM4tAMnbVQCPzAcBhFrCw2t5bzsrB CG3IPeHeATG0dfyhcxxTgcsyhBjz2V8MmeloAotyXZLK3yMj6JqTYFCcSoVGicfYlv flQNzk+csOgTeQVTTvxDfnt1hye7oQxSbxKtNI9mFQoNrPRJ908Fk/CDl9wxzbPkfm CZQoelRkF5fhw== 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 E0C974E2A for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 009A53A181F 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:09 +0200 Message-ID: <20240905100729.6030-5-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 05/25] lavfi/af_crossfeed: 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: QIqIOJ2DwqMa Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_crossfeed.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c index 36f05cfd21..91f5a4772e 100644 --- a/libavfilter/af_crossfeed.c +++ b/libavfilter/af_crossfeed.c @@ -48,17 +48,27 @@ typedef struct CrossfeedContext { double *side[3]; } CrossfeedContext; -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_all_samplerates (ctx )) < 0) + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); + if (ret < 0) + return ret; + + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) return ret; return 0; @@ -372,7 +382,7 @@ const AVFilter ff_af_crossfeed = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = process_command, }; From patchwork Thu Sep 5 10:07:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51371 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286503vqb; Thu, 5 Sep 2024 03:19:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU6n5sc2G2D7QSmpZYTAYiHVsL6TfCwobAULncRALP13AM05xmRbwReRNPXAAvwr5Xj0PJOwwfAy/cfwmWICjC7@gmail.com X-Google-Smtp-Source: AGHT+IGqEnEOQ4w1PtCUK7OS2rRQx0LUTaR8eDrVaM/frFhnyx/LE8GI8rR2nTmuEFfBmysn6vFo X-Received: by 2002:a05:6512:a8c:b0:52f:c142:6530 with SMTP id 2adb3069b0e04-53546b63841mr7668242e87.6.1725531559269; Thu, 05 Sep 2024 03:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531559; cv=none; d=google.com; s=arc-20240605; b=J0QJWWuMZ+uIl/BpwqctYDBXVhD4m6pDhu5b/ALVXeIfdPN6jJC/fKw+3mc/KQJNMG 7EYT7LKdRO8oj5bY4QLbHp/Dp1mhma6v/5dYtSR1mIxkgbQYJRB6VokXdX/T4+C4uWgp 3+ww57hpEilO7ugLYOdEuXX36EiNYuXjpE9+4FIvatxxMsFwA2TnZy9/LwI+OgveqI6P LHdpX6y85RC0qYAbzT+tyzPIeW3hnWAA9LFW/2EL5L2EV+HZ/VrEjiyH2NxzL7wNUeEc VjkS266k2HIkhwa5bP8jsJbXfja8tvEzoPg6wKrfYK6AQgnnE6Rwq6Em/0cPEIePBHtK RZqQ== 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=+xuHarjiR1EOyNaczAS7JB82KCqBj6gzYAWSgNzpHds=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=TzH+kXrjL5LbMpRoe9kD8W7rxXufsarfIsBjkNovq01P57hAj4NAJ946o2ONPxJtl9 d3ic+KbeqplPobFx8VMlkDUCd0WlxGdpDdQ0XP5mGxkXnOuLd2eQUlgSWgsdNkzuQo9P prKhRw7hfHalW+6UqdzX3U4h3F/sHgUUqtOJON4Xb0xJfWqTxt2HfrEwmE+NjJzeAMpS gFbcm2GmJT+y+PBOj9iIDNFV/c8eAbVo35UbKiFHmWoPRpljRJKFljUl3i7e8O/tUbsJ UqzVCTC8ZiYDWx3mXfpcK91CKYOXekEsyPfmAfILnTwXEIXIZQHGGot0rt4Iimgkv/G9 73pw==; 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=CrdIQjdi; 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-a8a66d97ab9si102268866b.787.2024.09.05.03.19.18; Thu, 05 Sep 2024 03:19:19 -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=CrdIQjdi; 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 15B4568DF8D; 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 6DB8F68DD28 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=CrdIQjdi; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 8517A4E04 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 80Dil7qawX9E 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=VoShU13FhmLZ6z5rWptaYJUHTSUtcKWX6B6kS32zo3k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CrdIQjdimYKWKW2j23XsXJIAml9KSXLsoCCWIV3MYx6X5mAEYvg2T0HZHJvAbGb3j olGZ5pk1sgzx/UniE1NU6xGUtq0xUVkuex96+NG7q+E/xF4jbEZmj249tpUU+KJvHU mRrpy1nvL1YjOIZH7KgaxKJxzBlKNaZdLAl2KEvP79++jvwcgybJbYxX8nEHSNPC2O 5j87dtlo1ilQi8REcSm9e9I7NdH5FxV1zxbEoL76YHZ1U+b5B8MbFPCfW1Srp4DNYF f+PXwEcR0qGzPfcj6LBOAk30yoNUvCw3CbkvAgAG05tWI3EVsMS2W63A8b22hqRKMw BLJpUL/Ua0ylw== 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 50FC44DF8 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 0BF5A3A1983 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:10 +0200 Message-ID: <20240905100729.6030-6-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 06/25] lavfi/af_dialoguenhance: 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: NMCDHFruvWFf Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_dialoguenhance.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_dialoguenhance.c b/libavfilter/af_dialoguenhance.c index b77e85198f..cae8375547 100644 --- a/libavfilter/af_dialoguenhance.c +++ b/libavfilter/af_dialoguenhance.c @@ -69,22 +69,30 @@ static const AVOption dialoguenhance_options[] = { AVFILTER_DEFINE_CLASS(dialoguenhance); -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - AVFilterFormats *formats = NULL; + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_NONE, + }; + AVFilterChannelLayouts *in_layout = NULL, *out_layout = NULL; int ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLTP )) < 0 || - (ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBLP )) < 0 || - (ret = ff_set_common_formats (ctx , formats )) < 0 || - (ret = ff_add_channel_layout (&in_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || - (ret = ff_channel_layouts_ref(in_layout, &ctx->inputs[0]->outcfg.channel_layouts)) < 0 || - (ret = ff_add_channel_layout (&out_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND)) < 0 || - (ret = ff_channel_layouts_ref(out_layout, &ctx->outputs[0]->incfg.channel_layouts)) < 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); + if ((ret = ff_add_channel_layout (&in_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || + (ret = ff_channel_layouts_ref(in_layout, &cfg_in[0]->channel_layouts)) < 0 || + (ret = ff_add_channel_layout (&out_layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND)) < 0 || + (ret = ff_channel_layouts_ref(out_layout, &cfg_out[0]->channel_layouts)) < 0) + return ret; + + return 0; } #define DEPTH 32 @@ -217,7 +225,7 @@ const AVFilter ff_af_dialoguenhance = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .activate = activate, .process_command = ff_filter_process_command, From patchwork Thu Sep 5 10:07:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51361 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp281064vqb; Thu, 5 Sep 2024 03:08:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXXPHuH6uRoUqDZaNn0JFNYPSZ4oN7iDyA2OQx4hUFUkK5p0BOgrDQl4N3PN6eGt3WDsQ/EeFmIEvuBwOid3jOo@gmail.com X-Google-Smtp-Source: AGHT+IER+KSY+r5O5JrZJ/AAMwERvnH3KSv7VjKMIEGzvPLOtuYEZMY1l1iLbo/G5noGRTrYJ3fQ X-Received: by 2002:a05:6512:159f:b0:52c:d753:2829 with SMTP id 2adb3069b0e04-53546b36b1dmr16178225e87.19.1725530924040; Thu, 05 Sep 2024 03:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725530924; cv=none; d=google.com; s=arc-20240605; b=Cpe8ctFuXuWShbEoFgAvKhPBEgg6yFU2kNvSMSnZKZ1SRLW48IPEL76Zz8S68igKZc JYLc+ZQU+PBfL+bs+Kfw2aqG9NC8liUc9it1Xbz29/GRT2Jxex5ZGcUc2tWCPVM/KANg Ji51+FHVV2TU0z5T3UDf3kybQ46z+eMH0O6/CJzrE6xtnc/DLOuOiT8w1RpQ5GrcABnw uPXFX/uXhWU09PzEtDxW7drRmhiBlU6HmXX1fe7ZN7iqjY5vZlHEE55Y4v/hDaBQ7LF+ 0ueaiu69Sc5qga0i2n+cizPJitI7qxGuoReC61RY2Pb4gXYKAWUszgvb/nEI0RIMv1YC KQZA== 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=PnLCWQKFTSLUpx4uPLH/nWpw/V85zAEHZUqhsr5SAYo=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=YPzM+69mcsSoORT4z/Gf+TaKhYCoF4UqerjrWLcPaaBnp5hhP7lpcmwnrpc4cFvq3Q UyY7AjKRceeekx5PupKzvIFlhEubecYXja4Cn6hlvykeogbsDChar0QKuY5fOYVfFgCS YkfkJqZNCh71OFx10IYDCNiLVpBYXjxOBarEvK8oiBPV9583Cr+FEzF+1kZkWRAlgHGU jT2jQswszDzly79dwVuVu1lo/q8b+99t4PcYiL2EhHAtoP1wtq6S0HJEvFAVYMzyW3IO aReOHJk0c8Tr3rjTFMV0Q6Kb2ZhdXyIE45QdoDLhVGmJCEgqJDjM05hX9b7cU6HILVtP Ldqg==; 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=YG28zW5R; 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-5c3cc5523d4si1329481a12.187.2024.09.05.03.08.43; Thu, 05 Sep 2024 03:08:44 -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=YG28zW5R; 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 9CAC468DDE5; Thu, 5 Sep 2024 13:07:57 +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 8A4B468DC5F for ; Thu, 5 Sep 2024 13:07:43 +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=YG28zW5R; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 36E9B4E05 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 ylykADUuAI5j for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=CWqcNcs+OYLSidlY/0NcgSP/ZfQADR5kPQ1TYPfOnOY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YG28zW5RFtu5jGoGUh1kM5/QZ/rIceUUIqCFDeTeuKXokEs5B8wFPmeI88GuqcJBj KilmOF+fxQzoaUKBvcVLoLOpzpnw3hxCatqbw0OKpOy0afjHgjyjtAIH1vI/eBLltP tLhdf7MEcPKDN7uZiWQuvbcMA/YxK5BC1oZ2VDlrjS1TsJ0oy7tK0INWiVG7EDOIjo hGyU/CuGST7XehuNYndmv4xdcXmqNDFVLf/rhg1saQZMKeSvOZ6wphAznkZ3abWG7T lTBu1GLasHU7wqVkMK8kkAq8rtQ6SR1E1VzQq2prQ6+P1JFymzLaDWjZ+ub/1YfhsJ UefWt0Ckb1Fsg== 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 58CF14E04 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 16B1E3A1AB9 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:11 +0200 Message-ID: <20240905100729.6030-7-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 07/25] lavfi/af_earwax: 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: BWifMixtr3q6 --- libavfilter/af_earwax.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_earwax.c b/libavfilter/af_earwax.c index cd19ac421e..7d7e060a33 100644 --- a/libavfilter/af_earwax.c +++ b/libavfilter/af_earwax.c @@ -79,19 +79,32 @@ typedef struct EarwaxContext { AVFrame *frame[2]; } EarwaxContext; -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_NONE, + }; + static const AVChannelLayout layouts[] = { + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, + (AVChannelLayout){ .nb_channels = 0 }, + }; static const int sample_rates[] = { 44100, -1 }; + int ret; - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layout = NULL; + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); + if (ret < 0) + return ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_S16P )) < 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_samplerates_from_list(ctx, sample_rates)) < 0) + ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); + if (ret < 0) + return ret; + + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) return ret; return 0; @@ -230,5 +243,5 @@ const AVFilter ff_af_earwax = { .uninit = uninit, FILTER_INPUTS(earwax_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), }; From patchwork Thu Sep 5 10:07:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51357 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp280909vqb; Thu, 5 Sep 2024 03:08:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8AqYy4h/jrW9n/WM6u4VXQ1eeHDXPW41mDvBY1kdM2PGx6egOk91XQdIwExJi5TDehtuenqxFkRLDRAlvceCa@gmail.com X-Google-Smtp-Source: AGHT+IGbTMaxjKGW4uztmo/bITuTlDboVLUc8dZSgy85vLS0DBjf2XkC/sDxDaFLSA0tDJYNSd++ X-Received: by 2002:a2e:b8d1:0:b0:2f0:1d51:a8fa with SMTP id 38308e7fff4ca-2f64d547255mr54545351fa.30.1725530905002; Thu, 05 Sep 2024 03:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725530904; cv=none; d=google.com; s=arc-20240605; b=PnpstVFNffBX8IG4Aowk7HdUE6LbfKcxFHV2DtcxZlM3tiCOd4SqR0CDeUHZ/Rqxge TuKQaaM8eThhw0F+mlSO62yBbJkbQIy1AxrQPHyeT2ihmtn3cR7ltoUivdHY/+yBsKXQ PmTrDnofjmoYkFFG13EJW8pGm+RaxiNTilqy0VJJNY0nGLyCDSvZmTCJHZQeD0iE8/S3 81m0fmVRto9HZEhanDoso9VkO4QGzmdnec4+2K4IkxeF1zegXelv6tcipfk1ezELqAPS Omctoy0STlqqU39GWPk8XTUZ2Zyg+BmhO28Ns+WQJpTF+Nc4lV9kqd+Pc2BTdJRV/Gsj 5IhA== 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=PvqAa1hIytXrV4+mZlsvqC8jBgjhIpKAXhsWMt7JSSE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gC326p8SV+wwGQs9OUSjNue3X8RquJPYGi/Izad6rnnKQ8An+oaiLgi2XZm7xrYfuI OnbOAp5b91GttHIlfVxx8/v2xg12lRd/YZX6JRXppusVUTfhuliSES9ROBj34DhJLjqE ukQ9at+YCRh9p0ncrhm+rwFA3yy4u0apM5Vyai5wY3xSeNX1cYU56Nh9tP3IUOZ752YR /AKMvtfWOMa4APsVPg0oYeTd8EP3oMsbsUCosNW3jfToFRrpc5i0ReYdFXxol1/g/aFV K9MZMM4q/ZTz7N8195vA3b2ZGBIw0UCQtmOJsNXD5UlJW8/XU7lxQ7NnnXeV2S3VZWtk GYTQ==; 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="IVRZAtI/"; 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-2f661bbf5d8si6404601fa.169.2024.09.05.03.08.24; Thu, 05 Sep 2024 03:08:24 -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="IVRZAtI/"; 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 A180868DD31; Thu, 5 Sep 2024 13:07:54 +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 3511668DCB3 for ; Thu, 5 Sep 2024 13:07:43 +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=IVRZAtI/; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id CC65D4E29 for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 00d3Dl3wpvLv for ; Thu, 5 Sep 2024 12:07:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=UMyQNiiRPPaKXsCY0NXzw3Zm7xDwvmxop5qx8NcyH4A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IVRZAtI/LMDFsdH/cepN9UNhbQIQL/mXG5oofzp4DvQn7Zsm6KZu7Id6bIVmGHZz1 ppPFGD4Hf6bbd9yyOO2GY/SnTonOc3oankyYKZtruiyqOyI7xKy9HvzmrNejtA7Tar Bn8APHctecnyA49ALuZh8vXQBTrE8+YdGGfSdPiNRI/mbvwPGc7Rj24LT3V0xj+QMT TS3sMCOorqWqVXV3XOeKSsvBmdmuAbZCFCF9s89ZPft0o4uX/TUa+wfmX9HipCuo2y ciH/foy2EP9cF34xAToK29rVMdHqXdxcMASFTkot3h4G59BRc9kvSM3Fz5CUf3aeaf d3f5s3v6kPblQ== 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 5C32D4E05 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 21C9F3A1F24 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:12 +0200 Message-ID: <20240905100729.6030-8-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 08/25] lavfi/af_extrastereo: 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: 76RnCKgxEwfN Also, drop a redundant call that also happens implicitly in generic code. --- libavfilter/af_extrastereo.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_extrastereo.c b/libavfilter/af_extrastereo.c index 6563b39402..dc5cc76fa4 100644 --- a/libavfilter/af_extrastereo.c +++ b/libavfilter/af_extrastereo.c @@ -42,19 +42,30 @@ static const AVOption extrastereo_options[] = { AVFILTER_DEFINE_CLASS(extrastereo); -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_FLT, + 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_FLT )) < 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 filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -118,7 +129,7 @@ const AVFilter ff_af_extrastereo = { .priv_class = &extrastereo_class, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, }; 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), }; From patchwork Thu Sep 5 10:07: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: 51369 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286486vqb; Thu, 5 Sep 2024 03:19:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX0/YhMb51wuyB7jCGyoh/qcjBnny/0gotShiResUKx+3r/w4YkvAQ0IDUGTSPUDk4apm5SlJEm+LUTmA44b6s4@gmail.com X-Google-Smtp-Source: AGHT+IG+UkrqjkbaSaSNUV3BAV0kT6cS8SKf26lDYgSH6F40lELZML7eUs/R3CmglrD20wRpfbpR X-Received: by 2002:a17:907:1c10:b0:a80:f54a:f428 with SMTP id a640c23a62f3a-a89a3457808mr860340866b.2.1725531557370; Thu, 05 Sep 2024 03:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531557; cv=none; d=google.com; s=arc-20240605; b=lxUDv6eN0cDNT5QDajfl+XqW5A1Mlx8CMXDO6jRCl2eX3FruN2IsI9HadmriB+dAWJ GjiO1U/hlICltGYBLoQjqMXnLI2GY+SR0O0Nf7Tz7JBInOFkj4qFHGc+wqmHTFxCaRfH 820dmSQtrZPpBOC4H361JeP4iXssaZ7SmCsrEYhC/RxsjL8dFO2wZOayQS+f7pCvFJsh WyBkM8yq0Tj/ik/CX67Vgamhgxc5A/bY1AdWwF7PtkoF3//QHwb2F8bvAvdvdz+4Nw5R Q7bvR3JGhqttroZXiWXFhHHRLWrxEhdpPIFvVywd9vsPFhHrpYCkv5DX2qxykWpLC+Vl JTgQ== 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=Ri+of9govuESd4BOvc9N5MVSRj2SH31Y6B+u7belK10=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=UgPEiK7ZfNf7Rq19rUAmooSdHrjRMcZuYTmaDEh/xicIj5iPvJNudnsiiKxKA2Mz0m PDEEOH8vuOKHQ9aTMBPOffeqqMTrO3x10r3GIWMtILafxWW9nWj/NhK9FcSQlgkFhy4r AbojndbyX7T4OZmimnmLu0OG5xEYojCMBt8mILZM5nRRX5BHcjGx36M7ddCJA1PCvwEB bYffCXLwX8tm4odZpGOJ5jHe9oQJuGbdIxrdqLaPHgJnubiJwL1bHR7KUnVTi5xd6LFJ LnaumIYWvAoiW2AGjjLShdibFN5YInff9li/jV6inI7C4Bk2Gl+fgHG2ZPZEKq6y5Gbp AgaA==; 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=htQBHTjY; 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-a8a7810282csi48661566b.325.2024.09.05.03.19.16; Thu, 05 Sep 2024 03:19: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=htQBHTjY; 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 B720268DFB7; Thu, 5 Sep 2024 13:08:17 +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 7670E68DDA3 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=htQBHTjY; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D42224E07 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 WL6i_h4MttX2 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=w0pfYTgrSE5YOpZ2QjkzZZT10aa+d4KRc8bfiFtCVhA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=htQBHTjYYLQ09iAud5pLKA+OG6Y4LlWjyDXpS/PUfkw9Pg+s+cL31mT/mVFMYXDg1 8dUSbPiWWbKhTHohK2fNZvYm+HoZU92Cl/dQDqB/NwWLSyHlY+FTWIF1U2PbB8LZ3y /MAmp3Fhsw28nYr34BDtjK9+N6gnVRICj90XuUvBuiqnfOBcoJRw2rBa+nUPrE6tRA Sti2WIULVD0J3GlbdlyFjJXV8ieogguUID0NCPqy82HIipJH9LSvhrB3G95NvPSsSC f5i3q2QV/f6Gj2C8f0Dg0sOGKfPN6xYms0CClp74iUzuDFQzHKJ66BKTRDI9Skyufr GttlzPng+4yzg== 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 6CF494E0A 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 394573A25AA 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:14 +0200 Message-ID: <20240905100729.6030-10-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 10/25] lavfi/af_hdcd: 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: znGVYWIBwQ00 --- libavfilter/af_hdcd.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 40d62c8793..5b408bb5af 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -1601,8 +1601,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return ff_filter_frame(outlink, out); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { + static const AVChannelLayout layouts[] = { + (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, + (AVChannelLayout){ .nb_channels = 0 }, + }; static const int sample_rates[] = { 44100, 48000, 88200, 96000, @@ -1611,9 +1618,6 @@ static int query_formats(AVFilterContext *ctx) }; AVFilterFormats *in_formats; AVFilterFormats *out_formats; - AVFilterChannelLayouts *layouts = NULL; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts_in[] = { AV_SAMPLE_FMT_S16, @@ -1628,28 +1632,21 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO); - if (ret < 0) - return ret; - ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); - if (ret < 0) - return ret; - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); if (ret < 0) return ret; in_formats = ff_make_format_list(sample_fmts_in); - ret = ff_formats_ref(in_formats, &inlink->outcfg.formats); + ret = ff_formats_ref(in_formats, &cfg_in[0]->formats); if (ret < 0) return ret; out_formats = ff_make_format_list(sample_fmts_out); - ret = ff_formats_ref(out_formats, &outlink->incfg.formats); + ret = ff_formats_ref(out_formats, &cfg_out[0]->formats); if (ret < 0) return ret; - return ff_set_common_samplerates_from_list(ctx, sample_rates); + return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); } static av_cold void uninit(AVFilterContext *ctx) @@ -1770,5 +1767,5 @@ const AVFilter ff_af_hdcd = { .uninit = uninit, FILTER_INPUTS(avfilter_af_hdcd_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), }; From patchwork Thu Sep 5 10:07:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51363 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp281152vqb; Thu, 5 Sep 2024 03:08:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWYE7VewKxaZFe9bmq5Otwrvr/AVL5CP3PSVRrnudv7GVe10ho7p+lyuQVuxDp0BVAg9zBvDdMRSOm9ZYmyhGS6@gmail.com X-Google-Smtp-Source: AGHT+IG9+PkcF6nkrGXORQ7U8aCD7Sm/PYF2uyTvHthikbZqvZKHGFv+9U4hbshdk8OJqkOGWBFy X-Received: by 2002:a05:6512:124f:b0:52c:def2:d8af with SMTP id 2adb3069b0e04-53546afcdc8mr7998157e87.4.1725530935112; Thu, 05 Sep 2024 03:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725530935; cv=none; d=google.com; s=arc-20240605; b=KIKspIuosWUg8zcTPA461aDHf/v8e6Bh55XD2O71fHfJVfdfb85vlcSV0EJhmXj0WI ZnYcOyv2lAyDqmNRIwXZsn+7bCa/ZpAPn8gMroo64XsvucAX04pOX0NqiQ3wURh+ohSb Qk2XAZV6UGaQMfS7Y+d0ueg5HVZxRrBIfGNCqZ+3xs3VC5mwwSiSDAiomtTbFOZ2ocvv u+JVOiNo2qHaoPZTy32iDoewYC3Z2zhLd8kkAjaa/niP9gOG8E57QLRj8/fdgd+VZOFg 5rG2k8IA9npoMLqFjEMqQ8+l/coGL7nr0nVET8RhCPrLFzf7xz7zi6hsNz01B4VpS1z+ VMVw== 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=TTWfUD3QJ4jsSYTi7WaOeAGM7M6Kyio0vxt/nQi6F0A=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=f6pA3Gs+Gl7mPFo9TKFD3xLMr8LajUA7t/q+U6uHOLV0ujDn5eE4ukWmCC5iCCoE0y 1OPzhX+0ortut9LvSP7L6g/tD5NIsVZzCtp4AB449O66k4yV+QzYdz11uRCDpaqhPctD MsDAwNQQCcnU85pAyPCLW0x7iBpfuvvuSw4pAmhMiAPOfwzMtZwuiaMl7EwxgXUQOTC/ ySiEZzJTgZq3VayKMM4TAR2F92RLN2xe5ANbxmECFtOc8T5ihRIeITdAJMWg5ZKRpGtH oXuEPCFwm1BypADUFKvyEYE6ZGanNi4vFp9lY5XF/WH9Zo4MtbPJXavfw3YEKco4SM5T tP2A==; 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=B1rroG2m; 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-a8a6626c433si108940666b.393.2024.09.05.03.08.53; Thu, 05 Sep 2024 03:08:55 -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=B1rroG2m; 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 6FE9968DDF8; Thu, 5 Sep 2024 13:07:59 +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 8CFC768DCC6 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=B1rroG2m; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id E7FA04E08 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 g00PtSgr-j9e 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=G/jscwDmAQvbDT5ytcLEpKz4uRGLJxvITNJ9Wvy4DpE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B1rroG2mNMkaYNPVN00XhoyLD2sEEPyre/AaROAkYEyDhd4mGSJ9Sk++TStt7iz4C GdNvuFKxb0tOok6J/jIzeV75PvRduV9n/Mj5ajHxal8kwK0uFkq3TE60iLAv4U1OA7 oINFl5qFUrcbkAZtid20PFRX90SiSATGV8NmHl2XfaPYWTwikPN+dN+Lq+aPf5fHSx Pm2bbck4OvLhXq38ZNWr4+XZ9MotSsDkLgTBWrH44qVv9WD7rI0L/RhgH/2aXQUqZW g7ot8jYo3t29WPlWZA6dccSAVyBFxJcI0ERmPdLW4G//sBk59O8OJq8DJzwFlQ+/IA 0gnjub8N8h5zw== 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 76D9A4E0B 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 450363A2B60 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:15 +0200 Message-ID: <20240905100729.6030-11-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 11/25] lavfi/af_headphone: 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: LHEHzYpRzFWW Also, drop a redundant call that also happens implicitly in generic code. --- libavfilter/af_headphone.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index f97f329293..fccd8d3f12 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -594,19 +594,23 @@ static int activate(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - struct HeadphoneContext *s = ctx->priv; - AVFilterFormats *formats = NULL; + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_FLT, + AV_SAMPLE_FMT_NONE, + }; + + const HeadphoneContext *s = ctx->priv; + AVFilterChannelLayouts *layouts = NULL; AVFilterChannelLayouts *stereo_layout = NULL; AVFilterChannelLayouts *hrir_layouts = NULL; int ret, i; - ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT); - if (ret) - return ret; - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); if (ret) return ret; @@ -614,14 +618,14 @@ static int query_formats(AVFilterContext *ctx) if (!layouts) return AVERROR(ENOMEM); - ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); if (ret) return ret; ret = ff_add_channel_layout(&stereo_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); if (ret) return ret; - ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->incfg.channel_layouts); + ret = ff_channel_layouts_ref(stereo_layout, &cfg_out[0]->channel_layouts); if (ret) return ret; @@ -629,18 +633,18 @@ static int query_formats(AVFilterContext *ctx) hrir_layouts = ff_all_channel_counts(); if (!hrir_layouts) return AVERROR(ENOMEM); - ret = ff_channel_layouts_ref(hrir_layouts, &ctx->inputs[1]->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(hrir_layouts, &cfg_in[1]->channel_layouts); if (ret) return ret; } else { for (i = 1; i <= s->nb_hrir_inputs; i++) { - ret = ff_channel_layouts_ref(stereo_layout, &ctx->inputs[i]->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(stereo_layout, &cfg_in[1]->channel_layouts); if (ret) return ret; } } - return ff_set_common_all_samplerates(ctx); + return 0; } static int config_input(AVFilterLink *inlink) @@ -782,6 +786,6 @@ const AVFilter ff_af_headphone = { .activate = activate, .inputs = NULL, FILTER_OUTPUTS(outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_DYNAMIC_INPUTS, }; From patchwork Thu Sep 5 10:07: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: 51372 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286851vqb; Thu, 5 Sep 2024 03:20:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUs3TEbbuFgx2bDIxomdcPsVh079/2X+6fyDsAMu3HYvJZ6obvIBWG32YRdMsCGquygUKFy9+LTNaj3nYEX2tKQ@gmail.com X-Google-Smtp-Source: AGHT+IEf7DVxATFcHmOQsH/bJ8892kyIpD9HtYwsQ/TFDjs3W4CKn0FbssKIggLv3mM2wr6Lf6Fu X-Received: by 2002:a17:907:934d:b0:a88:a48d:2bdc with SMTP id a640c23a62f3a-a89d6b05675mr1376012866b.0.1725531601015; Thu, 05 Sep 2024 03:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531601; cv=none; d=google.com; s=arc-20240605; b=Zy21Lqlaj+W7VTs+epABTxaMmruB95SSjRYA9+4EJkPQx91aSlRJWsIVOW/GpVaOnm sSoo26riWsuOxh4/nefYj0tV6oFieK/a2Y83LY5m2lJcu54kKgstwOEW17zYyyZ6/bcM eNfvnPLsa78Qp/3E6RAcHHMlPp20zPlwO10CQQzIAtDPosFd+9PCGNtXJZ2dNsGJopM6 DAUQmn3xUoJvbnpgThRnrqkkTCc3ErZXBe0Hf6FLJspP+ZG+qoreBV/b/miX1oq7xlkG 0RT0C4qoJMG50Y07iHalCt1ZdPwsZfctWDEmLQp9ISBo7h0ZXZhlUDWEAGIAXriGA3ry 3NBQ== 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=+MorRr07rb0iLl+uPImvFRiFJOYgKX6hc2Gnh2hG1z8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=GpBcpVFlaL5Fs50YpussxTYK0jjWkiQOHnSZt16pLi+5eCUQpOPPwgCfUGiJ6aNvCk XtqCapakUkTxqVlc/xDHNfpKw6s/VkiV+N/vLuuUUXpA9MRxqun4fPUt305hUXihP0Pd gG7XBi/MNtdxkm5SMxSFSq+LcZrnhA1YCg2mQkeV1JsO9vqs2Xgx+pWm1jp4VXlwQNpU iblEjgHmQmQ4UBMuj40Ph4dAmKmPIkJNeCRGKgb8AezgtjhGiUE4od5QqeRhNWlseYJr 4akx0g6iFkpzT9q1beNdvkmS5yQl6oE4Me5BkZvZnyKB+jPP5e31+KsWotdsjfbPKpM9 zsCA==; 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=sADmrFsK; 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-a8a6243264dsi129006666b.922.2024.09.05.03.19.59; Thu, 05 Sep 2024 03:20:00 -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=sADmrFsK; 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 4633268DF84; Thu, 5 Sep 2024 13:08:15 +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 6C4C868DCE9 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=sADmrFsK; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4F50D4DE4 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 AFNvWmCI1Ofg 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=ZGqMqlec9MrxRqyqrbjFg7mXihFB+wxbQvoNJMh8RaA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sADmrFsKEjzO4QP8RBhgbhoD201NIPoaEN7VspEGHkEZ/d7BoGpw5ZDDlnZYReK/z vTiTXTnCBI3GQOt+FriWVKN3WFFuYGNYCZ7bDSGPTVFsNyiaA9xN7bkvSFbxLZEMGo k7GkCELZXCwlU7OAuaojdbz3uYtqRzAOhb3bKFTsMLXBaNpEiMBudH3Agf9m0FvWI9 2kuFboABZ9/OOCA2JD62AIU2Dh6F9NPj/py3Y4kh8JdGE8vvZg16jAY800ciri/ccS BerBlNBf0p1xnuEtVUcStAfCPUd3eCu7KRY/1of9ZqBvr2arg/KKjtozrvxTK5afS0 /orArSkEmEwJw== 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 85C884E11 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 50A213A2C76 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:16 +0200 Message-ID: <20240905100729.6030-12-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 12/25] lavfi/af_join: 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: ei4YWl3KM3vK Also, drop a redundant call that also happens implicitly in generic code. --- libavfilter/af_join.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index e1d8b0e00c..db0320aa70 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -201,24 +201,25 @@ static av_cold void join_uninit(AVFilterContext *ctx) av_freep(&s->input_frames); } -static int join_query_formats(AVFilterContext *ctx) +static int join_query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - JoinContext *s = ctx->priv; + const JoinContext *s = ctx->priv; AVFilterChannelLayouts *layouts = NULL; int i, ret; if ((ret = ff_add_channel_layout(&layouts, &s->ch_layout)) < 0 || - (ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) + (ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts)) < 0) return ret; for (i = 0; i < ctx->nb_inputs; i++) { layouts = ff_all_channel_layouts(); - if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[i]->outcfg.channel_layouts)) < 0) + if ((ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts)) < 0) return ret; } - if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_all_samplerates(ctx)) < 0) + if ((ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts())) < 0) return ret; return 0; @@ -605,6 +606,6 @@ const AVFilter ff_af_join = { .activate = activate, .inputs = NULL, FILTER_OUTPUTS(avfilter_af_join_outputs), - FILTER_QUERY_FUNC(join_query_formats), + FILTER_QUERY_FUNC2(join_query_formats), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; From patchwork Thu Sep 5 10:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51382 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp386941vqb; Thu, 5 Sep 2024 06:14:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrzI/x2WJG2fAm/200sF2qyE7Alj8jutjQOzZzygLk/GVADAsrACdiYgNFFrOcY5gH/KfQkfQ9s9IopxrxRrGa@gmail.com X-Google-Smtp-Source: AGHT+IHb+Yg5/1nH97QrhPx19L3xGX9Qxha6dwSN5o28OCR3PZHeZjVbN/TGFfhQI4TgYTl1EP4h X-Received: by 2002:a17:907:96a3:b0:a7a:a763:842a with SMTP id a640c23a62f3a-a89a37fb49fmr762537166b.8.1725542051300; Thu, 05 Sep 2024 06:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725542051; cv=none; d=google.com; s=arc-20240605; b=YOj/N3ienioC9Hbt1CZ1s4G0GDNGqS9rYm5JbTPtMQDHRVV+UAPKJ8o40bO3lm0Qnu 93gmuI1Ymock/ZicIqQFlycZdZ6xG8IQPasDaKoSQwm/wkyTRRHP7dFEFdWoQF/47ESM zCu+vcgl8M5PowNvIiGzATD2OKuWdECmCXEec5TvggZ41C0GK9Z6iuuzzeSrHrMHM53o +6Liz96mq8hJ8VCucATpUM0gDE1CcbB1KgaqD8zEU4M5/nQLbxhJoHjg0da1wYPWaH+x CaK3GYMYM01DzTDq7ZWKutHKrpJq7SC8XsXu5dgHFN6mPVJwaZF75Ut9/tJ3jVqx6ggo 6ixQ== 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=BiOj0nbj/8lIjb7E2bdCBM4pagPsF0rvkbmOh8DXeNE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OHr1EbeIIXRYH/CA2UdHEu1B9+NiZxyKaQvKZuqQQwm5QGvCogX8oJiFRDQnpbPpCG JpCpE9DX17ZNeRyQaLYdmkenQz4RAwg95UsNV2CRupRFlbc4g4SFVcEX0m05ykapIlqG 07K9ZU20k0a6wYdbxVGjm73vOnNodDjlSA/PoZvLvvGxzrcCeJoyhNrIwr+6vDddGz7z 70yK51GgW1dl5d+w4gVn87pFOSuAaxNZA52mHrF0Dkeq/s4GZHVk69IMezk7DtE1aHJi ZZd5gKkgscHEe4dUsws3dujgTVjSXs/08wtLSYexJ2JP6kCf/xqp8nJZm5QZnrSrD0+G LtOA==; 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=shCCA8js; 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-a8a66222a73si136776366b.687.2024.09.05.06.14.10; Thu, 05 Sep 2024 06:14:11 -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=shCCA8js; 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 D47B468DE35; Thu, 5 Sep 2024 13:08: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 B6FD768DCE9 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=shCCA8js; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 444394E0A for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id zsgQQZOo2voW 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=Dy1MECnGk8nKdr7Q3yratczjOT5Z9c8x4yq2i7ONf9A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=shCCA8jsSVpFjAiRjYnrcvOfSV1jsVMv2AzXfyX8NNTfxSNe1hva1pgqXTnB68aCL K32So00RL0UiMVe5iME9yEMlOZGT3NAurLxqRA/1XTQhr1EJRUCznAmNCZDrnLHyh6 VvNnDkC6hSyf1bI/rOllWy6D+XRQ2r5euXs/4DK0Cv00D/YeWNfvfh10fBRpNP2FOP BNlJ42h/RYKHtUOFgnmbBFA5vo2qaeKBNuTrl8GfOYLP3h/eRAivU5GSV8mjoW7YzZ 2hohIlToympozqqct1jtu1ehBaKnVfhAdU1beEkrHPRi++mDVVUt7jKOateOh0nwB+ YprLvnPltJM4Q== 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 8724F4E12 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 5C7003A2CD0 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:17 +0200 Message-ID: <20240905100729.6030-13-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 13/25] lavfi/af_ladspa: 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: 21gafE7o4See --- libavfilter/af_ladspa.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c index 2f8c92cd14..35ff90b1a8 100644 --- a/libavfilter/af_ladspa.c +++ b/libavfilter/af_ladspa.c @@ -694,31 +694,29 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - LADSPAContext *s = ctx->priv; + const LADSPAContext *s = ctx->priv; AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret = ff_set_common_formats_from_list(ctx, sample_fmts); + int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret < 0) return ret; - if (s->nb_inputs) { - ret = ff_set_common_all_samplerates(ctx); - if (ret < 0) - return ret; - } else { + if (!s->nb_inputs) { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates_from_list(ctx, sample_rates); + ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); if (ret < 0) return ret; } if (s->nb_inputs == 1 && s->nb_outputs == 1) { // We will instantiate multiple LADSPA_Handle, one over each channel - ret = ff_set_common_all_channel_counts(ctx); + ret = ff_set_common_all_channel_counts2(ctx, cfg_in, cfg_out); if (ret < 0) return ret; } else if (s->nb_inputs == 2 && s->nb_outputs == 2) { @@ -726,26 +724,23 @@ static int query_formats(AVFilterContext *ctx) ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); if (ret < 0) return ret; - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, layouts); if (ret < 0) return ret; } else { - AVFilterLink *outlink = ctx->outputs[0]; - if (s->nb_inputs >= 1) { - AVFilterLink *inlink = ctx->inputs[0]; AVChannelLayout inlayout = FF_COUNT2LAYOUT(s->nb_inputs); layouts = NULL; ret = ff_add_channel_layout(&layouts, &inlayout); if (ret < 0) return ret; - ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); if (ret < 0) return ret; if (!s->nb_outputs) { - ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret < 0) return ret; } @@ -758,7 +753,7 @@ static int query_formats(AVFilterContext *ctx) ret = ff_add_channel_layout(&layouts, &outlayout); if (ret < 0) return ret; - ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret < 0) return ret; } @@ -825,6 +820,6 @@ const AVFilter ff_af_ladspa = { .process_command = process_command, .inputs = 0, FILTER_OUTPUTS(ladspa_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; From patchwork Thu Sep 5 10:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp294360vqb; Thu, 5 Sep 2024 03:34:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQMf8/UIKg3EIha5e3aoXGCZXuWL1LaLsoQjEjS/MqgCR9ikX0GTQE8eheS7DO6axgo830sTG+yCSTPqfY1gkD@gmail.com X-Google-Smtp-Source: AGHT+IFYc44V4o5zQdGVz7qV94De47qZQj+7jdMR2C5CbEOk17YtH8Kmw3Xn11c+zWcplc3ug8Fl X-Received: by 2002:a17:907:3f9c:b0:a86:8b2f:49b3 with SMTP id a640c23a62f3a-a89d8848df0mr1212447566b.46.1725532463193; Thu, 05 Sep 2024 03:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725532463; cv=none; d=google.com; s=arc-20240605; b=LKMdibsv1wO3+o9K93K/0YWtB9V38l0/YcHVK3Y/gjCwMvpAoiKudat1zKUBxDlhD4 sIJ/ilqoelAdDqkDwyPVZaToyFqb2uVzSzNK5BCDKsmHi84J3c1S7ZTzqVuVKlhFRizx V5kTGJOhr11cr7RlC56ISJZI4xLRCnuX60zJhNZDAOPUarFU+FMMfjcFK/eH9luaHwxa 2sSXUTEtsWAvH8GD4ordgXAmWNwbaBwcZIN670FYNnT5RHn5CatsUxUZoNeS0YgpJm+c JnHpf0sxGxCxpVgJ7HvU20qgsx8fsRBuggydUfalHo/hIWSvA7M7X25CIDz1mQ1/4wuL nT/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=ofwXJhFzKJ/93BQ4ENx4C/Ok86CntWmGhxkgE5e0nh0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=B0BOKZt/p3C/HJuonGSpaPDB7QeS7vOwiVjlkxIXFOZmV9y9um/lfHoYOSDuY0LDe0 EJI65nKCRkrvhakZElLDycXlWHzXtCOnOKLbsbGzCK5tGRxPlAiCv0VLwgVV+B58/49Z cErP6fuK/qhhTJS0SXNAHPdzgcfUCyp2SY2igtl+ejSSf7L9C49rEmRuAj28X6Qv2TV7 fiDevqUK3pJJRIZv6gKFoTWN99XH39RmcluOsLp9GXJJmGJMYQFDP6k5/Xke/Tzca7PE 1jGDKEUQQw7d5sO06WZ9qmGtr0szlpOq+8XvAuxUQpxZdO59JdL/6FDB2IIkeAOGw2Z1 GKaw==; 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=nVaUi5w2; 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-a8a7d084c59si6750166b.460.2024.09.05.03.34.22; Thu, 05 Sep 2024 03:34: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=nVaUi5w2; 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 61B4768DF5C; Thu, 5 Sep 2024 13:08:12 +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 34D1868DD05 for ; Thu, 5 Sep 2024 13:07:49 +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=nVaUi5w2; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C0D144E1E for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id SwkcsDtSXg-d for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530862; bh=80FbwUS8vAfOBOHDSMyBYAGnjYvz5SA57IY9KQEjE1o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nVaUi5w2XYhyz+hVP4/H6RRORT00Xb/nMQN/OaaZndF5p1z0OmRlgpeazXd48/vzU 7swuc74PTTskpMJweZyXyQXk+m095IY4XxhH1VpzZMdvn1ccsX0f9HqoOJ1RXeZw1O iN2X7c4Da7vClyBUVyWY0iHrBawFPCIerLFkN83KfcH72dKaVJyW9/Fml0B+fuG6FV bx2ium4nC+G3AUC6pgT2L1JVaT0l2OqtbHJklksOASlCFnb/uD/teX27YnKR/5AjGn zxb+kYwrd2aLsfCVMRPAIWhFwhT4vGVdK8p1jg4XaiV36tPileZNCUXSaq+Y7AjbVl U9VDu7emDyYwA== 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 820794E0C 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 682193A2DB3 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:18 +0200 Message-ID: <20240905100729.6030-14-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 14/25] lavfi/af_loudnorm: 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: DGybuh2wXpf9 Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_loudnorm.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index d28c4556df..d63a713818 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -728,7 +728,9 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { LoudNormContext *s = ctx->priv; static const int input_srate[] = {192000, -1}; @@ -736,19 +738,16 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret = ff_set_common_all_channel_counts(ctx); + int ret; + + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret < 0) return ret; - ret = ff_set_common_formats_from_list(ctx, sample_fmts); - if (ret < 0) - return ret; - - if (s->frame_type == LINEAR_MODE) { - return ff_set_common_all_samplerates(ctx); - } else { - return ff_set_common_samplerates_from_list(ctx, input_srate); + if (s->frame_type != LINEAR_MODE) { + return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, input_srate); } + return 0; } static int config_input(AVFilterLink *inlink) @@ -937,5 +936,5 @@ const AVFilter ff_af_loudnorm = { .uninit = uninit, FILTER_INPUTS(avfilter_af_loudnorm_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), }; From patchwork Thu Sep 5 10:07:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp342785vqb; Thu, 5 Sep 2024 05:04:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUW1t10S/Bp30Mrir8hU64l/64fX11ZRAI4BoL88X5YAChrY1RR1cef9qgFRCPfCb46UNmFHHjC4N/izG/blkKA@gmail.com X-Google-Smtp-Source: AGHT+IF+WLxbX6d6mAtqtlDqz9I0cEAXCrEDPd2SmzVp1tCDCKYjdWIHRbwYLJexnJXzO1G1F8hm X-Received: by 2002:a05:6402:1ed1:b0:5ba:8ad7:4859 with SMTP id 4fb4d7f45d1cf-5c21ed3e1damr20087133a12.14.1725537853974; Thu, 05 Sep 2024 05:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725537853; cv=none; d=google.com; s=arc-20240605; b=QfEagBdo3Y8xOuMnXIylutqc9k8F0GJdnhP7hkkLHG70ZTxtNBjVQhaLPxbxN4ZPjj aXfu5SveHIMBxLZmL4RyOnXtczZLCepx5KdTWEl0Ca53odYB1glzceWrukDgE5+XRvIu 9RqPWO1JBMxqKjTem+Hcbp/ATZZ/OLJQMeeJHRK73KKPbb9bCC7pZ+PQAjmQPrHxOcGl lhvpHhb4h6DVqeEwN/s9Har9pvDEDnvURV/rHesvDwmONpAoEf6EsA6TN2fJPJyXHWkY UjxSNDKtQ4kt/XmJo/huC1k43KaUnxfb2GuKaaqxSRjOtZiyZ6pATDEHJ0ESxfXi+cXo LdfQ== 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=mai9UOYjO762PdGwl77X0TuEqqw+erbejpxyPvZP1Dg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=QdnocxEpKid4Zw1s4OR/7aeghJt8dXDaKotFS3tOJZUL3Yd/SqTtdg6wYj4nIlw4oL 4kWTROVmmXDFpOTU0YIL/HMeumFaqXzD0y+pEGL5ASy14OUFIsbHJB+gc5waapUCGbY1 89Dy9Auw2c3oXP3893SjNq3HLzWcaIbF7n7acZmL7GJ6rsDcOuMnzzT1EXLr1I2ibXpd INcVsA2ePzHqHh3Bg07UhgkgyY3zFy8QXAPK3AVv+HToAkLP67XfBwumbVFGYmxUs8hK U85cYBCqW3/P1Elx4a2VZevuqX6YzQCCZoSIGXmUTg/DqXjA8FrzAueGBCXewUV+p051 eb1A==; 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=UcAdI7O1; 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-5c3cc54e0fasi1457265a12.154.2024.09.05.05.04.13; Thu, 05 Sep 2024 05:04:13 -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=UcAdI7O1; 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 88F9568DE26; Thu, 5 Sep 2024 13:08:01 +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 950E968DCD0 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=UcAdI7O1; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 299314E09 for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id g6yAf_iwsEJ9 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=hPTHpIX2LZg3w96uFgbextnQxXflNQqjnlyf7sXF3U8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UcAdI7O1pjQUYSEV92boRcKr7QajVCUQ1jSQhyrQ7dmqdegAQmEPJ5Z242cavLys1 YMcB5UTc1fHVt5Y8/BnVbyfj/tXQj9vCK4y8wJkJ8tvS5jnE3of/LzxFphWke8pZb/ y1ktzX1jSylKcTi5lRlyoYItsBRFTXML+0bM4yAd6NcWMSOTYLa/7VYM95gG1pRl5s robl26jOVpg+TW0SdEIOGau60ywD794DCwKXwsUCtN1haI4AYbNZVaDbtIaBRHhFGU S7pQfqNgoHMuHo7Dab6/XPeK0m174V2PwKPwzcTjFEzgxVde1DvXcGKQjieAmd/wBM eMZGbFunhCvCA== 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 833144E0F 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 735983A2DB4 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:19 +0200 Message-ID: <20240905100729.6030-15-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 15/25] lavfi/af_volume: 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: WRMLFd/bG4jI Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_volume.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index d2f8a1c1fa..ed924cf45f 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -130,9 +130,11 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&vol->fdsp); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - VolumeContext *vol = ctx->priv; + const VolumeContext *vol = ctx->priv; static const enum AVSampleFormat sample_fmts[][7] = { [PRECISION_FIXED] = { AV_SAMPLE_FMT_U8, @@ -154,15 +156,13 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE } }; - int ret = ff_set_common_all_channel_counts(ctx); + int ret; + + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts[vol->precision]); if (ret < 0) return ret; - ret = ff_set_common_formats_from_list(ctx, sample_fmts[vol->precision]); - if (ret < 0) - return ret; - - return ff_set_common_all_samplerates(ctx); + return 0; } static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src, @@ -480,7 +480,7 @@ const AVFilter ff_af_volume = { .uninit = uninit, FILTER_INPUTS(avfilter_af_volume_inputs), FILTER_OUTPUTS(avfilter_af_volume_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; From patchwork Thu Sep 5 10:07: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: 51376 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp294380vqb; Thu, 5 Sep 2024 03:34:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNgkKCKEws2tST4Q1AK5ucRqW2YoPVX96u+/x1R1qN+czjjW5vMkcWL3gAJKzGgN3f2zqpjxR51L806in/UcwK@gmail.com X-Google-Smtp-Source: AGHT+IECaBD6ruYE4sk/Agq4y/+doptIB7ro8oj8GTxLwaFnGVNly7XUYTWruQIaajBmjQ4TXQ9K X-Received: by 2002:a17:907:7d8b:b0:a72:8762:1f5d with SMTP id a640c23a62f3a-a8a32f9f153mr502893866b.55.1725532464571; Thu, 05 Sep 2024 03:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725532464; cv=none; d=google.com; s=arc-20240605; b=a4sWVfJpLsZScl9faVZKvrn/580dY1GQMI/8+NIKQMIG+LIz785htWVOKX3wBMXf5u Y6o/rQBvlOvwoNFRI7kjDAFD6nwSWz6wUWkbrQLfktXnPxmJVYw7hIpfr8O1Z3vmUpK4 G1WaVsPEVyW1Vhh5Q+LvoB6Bdnk6nEroAec0TWcdOjE5bY+dJjHAiZeLCGYlu4okSVhT ivO+CCtioaZqEUvnEHikMg9nIEKskA4NoUccTSVOyvaqErCiLe9njLo5VcwG4mTTsWtP kYqz7nXX0CDRWX+sCcIHBVGbSsdATeoorIeDUlH/ZfdbM6J/I8+vWmL31et6iAilXeNH 0m/g== 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=0SqE9komZCQ51jkShUf50EUnhVzJFOs2gbWHi7GIsC0=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=S0BVj+D/Liho4GjxZvreVVrwISak+SgIMkX32ptNWdxaOhtZmo3f2UZy1faSh4Uyt7 8t5p/HMTXbMv6/S6t4kHp625DKtdDFAC8i+UOTEGV3c0bDiBZYqsE9hW7vNpNUomqAev 1dc4HSHlKdn/7J4OJPdkovt6c8qmf3zqjJ9W/hjWLf8zegNVG5humSo/buCqcGiuLlgN 3d0TQ09BpXV7Z4XNy+biWiFgp6FynmrZMpPbMNewVK5hOoHSrqLXFcPvxYwuMjCvGQG6 vr+enmDHlzxr7gXbWArSJB7dmZ9hHIYr4hbUlwEnlMWw/k5Zj9vYsKeKufaThb/WTyL+ jxYQ==; 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=QKHaArVD; 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-a8a7d7621b7si4239066b.308.2024.09.05.03.34.23; Thu, 05 Sep 2024 03:34:24 -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=QKHaArVD; 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 6CF2368DE8E; Thu, 5 Sep 2024 13:08:05 +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 C4C5968DCFF 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=QKHaArVD; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 7AC554E0F for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 4wr1ObH2rlL3 for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=9eqnt9kWnQcPIkv7jJ3HWko6diSDXO5sJPKxllNWJBs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QKHaArVDEaPqQ/17sFZtJyaAYZr0JCaFiGaESae2KkwZqyFHOCot5CFShz43BSDth 4wK2ZtaFrjKfxyPyJbk+NZKbfdTzaqhHMghV8D+bNIsfco3Xd6Uou86mz0CvhvkGlj mUEeYRfnIkOylFx+3lWQ6HDpugwNPcQxPjF3UfzpI16dBdUef8L/L/V6UyKw+oYQrN Tl+NfnpbYXx92oIcbXq6K6de5KLbbOpnFZ9mGBJl7gLieR3kNEyh6qp9Xv9I1PEfWk Xj5LuKUinBAfbEvjq1eJq/tmyE85h/jCbvyWHw6rCqyvIhQWxLh+eVehlVaCL326le O/mum2TJK2YFA== 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 A25D54E16 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 7E3673A2E47 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:20 +0200 Message-ID: <20240905100729.6030-16-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 16/25] lavfi/af_virtualbass: 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: SxdIgLPMAak/ Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_virtualbass.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/libavfilter/af_virtualbass.c b/libavfilter/af_virtualbass.c index 232e5fe48a..d2f28ab1a1 100644 --- a/libavfilter/af_virtualbass.c +++ b/libavfilter/af_virtualbass.c @@ -48,21 +48,29 @@ static const AVOption virtualbass_options[] = { AVFILTER_DEFINE_CLASS(virtualbass); -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_NONE, + }; + AVFilterChannelLayouts *in_layout = NULL, *out_layout = NULL; - AVFilterFormats *formats = NULL; int ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBLP )) < 0 || - (ret = ff_set_common_formats (ctx, formats )) < 0 || - (ret = ff_add_channel_layout (&in_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || - (ret = ff_channel_layouts_ref(in_layout, &ctx->inputs[0]->outcfg.channel_layouts)) < 0 || - (ret = ff_add_channel_layout (&out_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1)) < 0 || - (ret = ff_channel_layouts_ref(out_layout, &ctx->outputs[0]->incfg.channel_layouts)) < 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); + if ((ret = ff_add_channel_layout (&in_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || + (ret = ff_channel_layouts_ref(in_layout, &cfg_in[0]->channel_layouts)) < 0 || + (ret = ff_add_channel_layout (&out_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1)) < 0 || + (ret = ff_channel_layouts_ref(out_layout, &cfg_out[0]->channel_layouts)) < 0) + return ret; + + return 0; } static int config_input(AVFilterLink *inlink) @@ -170,7 +178,7 @@ const AVFilter ff_af_virtualbass = { .priv_class = &virtualbass_class, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; From patchwork Thu Sep 5 10:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51368 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286453vqb; Thu, 5 Sep 2024 03:19:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZ2Xg0nVRmsflEGRbZN6B9asiG/QjkQZQfi2F46L6iAwg1S7XOMpcExlFOM12R5cdUDHQksxdK5i2j8GOpO7E9@gmail.com X-Google-Smtp-Source: AGHT+IFquT02oNjLzQ5OG9pRTqxkV1w4KcWeFN8ZWEm3LpzKSdCysjVadHQKFz/y/GEoKaMslLG5 X-Received: by 2002:a05:651c:550:b0:2f5:11f6:1b24 with SMTP id 38308e7fff4ca-2f61e0562admr152794811fa.18.1725531553501; Thu, 05 Sep 2024 03:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531553; cv=none; d=google.com; s=arc-20240605; b=Ji5kl1TBtlyYu0Ys/xLChx4o46HDg7KVVHBLu5jMnC0cFHxo9DSYn4VbGcydF86gks rMDd7CvlLKStLlkmZVBz0DodMt92Cv//2qV9eLkY1rqkzqzXjy+XNHOqrFecZj6GvmiS wqwhgl1R3abPpiyxbIVXJX5l/uYBhIzajH7dnMNfbpYNjO3GgWXpBofUZr5UP5zqvcsy bDD1OJrMSWsOIZVs7ShcjvyEIEomH0I5ooIgarONC9wlD/4ooXAeSrBEUNl4nITolwMP vJJothuv5nA48yOsCPSf2fi+5F2aTxNGPmL02+Q7daviSqWGwIhtk6z7uwyBOTpvV/Ot Cnmg== 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=nHs/ipm+yda5/ShLCWP6FNq49BMtpOyXGMuE25kX5oA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=H7o4nSnyHQpy9jn6U3IzakIQKYuTYnIzb4VU7JTbQPQNZ3JsE2ZlffVABiyqkJRNZt 6auyETXRxDgYMqFCTWM9rnJph+oFzmqWYFBr2Jre1hZzCXbugkMvxwAhzM8bf7HxRcOK UcxDejWlXLDbjuogGmvekBOu2am5ITHP8Pb0XS0nUasybZNv+9zrjNbXTxGsYyCI/t3N 7zZQ6dZNTOF2OC+0HS/IX4QI1nhc6wSMxnznqtYZ3UDRz3SsEIkwBDYJ8/sDOiJxtuHX 6Y36ab5ffhyclWCqdOiGUzjOpybaHn0an5cEm9boZ05F1x+4AqNqH9HMPdtMuAkLRtC0 VPlg==; 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=Ampycp0N; 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-2f615151998si46154041fa.224.2024.09.05.03.19.12; Thu, 05 Sep 2024 03:19:13 -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=Ampycp0N; 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 55BE668DEBF; Thu, 5 Sep 2024 13:08:07 +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 EF1E968DD05 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=Ampycp0N; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 8FF0C4E0B for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 7Gih11peNEUm for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=xU/UWaTKR3wRJjk1Z6IjFgjz8L+rAIW0bA5OdNnjhV4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ampycp0NX/WoENo+Up8KJvETNzHGVioH5Rzb4h+Gh8Avn6jNR/trNFRLVUT98Hqu2 6fIfXOsPPXNHtjYmPV0h18DK0NoR0Z9REQ+NGYlVP8VOHkuqag6NFGHsPY8lYgbm1p AgJWerSNYZGwALqst7xuA1oZRMlzNw1e9eI7ynNyn9s6UZQhh9BgX9A9DVQ3RsVE49 yFwp7i9ADP6vGmme7/lzd3Ipz5W/KC/4g97PhhzYtU4E5YPMPAP01FgnV7uuYz2N4d 9sD4V1vIzjACdNlyZWHkCiVUrjVxi8ickT8lNjVtAOmGj1lL5scHWT3QUvsU7tXKMV noFT48aKj5NQQ== 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 AA0824E18 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 894533A2E8A 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:21 +0200 Message-ID: <20240905100729.6030-17-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 17/25] lavfi/af_surround: 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: o5yoUaBlypxt Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_surround.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index 111af03335..95efe4685a 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -146,17 +146,20 @@ typedef struct AudioSurroundContext { int n); } AudioSurroundContext; -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - AudioSurroundContext *s = ctx->priv; - AVFilterFormats *formats = NULL; + static const enum AVSampleFormat formats[] = { + AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE, + }; + + const AudioSurroundContext *s = ctx->priv; AVFilterChannelLayouts *layouts = NULL; int ret; - ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP); - if (ret) - return ret; - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); if (ret) return ret; @@ -165,7 +168,7 @@ static int query_formats(AVFilterContext *ctx) if (ret) return ret; - ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret) return ret; @@ -174,11 +177,11 @@ static int query_formats(AVFilterContext *ctx) if (ret) return ret; - ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); if (ret) return ret; - return ff_set_common_all_samplerates(ctx); + return 0; } static void set_input_levels(AVFilterContext *ctx) @@ -1517,7 +1520,7 @@ const AVFilter ff_af_surround = { .activate = activate, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; From patchwork Thu Sep 5 10:07:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51367 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286821vqb; Thu, 5 Sep 2024 03:19:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhRg9TETkq6ukc1UUN4ZobdLPIICqyySFO0yOshYqMlHaZ8Q7XQ98HDSq+h5lyAW9Lcr4XRM0vbTocjGqwt4si@gmail.com X-Google-Smtp-Source: AGHT+IE2iTu5IDX9qr6yh1HzVqu0K303GgC7n9QIP9EkHlVpzlc8dgiejhRHkQNyCvW5lBrGQF88 X-Received: by 2002:a05:6512:ba1:b0:52e:eacd:bc05 with SMTP id 2adb3069b0e04-53546bc97d7mr11720656e87.61.1725531597640; Thu, 05 Sep 2024 03:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531597; cv=none; d=google.com; s=arc-20240605; b=WsVWvdRUx0HONtX5vNCpW3RWTlD3bX2PPit5r3CKQf2b7Z1xUr7ejnH68EszJ9ZlIY pTiI9tA9ubcUEei4R468YZyQq7M+p3vT9iwoISWIB1I7U75grs3Rck+5iUhGKD/xfdCI 4bQj2CfnApWQ4wPducjWM5D3NEtd2OtJqzlOETkIJP/ecP1g60yr0lfR0tgR0/JfRTm0 hKJc+5goSCJCbXYowTUQzYxl9dyrWIW4s7LwWd353oNpkLF+WlDVUtp3iuUmY1ADJB18 v7YPOxYAd/zipXkFKjDn+Zq3crvjdveL7qpsl7iBhbeLjbpc9ASVfzzjcVxQ1QHFuhFJ ujAQ== 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=8JTf/AB/oPDycvi9XtfWr4L+sl6bP49xZm2VzEeQ97k=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=iD3id2G0iBuygb4oincwHfh8tmNmIlPeeSNYCen/89ifXACnGogL0MdNYH9E2+TCuK ytTWlTJz2CJoKI06ess5frz5yv5yIA/6W0yn22lIz6ZFOLhtAnkoNDi7eR/Rwq2FGC66 nZ71Hw7vZpAvwAvnVpFcKJ1S0qdGwlsd/cxKe8F1uz/b+xWk6wC03Hnwt3dyiJTCdtEL nrg617QQCL+erQ02Hgj5QYePjvufg9g0BphcZ0Nj81PRwUCE6waoTulECvsqJijVsMqF Vs3YCi8ZrbZGg7Whs+3sMWoRoIE1RQ6q4TOR/qlgc9P/IPweQI6tgxKkiu6du90dxMhk I8PA==; 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=dYGNGcBI; 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-5355eecd6dbsi2248128e87.121.2024.09.05.03.19.57; Thu, 05 Sep 2024 03:19:57 -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=dYGNGcBI; 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 CB45168DF32; Thu, 5 Sep 2024 13:08:10 +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 1C23E68DD14 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=dYGNGcBI; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D7A804E11 for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id c-A9Wl-DbY-y for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=8qVgS5fduG7QcKplYrRMQWDElh7Tm4pwUbF9AIsuvIA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dYGNGcBIVrDxGhbz3HJXNFV65VP0B0b1xM8GjlPRpkhhrXqLYISGPTA7BB0AkM6Kr ZX7bGtQ0m3Rlr92MFj1ZXJsi3llBmcKHFhIHy4bJkEdJjEdYujVinEXjs1c4u28SOD oFEMdyR4S8X6S7j/SV/+xyUA9iCPYL72MjM0DefhIdaqPewh6ZKPNLcIAVVDDjf7t5 u1r9SQgs+9Yxtya8TN7rY/f7VZTt7SDeU68fMnwqPBP67g4dC5eiDr8QhzRoXuV5AL vjrLT6ecme/fSHjUX4Xirt0Cr1/P3FuUbUrdaQeHtUQHjISI1VviZ6iRatWgJHZ2xW 0CuAGMpznTtJg== 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 AEB8F4E19 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 9505A3A2E98 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:22 +0200 Message-ID: <20240905100729.6030-18-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 18/25] lavfi/af_stereowiden: 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: NuwWnB1BsSYV Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_stereowiden.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c index 6718bb39a5..b3a5cba7b2 100644 --- a/libavfilter/af_stereowiden.c +++ b/libavfilter/af_stereowiden.c @@ -54,19 +54,30 @@ static const AVOption stereowiden_options[] = { AVFILTER_DEFINE_CLASS(stereowiden); -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_FLT, + 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_FLT )) < 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) @@ -158,7 +169,7 @@ const AVFilter ff_af_stereowiden = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; From patchwork Thu Sep 5 10:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286805vqb; Thu, 5 Sep 2024 03:19:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVU+SJCRBXn8sJWhbhdpmODcYc/efVmoZolZGjms4tADx9WfPBSI3BDkRN/Iuy+hlYL6VkRVGefR9gtlkY/VZ+r@gmail.com X-Google-Smtp-Source: AGHT+IHvAV4TTcu4O+MBugewMY7pgZcc8OrbVInqvaJKgH58hRrH0Ktuaqko4HPcEpefmUTcBiAp X-Received: by 2002:a05:6512:33c5:b0:52e:9daa:25f4 with SMTP id 2adb3069b0e04-53546aeaadbmr8037102e87.2.1725531595893; Thu, 05 Sep 2024 03:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531595; cv=none; d=google.com; s=arc-20240605; b=R+bvEmKu6AFQTP7liZsoIwBVyIeh5eeQxGpcUSmF8rQ0EEX16gc1mr1pB4i2m8vrLd dc6d3DG2r7cEYSfLDJOmKeomf9H34wxes7lBYOf27KdEYbc7S1g8y1zPxsb9gRNJYfk4 wZT5RxuqokVO8ZcBrVd2LvPABlGNVXJAxT3SBZu64BfUGaZK8PLoftPMQdThmqxWb5H+ o+9YAuPnNemZhZf1Aeearcm/3ltqtpve8QwJOZuGbmvxw/cCAjpdKpC+menIXiBtpq1o HrLCciWHQDYWUd0siFjl8ih3fQqvUIDH0j4V4P2DnXGVGvK285g3RhF5OWRl8M3mGWBk cSXA== 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=bwWaQBZqVjhQmjWyFzTnUCF6kU62k1es6WYN6WK1UaQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=M1dFJoyYTY7fLsU9gVJ92QdBO+gleAqcDLSGscxTQAGWDMhrMIBDHftRoW2GVOPk3a Mefj5pZVQ5GMdCruOAU3370RG87I1GlLiUEdsmLv7MUXBR5ZPf6y++Zfur4LxZ8eD7oK YGk0L1YZB8LdTQLTKaEOM0z217o6uzGWIxHP8UFjhxNTuSltTkLCdqGUKQj/kAku7JtI FyeSfuUlXV1pEDtIfCPelfP1WOe5v3hlDxGkFk486l1ip/HhEf3Nh3zl4zgTj8+GUPjr 65/ZYGfaUhfaKzEKQFuEQOa7UlqAu0W08G51OE3tEdQQZBIaP1Wy8kHgt5o5qhYS9jzk FZNA==; 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=lncgSQYm; 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-535407d9030si5575067e87.234.2024.09.05.03.19.55; Thu, 05 Sep 2024 03:19:55 -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=lncgSQYm; 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 EFF7968DF29; Thu, 5 Sep 2024 13:08:09 +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 1B44368DCFF for ; Thu, 5 Sep 2024 13:07:49 +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=lncgSQYm; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 6928E4E19 for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 8FI9ab6aegxQ for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=RYP2HIbaTsYyr06K7LEfX5kwjA8yqvwgcJedMCeSdl4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lncgSQYmbTN8o8b14saiwcOSepWFhRhdi0o3rPP6+Gvqy/M+4JrZ8y7wct9QLmGd2 wTuVlgCIGSIl9hH1UeFdkahWzH24+rwvuE11AMmMyRlkYFIa0xCVI1AlPGcJxPYMnO DNOsnDT/8Jvn6bvtI5ma6Al4cqtwkzkDbDlvR7yyujsqSuCsGZwP9389HdoFlaT0rC yu4FrQkAxWwql2lXmOIexb3+19kwDol4/URnb6jqFldEgRg3OMExgNWH6XO3kbC37A g+CvtKdABc4nH0udwfcjW6JGjy1LafRNcGkhOwzO4/N9zNrsQiBUAUkUGnBci5ojVW 1JkPftEuHNDJw== 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 AEDD44E1B 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 A0C5C3A2F2B 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:23 +0200 Message-ID: <20240905100729.6030-19-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 19/25] lavfi/af_stereotools: 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: CM6dV8/NpJFr Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_stereotools.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c index 934c5d33aa..ed22f41637 100644 --- a/libavfilter/af_stereotools.c +++ b/libavfilter/af_stereotools.c @@ -101,19 +101,31 @@ static const AVOption stereotools_options[] = { AVFILTER_DEFINE_CLASS(stereotools); -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) @@ -375,7 +387,7 @@ const AVFilter ff_af_stereotools = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; From patchwork Thu Sep 5 10:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51380 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp308892vqb; Thu, 5 Sep 2024 04:04:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjn+cl6X2ToFzD/QuPoKN+eIlb0aCpg7Wm0rUpuYdU1Kyaj6VvKPrajuyWU0PjxB5h/K+SwNGNZIj71on8Mn4a@gmail.com X-Google-Smtp-Source: AGHT+IGJMx7yWhg+DeCICVX4lG4nZ9o15svuHgPJDHAVddtLxWWpsK5dvbLjQrcRnWuOHvk2ZsJo X-Received: by 2002:a05:6512:b0d:b0:535:4144:bf90 with SMTP id 2adb3069b0e04-53546bc7ceemr7642317e87.11.1725534265061; Thu, 05 Sep 2024 04:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725534265; cv=none; d=google.com; s=arc-20240605; b=J7IVX8BtCvKGGhv4UP88acUHLx4fIeOIUme7LcOlLAJ52i5/44z9kA5LSahmMcoQbf On8QyobBFKLIcXcMU14Xc84QkUD2hYlutNngffykicg90FNGbE6pvhcnK8pljHtVyRhq 8AnJ1kyHmhDG8DGyn4y3N+QNKnXuuEdMAkcdt6DACGJArztE5h4N7cQdPfy7jOi5iTsp Mz8OYmPfyEtp/grXZ7ICxGumIuskHqkte2fQoNajEMbdmU7EdWWavgfSWiZH8DUo67Ni bHMTw9ojTSaoQ/OmOgSyobxYc+9MDTiMfI+DidcO2cHapdAHpL+ZWy+zFvxXKD5lGrTi tkBw== 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=+X2zz+74NylzmU0Ql+av6ZFhr9YPBzFfcq2o8F3+jXw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=kKzvV5x35SCQH+A1SzWXdH64WRCVtEghkn1E2S7mB+YK2IF5woI88nRzEzAMl1VX6h EZ0DnX5sAlh66KxDJSoTxtb8XvIzRPnipEOSYxN2SI7WHksPkFnZJojo6bgHebETxBbT X594g0o3XYdZZOS2N8+HF8YrYntX6mKdVj4bLkl0HIKqZSfhWocD+1FaG4B9bGpnFOEN fTrrjDhQvPNmrgQ1KtvRjDGlR6rVO/ZDLqXpsUHrnhNFy3sodaj43OWMI9SS7AQwewGZ mWpmp2CBRKkrdj0v8qAHPILkHVHhdU8tZrPSGu98TfGadY+KgjGCDEludJLvdirzCzK0 8Lqw==; 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=U19iS7hN; 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-a8a62379cf4si137954866b.457.2024.09.05.04.04.24; Thu, 05 Sep 2024 04:04:25 -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=U19iS7hN; 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 8D35168DE6C; Thu, 5 Sep 2024 13:08:04 +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 B4BE368DC5F 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=U19iS7hN; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C5FAD4E12 for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id MjZYMUNxm83O for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=K+E7Gp1zFcBuAPn97KSiK4H3Lv6BjRkHi9IFrvrqiDI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U19iS7hNRknKG6Cy9Balw2zN9yPvR0XUo8vrZs4kHWYU812Vr6l66JEGcMpJuyvmA gwZYZcXqU2YlGYp+cXHN0UPv2hlqdVkKKa4WkAgmsV0dwA8BsTC6QrotsFSTnplB7J J9hLAmdrQgfpxL5yneFQz2BfkWpvJ0j4bsoDiqTmqUaiviA1mQcXELiHqzjfphruZc wSiuyoInmOCoqpV7MQvTIjT9tKC1Ha2VPkMIfLrDpXqc1CrOfKrWAtEnXvfNCrUyPI TgdcNpSLlOrZoTQgy25hbd6yaxViqPWDxztUZTpY71XMEmN16kLcYeDf0vLTFaNh5C CwTn3aiRFvn5A== 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 AECBB4E1A 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 AC7AB3A2F99 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:24 +0200 Message-ID: <20240905100729.6030-20-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 20/25] lavfi/af_sofalizer: 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: 0jzNZyVy+L5U --- libavfilter/af_sofalizer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index e647d2fe4e..178b9c0b53 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -634,9 +634,11 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - struct SOFAlizerContext *s = ctx->priv; + const SOFAlizerContext *s = ctx->priv; AVFilterChannelLayouts *layouts = NULL; int ret, sample_rates[] = { 48000, -1 }; static const enum AVSampleFormat sample_fmts[] = { @@ -644,7 +646,7 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE }; - ret = ff_set_common_formats_from_list(ctx, sample_fmts); + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret) return ret; @@ -652,7 +654,7 @@ static int query_formats(AVFilterContext *ctx) if (!layouts) return AVERROR(ENOMEM); - ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); if (ret) return ret; @@ -661,12 +663,12 @@ static int query_formats(AVFilterContext *ctx) if (ret) return ret; - ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret) return ret; sample_rates[0] = s->sample_rate; - return ff_set_common_samplerates_from_list(ctx, sample_rates); + return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); } static int getfilter_float(AVFilterContext *ctx, float x, float y, float z, @@ -1096,6 +1098,6 @@ const AVFilter ff_af_sofalizer = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_SLICE_THREADS, }; From patchwork Thu Sep 5 10:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51370 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286499vqb; Thu, 5 Sep 2024 03:19:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNPPaTQNv+hxNmA3cN/lm92aT5bwULWS3zvImE7kGCGQ0oZoHai6WJ//zBKOpjTF4MUTRyL2s9lnP4umBoAwBJ@gmail.com X-Google-Smtp-Source: AGHT+IEvDxWk8YJ7fnBTFJhJE1giPzTRHQbPDRel8xeb6TNxC/BKjOWNxsgK0Xs+N5NvjXtrqiQ8 X-Received: by 2002:a17:907:3e1f:b0:a7d:a453:dba1 with SMTP id a640c23a62f3a-a8a430ba903mr580643366b.20.1725531558604; Thu, 05 Sep 2024 03:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531558; cv=none; d=google.com; s=arc-20240605; b=jZwigd6NG4oQg+FHQZHJScGJhIyuXqfrGgG3+GjR22fXbO+ptfpGcioQvEuhGVT77/ FkgK1ntwfnnn2NtLurrNExAw04WMz1NkxQ2biYrUV3PurKGkDwVdBrZsM4zk6B/2O1xf iJgLKaRkQyaI+/M4hcEiVQoNCAFeoSWvTN2CU9V0Ru0MdQmxLlDNVM7/zq2IcqxUsu4O q3Zl7OPX866UlZ8kzg1Snn+xgHlydLchIUJvUeuUkultQ/DDxJmP8XAaVgN1oslGlFel 5Ccm4moPpXtKOEr9C9NQjsK6LkbY0Cfb1VVav8hF5RTOO+1hQMZoGHztYxih9aLr8g2s FWUg== 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=Dq3UEwZpvptIF0YrIGPriipHnVWryu+5eaxIryvzCP4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=FmHnS+vLIHGqTz8Udsn2Y+V1e4cs5OcFO3yB+Ne5a9gvasATdv7gr9XYsK6Fmh9ZSk vGy3hyF62wiBkWKF/qolFlUibZh7qk5BtbY3fE+A8LhxjPbC920i5HkHMM3qPVSY/Shx VWjFwtpm56FEpNIIOZohDzBcxU44yqZ9t3tlAfyztvkwQrIJ6YNV1/q9/jozg+9YUnIl ZSaIXVEJXYlg+jKvZIwogcwUCQkEAs1NH/QMwPex3vGMritzsHoR8MHpckud4Cla8Ye7 fd49ohkt88gYQJSjcTFKkFVzgmL1yxs0tHdWDtee2hcvUWV6XTZwCV42AMsNGbib23Jk udGA==; 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=kFEctWIe; 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-a8a623c68absi129524066b.610.2024.09.05.03.19.17; Thu, 05 Sep 2024 03:19: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=kFEctWIe; 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 17AF868DD18; Thu, 5 Sep 2024 13:08:09 +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 E789868DCF5 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=kFEctWIe; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id B41FA4E1A for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 3_ChAiewZfjk for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=10Rvx4ELzNb90VxZFqSJW8bVEF8AYY2/mH/tUG35F0g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kFEctWIe8270YtoKtT/eIUZ/7nxjBPJARDQNSp+DYe1iO14/LvGVmCMD9pBlfU7XE ttDuVfg6ftDG3TuMwF+IYqb0C25+Ue74rfFN7o9hjteGH+L3lGDwYhBApgMiYxVcGL R9qjn0adLw9CPOMqtIET6FmqrIxrYKLCcG8S8hwALXW3cxmAStZTYyLv//FOEaKqG8 t1dj7izbIXNGF8kF4OaMI4Al4KgF/9BRCuK34PkzkQ1FzTAI4WbuAnWyhYEeh06LIz t/jB31i/ameoXLh6Ovs+zjJbj9zwm1NCmDtv+aL2LmsVmyfRLMG7lTMw+ZPVXa7VKM Ue/NO8oCnnBjg== 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 B88DD4E1E 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 B83143A3046 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:25 +0200 Message-ID: <20240905100729.6030-21-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 21/25] lavfi/af_sidechaincompress: 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: SnY+FHWbjiJ2 Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_sidechaincompress.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_sidechaincompress.c b/libavfilter/af_sidechaincompress.c index 80c6e3cab1..d2bc63f5de 100644 --- a/libavfilter/af_sidechaincompress.c +++ b/libavfilter/af_sidechaincompress.c @@ -297,26 +297,27 @@ static int activate(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret = ff_channel_layouts_ref(ff_all_channel_counts(), - &ctx->inputs[1]->outcfg.channel_layouts); + int ret; + + /* Generic code will link the channel properties of the main input and the output; + * it won't touch the second input as its channel_layouts is already set. */ + ret = ff_channel_layouts_ref(ff_all_channel_counts(), + &cfg_in[1]->channel_layouts); if (ret < 0) return ret; - /* This will link the channel properties of the main input and the output; - * it won't touch the second input as its channel_layouts is already set. */ - if ((ret = ff_set_common_all_channel_counts(ctx)) < 0) + if ((ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts)) < 0) return ret; - if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) - return ret; - - return ff_set_common_all_samplerates(ctx); + return 0; } static int config_output(AVFilterLink *outlink) @@ -371,7 +372,7 @@ const AVFilter ff_af_sidechaincompress = { .uninit = uninit, FILTER_INPUTS(sidechaincompress_inputs), FILTER_OUTPUTS(sidechaincompress_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .process_command = process_command, }; #endif /* CONFIG_SIDECHAINCOMPRESS_FILTER */ From patchwork Thu Sep 5 10:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51366 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp286419vqb; Thu, 5 Sep 2024 03:19:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUX5H5ebCDmqODqtOsaPpybMMUVAc/1DMjkAHbBBtWQCOA/AivA3rBLa1tcJuFCeAVOK77zBq6wyesIKdWeTdGQ@gmail.com X-Google-Smtp-Source: AGHT+IHII26KKvhdTRXkk1FSeGrt+9xPmVU3WByNXxEZQbUAmRyErGW42KC/u8Ey+A5TX91W6E15 X-Received: by 2002:a5d:5f52:0:b0:374:cd3e:7d7a with SMTP id ffacd0b85a97d-374cd3e7f58mr4417154f8f.2.1725531549302; Thu, 05 Sep 2024 03:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725531549; cv=none; d=google.com; s=arc-20240605; b=kzXWJ2ZWS9XZ/VHaieXHorekP1Y0LXo7kzgl/IqgZUph26f97odnvY24UgLAtDKYDD Js3mhT/G1v28sdjjTJTKZ26BXGkwVcqasVraIc1qpTU8c5a27qVWRLw7ZvtX8X7ca8/o 578ycs4Fhk0nIibKzYhgySo4/izYZQmOX1Xne9/pYqiUY4TOg96fh+BmQ7xPzWe7rvA2 Xrnnz5a7du9iF2d0iqjLEBi9BtmAAw7k0WasXoO6+G0xnVX0IVWyDQYdmaV3doeQFQys aj7NJQ0BRt/ZxdCMcfdODH3o6mD4E0ilT+PPh99AdSt6eAqBTUi2OCTNlCRpxN7soMeJ K54A== 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=AyjHHqFbq9a+K6jgGaMB7jvw44VctfDAmQsutTCzOiQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OUP4NbncnWvSCRXJ37ob+EdakqajNCdgTGsnRx7zbHMhnDAJUt39Oc4G6RS0SW5I1r c3WROtCcT+jWRkQ1PDZQ9Pl6S+fzezejJuItMAWg0ITXWsAlbJdQ7UUshNXeEbJmeOkc j8MGiW1eFPisOAas7KmHc8xPKtDwOspDGI8x6VV+fWFNUcfWleJtbyaKjbO6aiDUiSvW aKhqM7PE2hAXT6zmribnbCtIMprSfMmhdeoMM3DvS+ypO1+RCyLZqK6bKSlEOI8oJJTv ypOzR6Um9C7zYANb5DIXRAtDnJMuLXUcxfJjpCB5c5Fy2LII6kWllx1AdefrgVsfHUdb BtZg==; 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="Mtx6W1E/"; 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-a8a623cb999si131948966b.631.2024.09.05.03.19.08; Thu, 05 Sep 2024 03:19:09 -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="Mtx6W1E/"; 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 2E10E68DCB3; Thu, 5 Sep 2024 13:08:08 +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 E66BC68DD03 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=Mtx6W1E/; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 7835A4E1B for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id cW-3O12eEzB0 for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=GQ0edVqvCcrFiH/rhEq3q1f3t/PqHOOMuPdHdDq+Qak=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mtx6W1E/ymzyfYm+HXZibvrVab6F3311iHfj1aL0B5FxlfDFH3pwou2vVANdURVuu 7PAW6VsF5TaZSjwRnRH0CLepIEZFvhMNJA3KFwUWbM1uJYm+Zlojdj8lfRgSGCKBVi qHoG0+no3nrq+GNj62nN/lSt7VH7mum71rDXO3jC0a2qB+aUd9r7On8WYaCOTZcniJ ZP9J6X/oG8Go+yoBApO9LHBh5KLWxLaRfHL6Me/OT1Wm7V2oCXkKTuk3QR37fuhe+j dYdouuR56nw7anYAkt962WxNUHLCBuq0nM+TsRH79IrIl2FRScvXwg4ZTIhk7mQrc8 WxASN9KZ9/0gw== 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 BBA3E4E23 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 C3F343A3092 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:26 +0200 Message-ID: <20240905100729.6030-22-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 22/25] lavfi/af_replaygain: 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: Ir0BHMNy8m14 --- libavfilter/af_replaygain.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c index 072ffa2aea..ab3ca03ffd 100644 --- a/libavfilter/af_replaygain.c +++ b/libavfilter/af_replaygain.c @@ -326,25 +326,38 @@ typedef struct ReplayGainContext { float butter_hist_b[256]; } ReplayGainContext; -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_FLT, + AV_SAMPLE_FMT_NONE, + }; + static const AVChannelLayout layouts[] = { + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, + (AVChannelLayout){ .nb_channels = 0 }, + }; + + AVFilterFormats *rates; + int i, ret; - if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLT )) < 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; - formats = NULL; + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); + if (ret < 0) + return ret; + + rates = NULL; for (i = 0; i < FF_ARRAY_ELEMS(freqinfos); i++) { - if ((ret = ff_add_format(&formats, freqinfos[i].sample_rate)) < 0) + if ((ret = ff_add_format(&rates, freqinfos[i].sample_rate)) < 0) return ret; } - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates2(ctx, cfg_in, cfg_out, rates); } static int config_input(AVFilterLink *inlink) @@ -638,5 +651,5 @@ const AVFilter ff_af_replaygain = { .flags = AVFILTER_FLAG_METADATA_ONLY, FILTER_INPUTS(replaygain_inputs), FILTER_OUTPUTS(replaygain_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), }; From patchwork Thu Sep 5 10:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51379 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp308827vqb; Thu, 5 Sep 2024 04:04:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmr8CCJ+SZDx5eBIC+KXfG5fa5D18OX16xHSe2mz7JCHh1geQYXlmraBsAEuJQLoEGFlcKvXfLKU5LnlKWWWs6@gmail.com X-Google-Smtp-Source: AGHT+IEBk1IdyPPU/CrBy7zc2A8CbG9qOLE0+0tU5C8wVqX/+qPy39u5Soc7wJsarb1BYPeB5V/F X-Received: by 2002:a17:907:2d1f:b0:a80:a31f:44be with SMTP id a640c23a62f3a-a89a3579be6mr727665366b.3.1725534258147; Thu, 05 Sep 2024 04:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725534258; cv=none; d=google.com; s=arc-20240605; b=Poqwy81fmo742vVsPcnts1teCzEPXtbf8XTUumw+6Xd5sgxkKcyX/r3ZU7fa5DHq8E JGXDmST4desRtXfjSe4RyXkTBUsXQ0zEGsQpj8+ySTLLOBeJJJYjD7TISyrc6W+77y41 COK7LVgYzKgkcfN//D1RC8RCze3Imu05fJ4wxHQ43RYpajUUEdGdlom5iyVdZctzJZn8 xAt97LddLuY/9b/eTa2I8kDBFo39bhxOTvVwzZE/GSUwfw2e1iMsZVzfRzGWK8Ngk5/D pxkYec6HPTiUaLu3Llxjwjiud55I/Q7KJnjFky3LGcNQczXVQfyxUw3BdgXx8LlQOAMN zjeA== 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=oudYGZOqRoy6UFq1s0TjCwKqkyiPRHFPoXo5PBH4LWw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=cLl3oPp2csQKHEd0bWRwaru6egMHSoetXcc55JhrXxMxUs2OOM5iTpaXAXFY9ms2CK UPxPKRCERmWeu7BUT/TsZQeVxzicJ9XPrBPZWJYNk+Uo98mhfXYxeLq6rjYIR4u8Afua lzssgFTyHFFQOdO4//q/uOx4GhXLWAGhhzo7vH+R1+7cuhj8bnAq1RFFY2PG+Akhh0ck 1lBrMYbVxVbs3X1FxMsw0b+DkOIiRFze3r84ZAzZP/xZl59VMqW5VhbVL3Z430ZpopGj wX8BnWJduSXQUe/Z3tP3ZtXrIi4qvezd3Hwz4p6yogpzc3wLCLpGsPNdWW2mdXd5cCf4 Skdg==; 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=C8AM6whV; 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-a8a62379d42si133950166b.384.2024.09.05.04.04.17; Thu, 05 Sep 2024 04:04: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=C8AM6whV; 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 618C768DEAF; Thu, 5 Sep 2024 13:08:06 +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 EF90068DD0E 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=C8AM6whV; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 124804E0C for ; Thu, 5 Sep 2024 12:07:46 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id ayaE7denmcmW for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530862; bh=QKxbtywgrLWdsjferyUIWtNx7XKJ+AGMsiK3SG2JHRU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=C8AM6whV1Aod76hx8lgUjsR0H5Wnkgz/TMd8ctW+GSdUaHsjjPgIxedq9SeuqgQCO KzsyHnGdKvhgWQfVdJSWGpzfYQW4qf5qFRpl2LQ1jTCCpe+eqBDfwLBUvPcIpOE5Qw Thh7dFnvtb7IPnIhVPSNFpUQb0Ypw0eGTXgu9TP7umdQcxaNEy7DZ/bnXwOhYqRCpy Ss+Sqhwe3NrgFaA9lGb5oQjvVULMC99r9TOXuCtut3bPJWAE9jgNDwgzHJfJv5hrQ3 BV9+HAjbVdhewUjNbGNqpkNzsZ7BhU/KXbieuxG5iipPqp/3p0Y6eHO0hQBe2sDRic 1l51xLfeEGWPA== 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 DFF1C4E27 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 CFB5A3A3098 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:27 +0200 Message-ID: <20240905100729.6030-23-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 23/25] lavfi/af_lv2: 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: 9lwgng8wpETj --- libavfilter/af_lv2.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index 7e8ab4de03..db9b1e3639 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -474,25 +474,22 @@ static av_cold int init(AVFilterContext *ctx) return 0; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - LV2Context *s = ctx->priv; + const LV2Context *s = ctx->priv; AVFilterChannelLayouts *layouts; - AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret = ff_set_common_formats_from_list(ctx, sample_fmts); + int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); if (ret < 0) return ret; - if (s->nb_inputs) { - ret = ff_set_common_all_samplerates(ctx); - if (ret < 0) - return ret; - } else { + if (!s->nb_inputs) { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates_from_list(ctx, sample_rates); + ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); if (ret < 0) return ret; } @@ -502,24 +499,23 @@ static int query_formats(AVFilterContext *ctx) ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); if (ret < 0) return ret; - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, layouts); if (ret < 0) return ret; } else { if (s->nb_inputs >= 1) { - AVFilterLink *inlink = ctx->inputs[0]; AVChannelLayout inlayout = FF_COUNT2LAYOUT(s->nb_inputs); layouts = NULL; ret = ff_add_channel_layout(&layouts, &inlayout); if (ret < 0) return ret; - ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); if (ret < 0) return ret; if (!s->nb_outputs) { - ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret < 0) return ret; } @@ -532,7 +528,7 @@ static int query_formats(AVFilterContext *ctx) ret = ff_add_channel_layout(&layouts, &outlayout); if (ret < 0) return ret; - ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); if (ret < 0) return ret; } @@ -604,6 +600,6 @@ const AVFilter ff_af_lv2 = { .process_command = process_command, .inputs = 0, FILTER_OUTPUTS(lv2_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; From patchwork Thu Sep 5 10:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51373 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp294239vqb; Thu, 5 Sep 2024 03:34:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV76T+OIuFL5QN6emGt+qdHf6gTBpxeox7PVmF8uOHb4bFZrMS5OYQfbYQ+AdjbI9H8m0H/FsZZFEB6gcDn3DBE@gmail.com X-Google-Smtp-Source: AGHT+IGa/fqAr60bbMnN85zwnKpnwpBy9oRcVta4FR898DC+g20KO5SgNuIZDQ7dmO5ox+7QGwiO X-Received: by 2002:a05:6512:3e0f:b0:535:6986:9806 with SMTP id 2adb3069b0e04-5356986989cmr1844927e87.3.1725532452631; Thu, 05 Sep 2024 03:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725532452; cv=none; d=google.com; s=arc-20240605; b=k7EVrK6O3vPk0gdh80h3eG9qoqItfAQ6iwGkGhX+ePkDtoXkRDKxMF4/E++HMS0C7z q8zEsWJJUN4umWmOQxHBHLH9/5vqn68XEaOBixJHP3ipsb7jhpaMufTCUSFoddcTwsCd 0Dy8zZsoCQa547I+U5NCps/Hfp518WXEOet86j1TCwti6TtVClFzMtFDnS6vr11HYrHN BoJ6fdDnkssGX8XNbr9pIPVCW4J+PwbjQ+pmzyPraeXhQmEckc3aTMfxMmb1BxOuV8S/ BOaSOAvSW1NGTIRgI6qhHO70/qSD3XuANApPW9p0IAHnZ8nPO30a12h5CdpK5YYRQ0r8 TUVw== 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=46n7VL5/ipMVaKEiCfvRaoFZD+JQftxVbTP7w/JF/hY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=dzchOs85yHcFPLvpV0bEW3XitRZfLGmaZNfNUwn72V9UiB2UdkXoTsk02/uxqxjxYB Zmt+RJIeESmwBmYwCkbyU6kSZEfNp9EmbsqFYgyoDpgT32ABLmPkjA4h6ybJQMFcAXYh TA1QxI0hiSVaD3xaaxng7xut1Difg8aeKdqnaqSkm4KF+uogun23FWlVyap81GLp/VCG m5ZD9Iy0oOgx2MvVpAEnfgZXn7JONvR6vLaVo9o0Nd0cLZQmBbF/mIa9kkyzbFoGBbGV 8sTPH7gd9ze9G3h/P5Ol1vCVGz+v7CHlgiBrhqkDQX3iMb9r2w+LslRYNZoYoFNCoF0x TXow==; 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=pB+AHlps; 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-53568b407a5si1062668e87.616.2024.09.05.03.34.11; Thu, 05 Sep 2024 03:34:12 -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=pB+AHlps; 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 93C3368DF4F; Thu, 5 Sep 2024 13:08:11 +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 1F19668DD18 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=pB+AHlps; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 1F76E4E16 for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id kBon-vdISgDG for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=m1vlSihewSVC6e94/YYPKwQeehOeuR76y41sihdkg4E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pB+AHlpsYgEkE69qSaTY9te77U5qT/V3VOuZ9597fPX6DxtLc75IPAL0SWm9bSmkh C8X3ctZMsgrppfjypdtkbUu60bR1cuAs5P2ZJ45GkHWJuYagUYgTrULr/NuhV+Q63R OV5VhCESeoJ4aD8Jd1jRCHve/tmB7YWy20eY9fTDIZlwvFc7jHf7GxtAMjhc7JAqJX Nc4hTUsI9DYkC2KnaXFy4iHpQX0ELYG4h0jFvsqbLSwVBwNLkRRgwtcMUEv58Qh1EO xzb3luwe9vqXhzFaT0SdGEhkEwGeR9ew6UWNFpvTzi4uK1rHB/tfvMwUKoI94J2IDP F2Z/kvS3UKjOw== 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 BE73A4E25 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 DAFF93A309C 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:28 +0200 Message-ID: <20240905100729.6030-24-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 24/25] lavfi/af_pan: stop modifying private data in query_formats() 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: JBpuNR1Ufc2o It is not supposed to have any side effects, and the modification in question can just as well be done in filter init. --- libavfilter/af_pan.c | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 02a899b88e..f2f6daa658 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -91,6 +91,28 @@ static int parse_channel_name(char **arg, int *rchannel, int *rnamed) return AVERROR(EINVAL); } +static int are_gains_pure(const PanContext *pan) +{ + int i, j; + + for (i = 0; i < MAX_CHANNELS; i++) { + int nb_gain = 0; + + for (j = 0; j < MAX_CHANNELS; j++) { + double gain = pan->gain[i][j]; + + /* channel mapping is effective only if 0% or 100% of a channel is + * selected... */ + if (gain != 0. && gain != 1.) + return 0; + /* ...and if the output channel is only composed of one input */ + if (gain && nb_gain++) + return 0; + } + } + return 1; +} + static av_cold int init(AVFilterContext *ctx) { PanContext *const pan = ctx->priv; @@ -213,6 +235,7 @@ static av_cold int init(AVFilterContext *ctx) } } pan->need_renumber = !!nb_in_channels[1]; + pan->pure_gains = are_gains_pure(pan); ret = 0; fail: @@ -220,37 +243,14 @@ fail: return ret; } -static int are_gains_pure(const PanContext *pan) -{ - int i, j; - - for (i = 0; i < MAX_CHANNELS; i++) { - int nb_gain = 0; - - for (j = 0; j < MAX_CHANNELS; j++) { - double gain = pan->gain[i][j]; - - /* channel mapping is effective only if 0% or 100% of a channel is - * selected... */ - if (gain != 0. && gain != 1.) - return 0; - /* ...and if the output channel is only composed of one input */ - if (gain && nb_gain++) - return 0; - } - } - return 1; -} - static int query_formats(AVFilterContext *ctx) { - PanContext *pan = ctx->priv; + const PanContext *pan = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; AVFilterChannelLayouts *layouts; int ret; - pan->pure_gains = are_gains_pure(pan); /* libswr supports any sample and packing formats */ if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) return ret; From patchwork Thu Sep 5 10:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51377 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:f31:b0:48e:c0f8:d0de with SMTP id kb17csp308779vqb; Thu, 5 Sep 2024 04:04:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWrNeblTCQo6pLYt+TvfgMVwNdrbJg4g5mH8cXw+5z8zM15Bs8lU8Sc5kZLqqD/RJjk7jar2hsE15zr0n0ytS7Y@gmail.com X-Google-Smtp-Source: AGHT+IESNTVE4VtCDgmX+RUg2hw4sbwaDoOiJNb3ghFKSMBk427dSIAkoiNn9qRLQA6t7Mu0ZebV X-Received: by 2002:a17:907:ea3:b0:a86:a12b:2cea with SMTP id a640c23a62f3a-a897fad6ff4mr2028570466b.67.1725534253580; Thu, 05 Sep 2024 04:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725534253; cv=none; d=google.com; s=arc-20240605; b=Y8vgVpeIl35mbOKUAgCCHYjm695QokRb283fs2n0yBQufrz/K0v2H5RqTrnXpjU9A+ 6nWchGjT21DNRgEvTBP4O5NudSr+UHL68OqdRPOY4qx9pWvbZxDJZOFjCmgq8S2cyIGF bbBjt01F8cM0zbr+O/BEGNDniQBdOmlJfqD1P078p/jHI2DgJTP9WcyWK2wLaVpWfo5k 5EiS1yarNF4BzdYoEEbnVIB+m4DcdMhZyGWUI7wH5Hnp2H67SESuiHJJdzLWiLX5Os66 EIhfB7AdEUj1xR7hfu/5Uw6aPF0Kc/CV7QdlA3F+sJydB3yXNHENNd7fSR5URYYWnPJQ tS1w== 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=cJObYVbDBcKHRajWIaGhrp02Xr/G2wjVu9Pp38ebG5Q=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=PAcrZ1WTSpy0hRf0kNii2fNq/xN6f3IMUoNol2fi+5HnLVcCFCnk12P0CrVm9Zvrod U5HhH0W9sMXghQq2MUwmYa6HRDhq41UdikozcwL+qR5FcZCqzBMeQrpF4I3W7ohW+e0o /0zAK9b0bBiKrMWGxYjvwSDwbF78iGDcRlB0Ax5jNoNxNmhmMQA9T25znbXjj516ngVm +XlOB/tSRjs+zdFfKw470sTaBNAumuzZW4hhOb2lxMhofpojomDDO8NuRT8YoS+qeX8V XEKpL+wZ3yLZ9whOqSGoYvDhuPTedSRFU+s9Y4ZYfj6juWY6rTv9UYAtW3G2YYXkMLk8 /+Zg==; 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=grK1iRfo; 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-a8a700d64f9si70563666b.98.2024.09.05.04.04.13; Thu, 05 Sep 2024 04:04:13 -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=grK1iRfo; 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 A988B68DD7B; Thu, 5 Sep 2024 13:08:03 +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 BB5A568DCF5 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=grK1iRfo; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 2C3FF4E18 for ; Thu, 5 Sep 2024 12:07:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id RGmrImDmdONm for ; Thu, 5 Sep 2024 12:07:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1725530861; bh=HhkKJKOYlWsDGxI7IOOzgzojU+2U7FL7GBf208wK/s8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=grK1iRfo3obscohxLSDPITH7xwMtmF1W1WuHIYv+WZalh3NOofvw46/gdvj1MI2ap qKUudMhHpVG1h0xHzNI3QQcTYN80bB1eFCkR8PfLK+SyvZJw35DEUVfRe5srehQ73n 6kawtp3mqoTjXMUo1wHpsrj/vis7K97pnFdabyl1MrWJBckX6YqzP1ikRER9q/azSK e2c2o+pVflNihiDwftB4FKtzKAESkkOxC0c1Pa7QLql7htrqvQmBxiMAEUbwVRH3ww Ga/4Iqn1Z+YtkQ1jeIkrAlLzaFWTSWq+CpLziAauVYarAhbkxJtrMtoug5fa4BTF2p qeo6PZciDk2bQ== 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 B96024E20 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 E61993A30A4 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:29 +0200 Message-ID: <20240905100729.6030-25-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 25/25] lavfi/af_pan: 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: vlJaSoGacH3D Also, drop redundant calls that also happen implicitly in generic code. --- libavfilter/af_pan.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index f2f6daa658..0d20b0307b 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -243,31 +243,24 @@ fail: return ret; } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { const PanContext *pan = ctx->priv; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; AVFilterChannelLayouts *layouts; int ret; - /* libswr supports any sample and packing formats */ - if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) - return ret; - - if ((ret = ff_set_common_all_samplerates(ctx)) < 0) - return ret; - // inlink supports any channel layout layouts = ff_all_channel_counts(); - if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0) + if ((ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts)) < 0) return ret; // outlink supports only requested output channel layout layouts = NULL; if ((ret = ff_add_channel_layout(&layouts, &pan->out_channel_layout)) < 0) return ret; - return ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); + return ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); } static int config_props(AVFilterLink *link) @@ -432,5 +425,5 @@ const AVFilter ff_af_pan = { .uninit = uninit, FILTER_INPUTS(pan_inputs), FILTER_OUTPUTS(ff_audio_default_filterpad), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), };