]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_weave: use ff_formats_pixdesc_filter()
authorPaul B Mahol <onemda@gmail.com>
Sat, 16 Jan 2021 20:18:07 +0000 (21:18 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 16 Jan 2021 20:35:44 +0000 (21:35 +0100)
libavfilter/vf_weave.c

index 8d4eb3d5a4a1316058638f2c5bce8dcaaa8796ec..92b3946795177d395c9e94e0ea69d54fc3e0cea8 100644 (file)
@@ -54,17 +54,11 @@ static int query_formats(AVFilterContext *ctx)
     AVFilterFormats *formats = NULL;
     int ret;
 
-    for (int fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) {
-        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
-
-        if (!(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
-            !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
-            if ((ret = ff_add_format(&formats, fmt)) < 0) {
-                return ret;
-            }
-        }
-    }
-
+    ret = ff_formats_pixdesc_filter(&formats, 0,
+                                    AV_PIX_FMT_FLAG_PAL |
+                                    AV_PIX_FMT_FLAG_HWACCEL);
+    if (ret < 0)
+        return ret;
     return ff_set_common_formats(ctx, formats);
 }