This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 0c7424e8179cb27fc13321f62ad18d17e3d5ce5a
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Fri Jan 30 17:01:30 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Tue Feb 10 19:44:43 2026 +0100

    avfilter/filters: Restrict ff_fmt_is_in() to enum AVPixelFormat
    
    Also rename it to ff_pixfmt_is_in(). This is more type-safe;
    in particular, it is required to support -fshort-enum.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/filters.h        | 9 ++++-----
 libavfilter/formats.c        | 8 +++-----
 libavfilter/vf_blackdetect.c | 2 +-
 libavfilter/vf_fade.c        | 2 +-
 libavfilter/vf_lut.c         | 4 ++--
 libavfilter/vf_overlay.c     | 4 ++--
 libavfilter/vf_tinterlace.c  | 4 ++--
 7 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index bc79527b87..a152be4d47 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -26,6 +26,7 @@
  */
 
 #include "avfilter.h"
+#include "libavutil/pixfmt.h"
 
 /**
  * Special return code when activate() did not do anything.
@@ -807,15 +808,13 @@ int ff_append_inpad_free_name (AVFilterContext *f, 
AVFilterPad *p);
 int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p);
 
 /**
- * Tell if an integer is contained in the provided -1-terminated list of 
integers.
- * This is useful for determining (for instance) if an AVPixelFormat is in an
- * array of supported formats.
+ * Tell if a pixel format is contained in the provided 
AV_PIX_FMT_NONE-terminated list.
  *
  * @param fmt provided format
- * @param fmts -1-terminated list of formats
+ * @param fmts AV_PIX_FMT_NONE-terminated list of pixel formats
  * @return 1 if present, 0 if absent
  */
-int ff_fmt_is_in(int fmt, const int *fmts);
+int ff_pixfmt_is_in(enum AVPixelFormat fmt, const enum AVPixelFormat *fmts);
 
 int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func,
                       void *arg, int *ret, int nb_jobs);
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 6fbdeb2d26..3315922cc7 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -468,12 +468,10 @@ const AVFilterNegotiation 
*ff_filter_get_negotiation(const AVFilterLink *link)
     }
 }
 
-int ff_fmt_is_in(int fmt, const int *fmts)
+int ff_pixfmt_is_in(enum AVPixelFormat fmt, const enum AVPixelFormat *fmts)
 {
-    const int *p;
-
-    for (p = fmts; *p != -1; p++) {
-        if (fmt == *p)
+    for (; *fmts != AV_PIX_FMT_NONE; ++fmts) {
+        if (fmt == *fmts)
             return 1;
     }
     return 0;
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index df11a2140e..d39b2df006 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -187,7 +187,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*picref)
     const int max = (1 << s->depth) - 1;
     const int factor = (1 << (s->depth - 8));
     const int full = picref->color_range == AVCOL_RANGE_JPEG ||
-                     ff_fmt_is_in(picref->format, yuvj_formats) ||
+                     ff_pixfmt_is_in(picref->format, yuvj_formats) ||
                      s->alpha;
 
     s->pixel_black_th_i = full ? s->pixel_black_th * max :
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index a9026992f1..efe0ea380d 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -447,7 +447,7 @@ static int config_input(AVFilterLink *inlink)
 
     /* use CCIR601/709 black level for studio-level pixel non-alpha components 
*/
     s->black_level =
-            ff_fmt_is_in(inlink->format, studio_level_pix_fmts) && !s->alpha ? 
16 * (1 << (s->depth - 8)): 0;
+            ff_pixfmt_is_in(inlink->format, studio_level_pix_fmts) && 
!s->alpha ? 16 * (1 << (s->depth - 8)): 0;
     /* 32768 = 1 << 15, it is an integer representation
      * of 0.5 and is for rounding. */
     s->black_level_scaled = (s->black_level << 16) + 32768;
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index ed00969e75..14c9964751 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -285,8 +285,8 @@ static int config_props(AVFilterLink *inlink)
 
     s->is_yuv = s->is_rgb = 0;
     s->is_planar = desc->flags & AV_PIX_FMT_FLAG_PLANAR;
-    if      (ff_fmt_is_in(inlink->format, yuv_pix_fmts)) s->is_yuv = 1;
-    else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) s->is_rgb = 1;
+    if      (ff_pixfmt_is_in(inlink->format, yuv_pix_fmts)) s->is_yuv = 1;
+    else if (ff_pixfmt_is_in(inlink->format, rgb_pix_fmts)) s->is_rgb = 1;
 
     if (s->is_rgb) {
         ff_fill_rgba_map(rgba_map, inlink->format);
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index cdd5448076..d627db0889 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -316,7 +316,7 @@ static int config_input_overlay(AVFilterLink *inlink)
 
     s->overlay_is_packed_rgb =
         ff_fill_rgba_map(s->overlay_rgba_map, inlink->format) >= 0;
-    s->overlay_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
+    s->overlay_has_alpha = ff_pixfmt_is_in(inlink->format, alpha_pix_fmts);
 
     if (s->eval_mode == EVAL_MODE_INIT) {
         eval_expr(ctx);
@@ -753,7 +753,7 @@ static int config_input_main(AVFilterLink *inlink)
 
     s->main_is_packed_rgb =
         ff_fill_rgba_map(s->main_rgba_map, inlink->format) >= 0;
-    s->main_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
+    s->main_has_alpha = ff_pixfmt_is_in(inlink->format, alpha_pix_fmts);
     return 0;
 }
 
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 59fe82abe3..2806e55752 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -235,7 +235,7 @@ static int config_out_props(AVFilterLink *outlink)
         }
         ff_draw_color(&tinterlace->draw, &tinterlace->color, black);
         /* limited range */
-        if (!ff_fmt_is_in(outlink->format, full_scale_yuvj_pix_fmts)) {
+        if (!ff_pixfmt_is_in(outlink->format, full_scale_yuvj_pix_fmts)) {
             ret = av_image_alloc(tinterlace->black_data[0], 
tinterlace->black_linesize,
                                  outlink->w, outlink->h, outlink->format, 16);
             if (ret < 0)
@@ -444,7 +444,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*picref)
         out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, 
av_make_q(2, 1));
 
         field = (1 + l->frame_count_in) & 1 ? FIELD_UPPER : FIELD_LOWER;
-        full = out->color_range == AVCOL_RANGE_JPEG || 
ff_fmt_is_in(out->format, full_scale_yuvj_pix_fmts);
+        full = out->color_range == AVCOL_RANGE_JPEG || 
ff_pixfmt_is_in(out->format, full_scale_yuvj_pix_fmts);
         /* copy upper and lower fields */
         copy_picture_field(tinterlace, out->data, out->linesize,
                            (const uint8_t **)cur->data, cur->linesize,

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to