From 0a181c2cb1fe4038f900d3e1e7c8106e0326f784 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 30 Apr 2020 12:04:27 +0200 Subject: avfilter/af_crossfeed: make options runtime configurable --- doc/filters.texi | 4 ++++ libavfilter/af_crossfeed.c | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 8ff32f49bf..d19fd346ae 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -3278,6 +3278,10 @@ Set input gain. Default is 0.9. Set output gain. Default is 1. @end table +@subsection Commands + +This filter supports the all above options as @ref{commands}. + @section crystalizer Simple algorithm to expand audio dynamic range. diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c index cc2db70e62..70dd26eb28 100644 --- a/libavfilter/af_crossfeed.c +++ b/libavfilter/af_crossfeed.c @@ -134,8 +134,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return ff_filter_frame(outlink, out); } +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + int ret; + + ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); + if (ret < 0) + return ret; + + return config_input(ctx->inputs[0]); +} + #define OFFSET(x) offsetof(CrossfeedContext, x) -#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM static const AVOption crossfeed_options[] = { { "strength", "set crossfeed strength", OFFSET(strength), AV_OPT_TYPE_DOUBLE, {.dbl=.2}, 0, 1, FLAGS }, @@ -175,4 +187,5 @@ AVFilter ff_af_crossfeed = { .inputs = inputs, .outputs = outputs, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, + .process_command = process_command, }; -- cgit v1.2.3