Unified · Split
| @@ -2088,13 +2088,25 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { · 2087 unmodified lines | ||
| 2088 | 2088 | AV_PIX_FMT_NONE |
| 2089 | 2089 | }; |
| 2090 | 2090 | |
| 2091 | −static av_cold void vp9_init_static(FFCodec *codec) | |
| 2091 | +static int vp9_get_supported_config(const AVCodecContext *avctx, | |
| 2092 | + const AVCodec *codec, | |
| 2093 | + enum AVCodecConfig config, | |
| 2094 | + unsigned flags, const void **out, | |
| 2095 | + int *out_num) | |
| 2092 | 2096 | { |
| 2093 | − vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); | |
| 2094 | − if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) | |
| 2095 | − codec->p.pix_fmts = vp9_pix_fmts_highbd; | |
| 2096 | − else | |
| 2097 | − codec->p.pix_fmts = vp9_pix_fmts_highcol; | |
| 2097 | + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { | |
| 2098 | + vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); | |
| 2099 | + if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { | |
| 2100 | + *out = vp9_pix_fmts_highbd; | |
| 2101 | + *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highbd) - 1; | |
| 2102 | + } else { | |
| 2103 | + *out = vp9_pix_fmts_highcol; | |
| 2104 | + *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highcol) - 1; | |
| 2105 | + } | |
| 2106 | + return 0; | |
| 2107 | + } | |
| 2108 | + | |
| 2109 | + return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num); | |
| 2098 | 2110 | } |
| 2099 | 2111 | |
| 2100 | 2112 | static const AVClass class_vp9 = { |
| @@ -2124,6 +2136,6 @@ FFCodec ff_libvpx_vp9_encoder = { · 23 unmodified lines | ||
| 2124 | 2136 | FF_CODEC_CAP_INIT_CLEANUP | |
| 2125 | 2137 | FF_CODEC_CAP_AUTO_THREADS, |
| 2126 | 2138 | .defaults = defaults, |
| 2127 | − .init_static_data = vp9_init_static, | |
| 2139 | + .get_supported_config = vp9_get_supported_config, | |
| 2128 | 2140 | }; |
| 2129 | 2141 | #endif /* CONFIG_LIBVPX_VP9_ENCODER */ |