summaryrefslogtreecommitdiff
path: root/libavfilter/af_aderivative.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-27 12:28:23 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-05 18:01:02 +0200
commit5f39512dee97d2e2c83aca6f41b1f395dcc45808 (patch)
treec112a253d24b0274d76b417ea180d977c6c9cfc6 /libavfilter/af_aderivative.c
parentb10b1947616ba65022416e617adf35aa2c901b39 (diff)
avfilter/af_aderivative: Use formats list instead of query function
In this case switching to .formats.samples even allows to avoid the runtime check for which filter is currently used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/af_aderivative.c')
-rw-r--r--libavfilter/af_aderivative.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/libavfilter/af_aderivative.c b/libavfilter/af_aderivative.c
index e37f978df6..baa272d609 100644
--- a/libavfilter/af_aderivative.c
+++ b/libavfilter/af_aderivative.c
@@ -27,29 +27,6 @@ typedef struct ADerivativeContext {
int nb_samples, int channels);
} ADerivativeContext;
-static int query_formats(AVFilterContext *ctx)
-{
- static const enum AVSampleFormat derivative_sample_fmts[] = {
- AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
- AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP,
- AV_SAMPLE_FMT_NONE
- };
- static const enum AVSampleFormat integral_sample_fmts[] = {
- AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
- AV_SAMPLE_FMT_NONE
- };
- int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ?
- derivative_sample_fmts : integral_sample_fmts);
- if (ret < 0)
- return ret;
-
- ret = ff_set_common_all_channel_counts(ctx);
- if (ret < 0)
- return ret;
-
- return ff_set_common_all_samplerates(ctx);
-}
-
#define DERIVATIVE(name, type) \
static void aderivative_## name ##p(void **d, void **p, const void **s, \
int nb_samples, int channels) \
@@ -179,7 +156,8 @@ const AVFilter ff_af_aderivative = {
.uninit = uninit,
FILTER_INPUTS(aderivative_inputs),
FILTER_OUTPUTS(aderivative_outputs),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP),
};
const AVFilter ff_af_aintegral = {
@@ -189,5 +167,5 @@ const AVFilter ff_af_aintegral = {
.uninit = uninit,
FILTER_INPUTS(aderivative_inputs),
FILTER_OUTPUTS(aderivative_outputs),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP),
};