ffmpeg | branch: master | Niklas Haas <g...@haasn.dev> | Fri Apr  5 20:03:15 
2024 +0200| [0977d968e46def74141cc474aebee6e47adfa7d0] | committer: Niklas Haas

avcodec/libvpxenc: switch to get_supported_config()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0977d968e46def74141cc474aebee6e47adfa7d0
---

 libavcodec/libvpxenc.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 1d5e9c33e8..228ede7c84 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -2088,13 +2088,25 @@ 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,
+                                    int *out_num)
 {
-    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;
+            *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highbd) - 1;
+        } else {
+            *out = vp9_pix_fmts_highcol;
+            *out_num = FF_ARRAY_ELEMS(vp9_pix_fmts_highcol) - 1;
+        }
+        return 0;
+    }
+
+    return ff_default_get_supported_config(avctx, codec, config, flags, out, 
out_num);
 }
 
 static const AVClass class_vp9 = {
@@ -2124,6 +2136,6 @@ FFCodec ff_libvpx_vp9_encoder = {
                       FF_CODEC_CAP_INIT_CLEANUP |
                       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 */

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to