From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E8DAC49493 for ; Sun, 11 Feb 2024 20:49:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 152D368D09E; Sun, 11 Feb 2024 22:48:59 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A52BD68BC86 for ; Sun, 11 Feb 2024 22:48:52 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1707684531; bh=7NDGPDIMdPjsDG8+XcBHI7vzFYyOESL+Vt3frUU31nY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FmID8jbnN415Wx2P+YQCU6gmKHsqeKGRZych6J4QO+6bG+2oM+U2R+yhMArlMcHZO 8YTeXf+/z4e9xIqzBA8ESwVtgDJlw4yW7/PPZogvSrPyJzfXNuur8A/xPMN8vAEeqv 6KJZqgubdKzHN+KldtOCbdZ/PBzRsH10OThYqEco= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id AF77B40941; Sun, 11 Feb 2024 21:48:51 +0100 (CET) Date: Sun, 11 Feb 2024 21:48:51 +0100 Message-ID: <20240211214851.GB28633@haasn.xyz> From: Niklas Haas To: ffmpeg-devel@ffmpeg.org In-Reply-To: <20240210105629.11095-1-ffmpeg@haasn.xyz> References: <20240210105629.11095-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_setparams: use YUV colorspace negotiation API 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, 10 Feb 2024 11:56:29 +0100 Niklas Haas wrote: > From: Niklas Haas > > When this filter overrides frame properties, the outgoing frames have > a different YUV colorspace than the incoming ones. This requires > signalling the new colorspace on the outlink, and in particular, making > sure it's *not* set to a common ref with the input - otherwise the point > of this filter would be destroyed. > > Untouched fields will continue being passed through, so we don't need to > do anything there. > --- > libavfilter/vf_setparams.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c > index ae4c937518..a33c35a942 100644 > --- a/libavfilter/vf_setparams.c > +++ b/libavfilter/vf_setparams.c > @@ -23,6 +23,7 @@ > #include "libavutil/pixfmt.h" > #include "libavutil/opt.h" > #include "avfilter.h" > +#include "formats.h" > #include "internal.h" > #include "video.h" > > @@ -120,6 +121,29 @@ static const AVOption setparams_options[] = { > > AVFILTER_DEFINE_CLASS(setparams); > > +static int query_formats(AVFilterContext *ctx) > +{ > + SetParamsContext *s = ctx->priv; > + AVFilterLink *outlink = ctx->outputs[0]; > + int ret; > + > + if (s->colorspace >= 0) { > + ret = ff_formats_ref(ff_make_formats_list_singleton(s->colorspace), > + &outlink->incfg.color_spaces); > + if (ret < 0) > + return ret; > + } > + > + if (s->color_range >= 0) { > + ret = ff_formats_ref(ff_make_formats_list_singleton(s->color_range), > + &outlink->incfg.color_ranges); > + if (ret < 0) > + return ret; > + } > + > + return 0; > +} > + > static int filter_frame(AVFilterLink *inlink, AVFrame *frame) > { > AVFilterContext *ctx = inlink->dst; > @@ -177,6 +201,7 @@ const AVFilter ff_vf_setparams = { > .flags = AVFILTER_FLAG_METADATA_ONLY, > FILTER_INPUTS(inputs), > FILTER_OUTPUTS(ff_video_default_filterpad), > + FILTER_QUERY_FUNC(query_formats), > }; > > #if CONFIG_SETRANGE_FILTER > @@ -217,6 +242,7 @@ const AVFilter ff_vf_setrange = { > .flags = AVFILTER_FLAG_METADATA_ONLY, > FILTER_INPUTS(inputs), > FILTER_OUTPUTS(ff_video_default_filterpad), > + FILTER_QUERY_FUNC(query_formats), > }; > #endif /* CONFIG_SETRANGE_FILTER */ Will merge rather soon without objection, as this prevents vf_setparams from working correctly. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".