History

avcodec/libvpxenc: switch to get_supported_config()

Niklas Haas committed 2 years ago

Commit 0977d961 parent de421ca1 file · +19 −7Browse files

Unified · Split

libavcodec/libvpxenc.c+19−7
@@ -2088,13 +2088,25 @@ static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { · 2087 unmodified lines
20882088 AV_PIX_FMT_NONE
20892089 };
20902090
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)
20922096 {
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);
20982110 }
20992111
21002112 static const AVClass class_vp9 = {
@@ -2124,6 +2136,6 @@ FFCodec ff_libvpx_vp9_encoder = { · 23 unmodified lines
21242136 FF_CODEC_CAP_INIT_CLEANUP |
21252137 FF_CODEC_CAP_AUTO_THREADS,
21262138 .defaults = defaults,
2127− .init_static_data = vp9_init_static,
2139+ .get_supported_config = vp9_get_supported_config,
21282140 };
21292141 #endif /* CONFIG_LIBVPX_VP9_ENCODER */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t