aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vsrc_testsrc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-10 01:25:31 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-13 17:36:22 +0200
commit18ec426a861c1a9a2072080796dff146bafecb53 (patch)
treed3d8b683db1ff9b6a46fd6e828e0f4c7c94ed1be /libavfilter/vsrc_testsrc.c
parent55d9d6767967794edcdd6e1bbd8840fc6f4e9315 (diff)
downloadffmpeg-18ec426a861c1a9a2072080796dff146bafecb53.tar.gz
avfilter/formats: Factor common function combinations out
Several combinations of functions happen quite often in query_format functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts)) is very common. This commit therefore adds functions that are equivalent to commonly used function combinations in order to reduce code duplication. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/vsrc_testsrc.c')
-rw-r--r--libavfilter/vsrc_testsrc.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 08686938db..56b46c6bd8 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -376,10 +376,7 @@ static int haldclutsrc_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE,
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int haldclutsrc_config_props(AVFilterLink *outlink)
@@ -659,10 +656,7 @@ static int test_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
@@ -1097,10 +1091,7 @@ static int rgbtest_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int rgbtest_config_props(AVFilterLink *outlink)
@@ -1274,10 +1265,7 @@ static int yuvtest_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int yuvtest_config_props(AVFilterLink *outlink)
@@ -1426,10 +1414,7 @@ static int smptebars_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE,
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static const AVFilterPad smptebars_outputs[] = {
@@ -1759,10 +1744,7 @@ static int allyuv_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = {
@@ -1836,10 +1818,7 @@ static int allrgb_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE
};
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = {