diff options
author | Niklas Haas <git@haasn.dev> | 2024-04-05 20:03:15 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-04-09 14:36:41 +0200 |
commit | 66e666bddbe3796b1442ef080af5f7285085cf19 (patch) | |
tree | d531b9249efe7758f8399689b32ec34789361ae4 | |
parent | cfb776ea26655f9bedc727b4f8c14cf16cb37f52 (diff) |
avcodec/libvpxenc: switch to get_supported_config()
-rw-r--r-- | libavcodec/libvpxenc.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index cdb8331261..64dc69f854 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -2087,13 +2087,21 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { AV_PIX_FMT_NONE }; -static av_cold void vp9_init_static(FFCodec *codec) +static int vp9_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, + enum AVCodecConfig config, + unsigned flags, const void **out) { - vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); - if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) - codec->p.pix_fmts = vp9_pix_fmts_highbd; - else - codec->p.pix_fmts = vp9_pix_fmts_highcol; + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { + vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); + if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) + *out = vp9_pix_fmts_highbd; + else + *out = vp9_pix_fmts_highcol; + return 0; + } + + return ff_default_get_supported_config(avctx, codec, config, flags, out); } static const AVClass class_vp9 = { @@ -2122,6 +2130,6 @@ FFCodec ff_libvpx_vp9_encoder = { .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, .defaults = defaults, - .init_static_data = vp9_init_static, + .get_supported_config = vp9_get_supported_config, }; #endif /* CONFIG_LIBVPX_VP9_ENCODER */ |