[FFmpeg-cvslog] avfilter/vf_swaprect: Use ff_formats_pixdesc_filter()

Andreas Rheinhardt git at videolan.org
Sun Sep 26 13:51:28 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Sep 25 23:38:26 2021 +0200| [aff855148a098c70c0a55c58aeb1205d839ed516] | committer: Andreas Rheinhardt

avfilter/vf_swaprect: Use ff_formats_pixdesc_filter()

Reviewed-by: Nicolas George <george at nsup.org>
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavfilter/vf_swaprect.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c
index 4a5f4a12a6..fff9b53dc4 100644
--- a/libavfilter/vf_swaprect.c
+++ b/libavfilter/vf_swaprect.c
@@ -22,7 +22,6 @@
 #include "libavutil/eval.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
 
 #include "avfilter.h"
 #include "formats.h"
@@ -59,16 +58,13 @@ AVFILTER_DEFINE_CLASS(swaprect);
 static int query_formats(AVFilterContext *ctx)
 {
     AVFilterFormats *pix_fmts = NULL;
-    int fmt, ret;
-
-    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;
-    }
+    int ret;
+
+    ret = ff_formats_pixdesc_filter(&pix_fmts, 0, AV_PIX_FMT_FLAG_PAL     |
+                                                  AV_PIX_FMT_FLAG_HWACCEL |
+                                                  AV_PIX_FMT_FLAG_BITSTREAM);
+    if (ret < 0)
+        return ret;
 
     return ff_set_common_formats(ctx, pix_fmts);
 }



More information about the ffmpeg-cvslog mailing list