[FFmpeg-devel] [PATCH 2/7] lavc/options: properly init AVCodecContext.colorspace

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Oct 11 18:44:49 EEST 2023


Niklas Haas:
> From: Niklas Haas <git at haasn.dev>
> 
> This currently defaults to AVCOL_SPC_RGB, but it should properly default
> to AVCOL_SPC_UNSPECIFIED, following the logic of the other fields.
> ---
>  libavcodec/options.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index a9b35ee1c3..c39218d7fb 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -123,6 +123,7 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
>      s->pix_fmt             = AV_PIX_FMT_NONE;
>      s->sw_pix_fmt          = AV_PIX_FMT_NONE;
>      s->sample_fmt          = AV_SAMPLE_FMT_NONE;
> +    s->colorspace          = AVCOL_SPC_UNSPECIFIED;
>  
>  #if FF_API_REORDERED_OPAQUE
>  FF_DISABLE_DEPRECATION_WARNINGS

This is wrong; the default value of colorspace is AVCOL_SPC_UNSPECIFIED:
{"colorspace", "color space", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64
= AVCOL_SPC_UNSPECIFIED }, 0, INT_MAX, V|E|D, "colorspace_type"},

- Andreas



More information about the ffmpeg-devel mailing list