From 99feb59cf7ea9d6753502d76110ced96f128dac6 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 26 Sep 2021 00:09:16 +0200 Subject: avfilter/formats: Make ff_formats_pixdesc_filter return AVFilterFormats* Up until now, it has returned the AVFilterFormats list via an AVFilterFormats** parameter; the actual return value was an int that was always AVERROR(ENOMEM) on error. The AVFilterFormats** argument was a pure output parameter which was only documented by naming the parameter rfmts. Yet nevertheless all callers initialized the underlying AVFilterFormats* to NULL. This commit changes this to return a pointer to AVFilterFormats directly. This is more in line with the API in general, as it allows to avoid checks for intermediate values. Reviewed-by: Nicolas George Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_swaprect.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'libavfilter/vf_swaprect.c') diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c index fff9b53dc4..e03603fe5a 100644 --- a/libavfilter/vf_swaprect.c +++ b/libavfilter/vf_swaprect.c @@ -57,16 +57,11 @@ AVFILTER_DEFINE_CLASS(swaprect); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *pix_fmts = NULL; - int ret; + int reject_flags = AV_PIX_FMT_FLAG_PAL | + AV_PIX_FMT_FLAG_HWACCEL | + AV_PIX_FMT_FLAG_BITSTREAM; - 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); + return ff_set_common_formats(ctx, ff_formats_pixdesc_filter(0, reject_flags)); } static const char *const var_names[] = { "w", "h", "a", "n", "t", "pos", "sar", "dar", NULL }; -- cgit v1.2.3