[FFmpeg-devel] [PATCH 05/25] avfilter/buffersrc: add color_space/range parameters
Anton Khirnov
anton at khirnov.net
Wed Dec 6 17:10:03 EET 2023
Quoting Niklas Haas (2023-11-09 13:19:37)
> @@ -328,6 +341,30 @@ static const AVOption buffer_options[] = {
> { "pixel_aspect", "sample aspect ratio", OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
> { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
> { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
> + { "colorspace", "select colorspace", OFFSET(color_space), AV_OPT_TYPE_INT, {.i64=AVCOL_SPC_UNSPECIFIED}, 0, AVCOL_SPC_NB-1, V, "colorspace"},
> + { "gbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_RGB}, INT_MIN, INT_MAX, V, "colorspace"},
^^^
is that intentional?
> @@ -432,6 +471,15 @@ static int query_formats(AVFilterContext *ctx)
> if ((ret = ff_add_format (&formats, c->pix_fmt)) < 0 ||
> (ret = ff_set_common_formats (ctx , formats )) < 0)
> return ret;
> + /* force specific colorspace/range downstream only for ordinary YUV */
> + if (ff_fmt_is_regular_yuv(c->pix_fmt)) {
What will this do when the colorspace is not set, as it will not be with
existing callers.
> diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h
> index 3b248b37cd..4357a7bbfb 100644
> --- a/libavfilter/buffersrc.h
> +++ b/libavfilter/buffersrc.h
> @@ -105,6 +105,12 @@ typedef struct AVBufferSrcParameters {
> */
> AVBufferRef *hw_frames_ctx;
>
> + /**
> + * Video only, the YUV colorspace and range
> + */
> + enum AVColorSpace color_space;
> + enum AVColorRange color_range;
This has to go at the end of the struct, otherwise you're breaking ABI.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list