diff mbox series

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

Message ID 20231011150848.117897-3-ffmpeg@haasn.xyz
State New
Headers show
Series Towards YUVJ removal, v2 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas Oct. 11, 2023, 2:55 p.m. UTC
From: Niklas Haas <git@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(+)

Comments

Andreas Rheinhardt Oct. 11, 2023, 3:44 p.m. UTC | #1
Niklas Haas:
> From: Niklas Haas <git@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
diff mbox series

Patch

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