Commit c200628eac for ffmpeg
commit c200628eace04db7589df029ea83169d0638d857
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Wed Sep 9 07:12:50 2026 +0200
avcodec: add AV_CODEC_CONFIG_CHROMA_LOCATION
Lets an encoder state which chroma sample locations it can accept, so the
caller can convert to one.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/doc/APIchanges b/doc/APIchanges
index eb2c0c458b..103817062c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -5,6 +5,9 @@ API changes, most recent first:
2026-09-xx - xxxxxxxxxx - lavfi 12.4.101 - avfilter.h
Add AVFilterLink.chroma_location.
+2026-09-xx - xxxxxxxxxx - lavc 63.16.100 - avcodec.h
+ Add AV_CODEC_CONFIG_CHROMA_LOCATION.
+
2026-08-xx - xxxxxxxxxx - lavf 63.7.100 - avformat.h
Add AV_STREAM_GROUP_PARAMS_GAIN_MAP.
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 5320dfc06c..7c8f875e2b 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -810,6 +810,10 @@ int ff_default_get_supported_config(const AVCodecContext *avctx,
*out_num_configs = av_popcount(alpha_modes);
return 0;
+ case AV_CODEC_CONFIG_CHROMA_LOCATION:
+ WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, chroma_locations, loc,
+ enum AVChromaLocation, loc == AVCHROMA_LOC_UNSPECIFIED);
+
default:
return AVERROR(EINVAL);
}
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1b3eaa799c..dcd19f8ff5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2593,6 +2593,7 @@ enum AVCodecConfig {
AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED
AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED
AV_CODEC_CONFIG_ALPHA_MODE, ///< AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED
+ AV_CODEC_CONFIG_CHROMA_LOCATION, ///< AVChromaLocation, terminated by AVCHROMA_LOC_UNSPECIFIED
};
/**
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index d6b6317a6e..27cbbc32e0 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -154,6 +154,14 @@ typedef struct FFCodec {
*/
unsigned alpha_modes:2;
+ /**
+ * This field determines the chroma sample locations supported by an
+ * encoder, terminated by AVCHROMA_LOC_UNSPECIFIED. Only needs to be set
+ * by encoders whose format defines the chroma siting, a NULL list means
+ * the encoder accepts whatever it is given.
+ */
+ const enum AVChromaLocation *chroma_locations;
+
/**
* This field determines the type of the codec (decoder/encoder)
* and also the exact callback cb implemented by the codec.
@@ -411,6 +419,9 @@ int ff_default_get_supported_config(const struct AVCodecContext *avctx,
#define CODEC_PIXFMTS(...) CODEC_PIXFMTS_ARRAY(((const enum AVPixelFormat[]) { __VA_ARGS__, AV_PIX_FMT_NONE }))
#define CODEC_PIXFMTS_ARRAY(array) CODEC_ARRAY(pix_fmts, (array))
+#define CODEC_CHROMA_LOCS(...) CODEC_CHROMA_LOCS_ARRAY(((const enum AVChromaLocation[]) { __VA_ARGS__, AVCHROMA_LOC_UNSPECIFIED }))
+#define CODEC_CHROMA_LOCS_ARRAY(array) CODEC_ARRAY(chroma_locations, (array))
+
#define CODEC_ARRAY(field, array) \
.field = (array) \
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 9b8c267529..82a86fe9d9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 15
+#define LIBAVCODEC_VERSION_MINOR 16
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \