[FFmpeg-cvslog] avfilter/vf_stack: use ff_formats_pixdesc_filter()

Paul B Mahol git at videolan.org
Sat Jan 16 22:37:37 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Jan 16 21:04:42 2021 +0100| [5b34fcaa8d12c5a5407b2154f8e743c71f9cdd57] | committer: Paul B Mahol

avfilter/vf_stack: use ff_formats_pixdesc_filter()

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

 libavfilter/vf_stack.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 35b7177e83..3d2b19a318 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -60,24 +60,21 @@ typedef struct StackContext {
 
 static int query_formats(AVFilterContext *ctx)
 {
-    AVFilterFormats *pix_fmts = NULL;
+    AVFilterFormats *formats = NULL;
     StackContext *s = ctx->priv;
-    int fmt, ret;
+    int ret;
 
     if (s->fillcolor_enable) {
         return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
     }
 
-    for (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 ||
-              desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
-            (ret = ff_add_format(&pix_fmts, fmt)) < 0)
-            return ret;
-    }
-
-    return ff_set_common_formats(ctx, pix_fmts);
+    ret = ff_formats_pixdesc_filter(&formats, 0,
+                                    AV_PIX_FMT_FLAG_HWACCEL |
+                                    AV_PIX_FMT_FLAG_BITSTREAM |
+                                    AV_PIX_FMT_FLAG_PAL);
+    if (ret < 0)
+        return ret;
+    return ff_set_common_formats(ctx, formats);
 }
 
 static av_cold int init(AVFilterContext *ctx)



More information about the ffmpeg-cvslog mailing list