From patchwork Tue Oct 1 10:54: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: 51958 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cb8a:0:b0:48e:c0f8:d0de with SMTP id d10csp175272vqv; Tue, 1 Oct 2024 03:55:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX0JgbfGxwe1zpyXDhVBxzDuXBf8W2rFVUp0Jf4VOiSZzw7OzUd6LpxtCU3PzKehhTAuyH8HJIccrozdKCE0JGi@gmail.com X-Google-Smtp-Source: AGHT+IFDe279y0+GEZSsHnHjjmtt5fvq3n0jEFinBgVlydGyz1P+UvV7FcXikJGpppaZlVWQOb1M X-Received: by 2002:a17:907:e93:b0:a91:7af:d3f2 with SMTP id a640c23a62f3a-a93c4c272ecmr1420030266b.63.1727780127373; Tue, 01 Oct 2024 03:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727780127; cv=none; d=google.com; s=arc-20240605; b=Hy4TEgmkor1NGmP6cD0W3T/7TXEWFGPqHNNcaVy4Lb+stw3PBrPfc5pgK6urCuP5rl uRik2Ym+TS6N1K7SbmTVsBtQN16GtFYUmQ1xeZnO2eZ3YF3zdA8cuxNZ/UJL0v4ZgQzb 0hn58yKunDqNPenB2GokQO/77a6ax/KeEFzTL0QJOTSN04bK2FiVmdSZA2BWWB83SxAm mOnJmXsmDMkIStW1ZSsXikiu5/Nr3zmvylN9TJyRm9EBa3vIXfLxHR9IEJTW4vyYL+VN dBpDHfZBdc//C/Ek4GKpLnlpFUf1kkuHAaTPnCmJLaIJCStk2ol/sKzfcfDHyfnpy5dp I4vQ== 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=IqN6Po5DWaaYtEXgXy3WbSBPg26lxH4/CoTH3hm+mCM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=AgwoJGVamVG8XaOgwRkg0/MCbAaOolat3m8z4oujFNzOlkfAye+2w7S0FxWcCMC47G uZQsxwKD7T4J9UQaZ0wtldYrZ88PkZzCuz9GPS9LyvE/9RjhI94fjTD3kxLmUyyXXWP9 iqaE7SFG3pnn8oEEJoKJ2k7HhTfoxfrbhxH/JuO7CRhei0xriL67Ib+DdWu8wM521qUr 2wVsOlBe+dK/D07WS8kMnWTqi95oea4R5j9G3R0y10x+uf02orEzIvl6EWqg9e1aMR2w gjzV2rM2Q5/+O3nzsqBI5y++WvRvoiOS2osBDKHh+ZSA7J3YkV664/2C/Y7BbUDbC9Fo rI2A==; 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=X4c49vnV; 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-a93c29ee5adsi736943066b.530.2024.10.01.03.55.25; Tue, 01 Oct 2024 03:55:27 -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=X4c49vnV; 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 5658E68DB92; Tue, 1 Oct 2024 13:54:45 +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 2B07468DB2F for ; Tue, 1 Oct 2024 13:54:36 +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=X4c49vnV; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C27F64E23 for ; Tue, 1 Oct 2024 12:54:34 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id QIUiQHfe9_tU for ; Tue, 1 Oct 2024 12:54:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1727780072; bh=5pyKIUKF+e9tkvYEPBPkUVyFHC+aUS2FRblEuKcUg+E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X4c49vnVB/R6j2A9xEzkqiT5QKPrJCF6VFaXE//21PMceLQt5b8pxus6fH6eT8QaW BZ7pCcYf1Tr9SnbAsp00Hz01bWn317Ic+zfFMFqE7ESFMkOnQOQDIgGdgbwei9O/fp 4ZZEDe/4kyySgfz6ag6MqN6AYEPDvNkL+cvTgqVg64Q9rlWPMv3ZR6EiSeLUK2DQkk oR5zDEJJxWSfqjgahOAGmW2+eMDbaX+jBfds7Q+uq8P/4Cs2OJZ88Im0zmO8yJnUyv iqb7YLnRcj8tuqpZcaHrC18FDo/H/hxIpWU3KRTuhkeRtu1IlIxyl6VMN0og+HhgBe lffjH7ZQMr1rQ== 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 AF8B1EE9 for ; Tue, 1 Oct 2024 12:54:32 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E91213A1A81 for ; Tue, 01 Oct 2024 12:54:25 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Oct 2024 12:54:10 +0200 Message-ID: <20241001105421.28967-5-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001105421.28967-1-anton@khirnov.net> References: <20241001105421.28967-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/16] lavfi/buffersrc: switch to query_func2() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6eEVXNTPhZgR --- libavfilter/buffersrc.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 3d679cad53..bdf8b14451 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -439,9 +439,11 @@ static av_cold void uninit(AVFilterContext *ctx) av_channel_layout_uninit(&s->ch_layout); } -static int query_formats(AVFilterContext *ctx) +static int query_formats(const AVFilterContext *ctx, + AVFilterFormatsConfig **cfg_in, + AVFilterFormatsConfig **cfg_out) { - BufferSourceContext *c = ctx->priv; + const BufferSourceContext *c = ctx->priv; AVFilterChannelLayouts *channel_layouts = NULL; AVFilterFormats *formats = NULL; AVFilterFormats *samplerates = NULL; @@ -455,12 +457,12 @@ static int query_formats(AVFilterContext *ctx) if (av_pix_fmt_desc_get(swfmt)->flags & AV_PIX_FMT_FLAG_HWACCEL) swfmt = ((AVHWFramesContext *) c->hw_frames_ctx->data)->sw_format; if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 || - (ret = ff_set_common_formats (ctx , formats )) < 0) + (ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, formats)) < 0) return ret; /* force specific colorspace/range downstream only for ordinary YUV */ if (ff_fmt_is_regular_yuv(swfmt)) { if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 || - (ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0) + (ret = ff_set_common_color_spaces2(ctx, cfg_in, cfg_out, color_spaces)) < 0) return ret; if (ff_fmt_is_forced_full_range(swfmt)) { if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_JPEG)) < 0) @@ -474,21 +476,21 @@ static int query_formats(AVFilterContext *ctx) return ret; } } - if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) + if ((ret = ff_set_common_color_ranges2(ctx, cfg_in, cfg_out, color_ranges)) < 0) return ret; } break; } case AVMEDIA_TYPE_AUDIO: if ((ret = ff_add_format (&formats , c->sample_fmt )) < 0 || - (ret = ff_set_common_formats (ctx , formats )) < 0 || + (ret = ff_set_common_formats2 (ctx, cfg_in, cfg_out, formats)) < 0 || (ret = ff_add_format (&samplerates, c->sample_rate)) < 0 || - (ret = ff_set_common_samplerates (ctx , samplerates )) < 0) + (ret = ff_set_common_samplerates2(ctx, cfg_in, cfg_out, samplerates)) < 0) return ret; if ((ret = ff_add_channel_layout(&channel_layouts, &c->ch_layout)) < 0) return ret; - if ((ret = ff_set_common_channel_layouts(ctx, channel_layouts)) < 0) + if ((ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, channel_layouts)) < 0) return ret; break; default: @@ -567,7 +569,7 @@ const AVFilter ff_vsrc_buffer = { .inputs = NULL, FILTER_OUTPUTS(avfilter_vsrc_buffer_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &buffer_class, }; @@ -589,6 +591,6 @@ const AVFilter ff_asrc_abuffer = { .inputs = NULL, FILTER_OUTPUTS(avfilter_asrc_abuffer_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_QUERY_FUNC2(query_formats), .priv_class = &abuffer_class, };