From aff855148a098c70c0a55c58aeb1205d839ed516 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 25 Sep 2021 23:38:26 +0200 Subject: avfilter/vf_swaprect: Use ff_formats_pixdesc_filter() Reviewed-by: Nicolas George Reviewed-by: Paul B Mahol Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_swaprect.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'libavfilter/vf_swaprect.c') 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); } -- cgit v1.2.3