aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-04-05 20:05:58 +0200
committerNiklas Haas <git@haasn.dev>2024-09-08 13:59:29 +0200
commita577172c99e47b6d950e2b1ce8434ad74279247c (patch)
treed933ec5157d45e65a2bf316a130dc3a6e05e5e32 /libavcodec
parent0977d968e46def74141cc474aebee6e47adfa7d0 (diff)
downloadffmpeg-a577172c99e47b6d950e2b1ce8434ad74279247c.tar.gz
avcodec/libaomenc: switch to get_supported_config()
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libaomenc.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 32bda992cb..0f7571ee7a 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1427,16 +1427,36 @@ static const enum AVPixelFormat av1_pix_fmts_highbd_with_gray[] = {
AV_PIX_FMT_NONE
};
-static av_cold void av1_init_static(FFCodec *codec)
+static int av1_get_supported_config(const AVCodecContext *avctx,
+ const AVCodec *codec,
+ enum AVCodecConfig config,
+ unsigned flags, const void **out,
+ int *out_num)
{
- int supports_monochrome = aom_codec_version() >= 20001;
- aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
- if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
- codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_highbd_with_gray :
- av1_pix_fmts_highbd;
- else
- codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_with_gray :
- av1_pix_fmts;
+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
+ int supports_monochrome = aom_codec_version() >= 20001;
+ aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
+ if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
+ if (supports_monochrome) {
+ *out = av1_pix_fmts_highbd_with_gray;
+ *out_num = FF_ARRAY_ELEMS(av1_pix_fmts_highbd_with_gray) - 1;
+ } else {
+ *out = av1_pix_fmts_highbd;
+ *out_num = FF_ARRAY_ELEMS(av1_pix_fmts_highbd) - 1;
+ }
+ } else {
+ if (supports_monochrome) {
+ *out = av1_pix_fmts_with_gray;
+ *out_num = FF_ARRAY_ELEMS(av1_pix_fmts_with_gray) - 1;
+ } else {
+ *out = av1_pix_fmts;
+ *out_num = FF_ARRAY_ELEMS(av1_pix_fmts) - 1;
+ }
+ }
+ return 0;
+ }
+
+ return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
}
static av_cold int av1_init(AVCodecContext *avctx)
@@ -1560,5 +1580,5 @@ FFCodec ff_libaom_av1_encoder = {
FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
- .init_static_data = av1_init_static,
+ .get_supported_config = av1_get_supported_config,
};