diff mbox series

[FFmpeg-devel,2/6] avcodec/mmaldec: Avoid using AVCodec.pix_fmts

Message ID AS8P250MB0744AD2E8C9ECA0E6F2FE70F8F472@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 687a287e140e87317986ad9445c3dfc2fcd0d342
Headers show
Series [FFmpeg-devel,1/6] avcodec: Remove redundant pix_fmts from decoders | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 5, 2024, 11:36 p.m. UTC
It is entirely unnecessary to use it given that all decoders
here share the same set of supported pixel formats. So just
hardcode this list.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mmaldec.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 2dc7bbee04..a8cda27570 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -101,6 +101,10 @@  typedef struct MMALDecodeContext {
 // packets (where each packet contains 1 frame).
 #define MAX_DELAYED_FRAMES 16
 
+static const enum AVPixelFormat mmal_pixfmts[] = {
+    AV_PIX_FMT_MMAL, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
+};
+
 static void ffmmal_poolref_unref(FFPoolRef *ref)
 {
     if (ref &&
@@ -367,7 +371,7 @@  static av_cold int ffmmal_init_decoder(AVCodecContext *avctx)
         return AVERROR(ENOSYS);
     }
 
-    if ((ret = ff_get_format(avctx, avctx->codec->pix_fmts)) < 0)
+    if ((ret = ff_get_format(avctx, mmal_pixfmts)) < 0)
         return ret;
 
     avctx->pix_fmt = ret;
@@ -844,9 +848,6 @@  static const AVClass ffmmal_dec_class = {
         .p.priv_class   = &ffmmal_dec_class, \
         .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \
         .caps_internal  = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
-        .p.pix_fmts     = (const enum AVPixelFormat[]) { AV_PIX_FMT_MMAL, \
-                                                         AV_PIX_FMT_YUV420P, \
-                                                         AV_PIX_FMT_NONE}, \
         .hw_configs     = mmal_hw_configs, \
         .p.wrapper_name = "mmal", \
     };