aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_agate.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/af_agate.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/af_agate.c')
-rw-r--r--libavfilter/af_agate.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c
index 3c858021d1..eb77dfbcc5 100644
--- a/libavfilter/af_agate.c
+++ b/libavfilter/af_agate.c
@@ -189,7 +189,6 @@ AVFILTER_DEFINE_CLASS(agate);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
- AVFilterChannelLayouts *layouts;
int ret;
if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0)
@@ -198,18 +197,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
- layouts = ff_all_channel_counts();
- if (!layouts)
- return AVERROR(ENOMEM);
- ret = ff_set_common_channel_layouts(ctx, layouts);
+ ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
- formats = ff_all_samplerates();
- if (!formats)
- return AVERROR(ENOMEM);
-
- return ff_set_common_samplerates(ctx, formats);
+ return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@@ -346,7 +338,6 @@ static int activate(AVFilterContext *ctx)
static int scquery_formats(AVFilterContext *ctx)
{
- AVFilterFormats *formats;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@@ -371,12 +362,10 @@ static int scquery_formats(AVFilterContext *ctx)
return ret;
}
- formats = ff_make_format_list(sample_fmts);
- if ((ret = ff_set_common_formats(ctx, formats)) < 0)
+ if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
- formats = ff_all_samplerates();
- return ff_set_common_samplerates(ctx, formats);
+ return ff_set_common_all_samplerates(ctx);
}
static int scconfig_output(AVFilterLink *outlink)