History

avfilter/af_anlms: add support for commands

Paul B Mahol committed 7 years ago

Commit 6023b9f1 parent ffb32d32 files · +22 −1Browse files

Unified · Split

2 files
  1. doc/filters.texi +5 −1
  2. libavfilter/af_anlms.c +17 −0
doc/filters.texi+5−1
@@ -1870,12 +1870,16 @@ Default value is @var{o}. · 1869 unmodified lines
18701870 @itemize
18711871 @item
18721872 One of many usages of this filter is noise reduction, input audio is filtered
1873−with same samples that are delayed by fixed ammount, one such example for stereo audio is:
1873+with same samples that are delayed by fixed amount, one such example for stereo audio is:
18741874 @example
18751875 asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
18761876 @end example
18771877 @end itemize
18781878
1879+@subsection Commands
1880+
1881+This filter supports the same commands as options, excluding option @code{order}.
1882+
18791883 @section anull
18801884
18811885 Pass the audio source unchanged to the output.
libavfilter/af_anlms.c+17−0
@@ -281,6 +281,22 @@ static av_cold int init(AVFilterContext *ctx) · 280 unmodified lines
281281 return 0;
282282 }
283283
284+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
285+ char *res, int res_len, int flags)
286+{
287+ AudioNLMSContext *s = ctx->priv;
288+ int ret;
289+
290+ if ( !strcmp(cmd, "mu") || !strcmp(cmd, "eps")
291+ || !strcmp(cmd, "leakage") || !strcmp(cmd, "out_mode")) {
292+ ret = av_opt_set(s, cmd, args, 0);
293+ } else {
294+ ret = AVERROR(ENOSYS);
295+ }
296+
297+ return ret;
298+}
299+
284300 static av_cold void uninit(AVFilterContext *ctx)
285301 {
286302 AudioNLMSContext *s = ctx->priv;
@@ -325,4 +341,5 @@ AVFilter ff_af_anlms = { · 38 unmodified lines
325341 .inputs = inputs,
326342 .outputs = outputs,
327343 .flags = AVFILTER_FLAG_SLICE_THREADS,
344+ .process_command = process_command,
328345 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t