avfilter/vf_swaprect: Use ff_formats_pixdesc_filter()

Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-09-25 23:38:26 +02:00
parent 7b5df3b545
commit aff855148a
1 changed files with 6 additions and 10 deletions

View File

@ -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;
int 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)
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);
}