[FFmpeg-cvslog] avfilter/af_anlms: add support for commands
Paul B Mahol
git at videolan.org
Tue Oct 8 12:56:14 EEST 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 8 11:51:20 2019 +0200| [6023b9fbfef02b71f6acfb1b09e5a12fe9d276e2] | committer: Paul B Mahol
avfilter/af_anlms: add support for commands
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6023b9fbfef02b71f6acfb1b09e5a12fe9d276e2
---
doc/filters.texi | 6 +++++-
libavfilter/af_anlms.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 0e72cce829..c975777691 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1870,12 +1870,16 @@ Default value is @var{o}.
@itemize
@item
One of many usages of this filter is noise reduction, input audio is filtered
-with same samples that are delayed by fixed ammount, one such example for stereo audio is:
+with same samples that are delayed by fixed amount, one such example for stereo audio is:
@example
asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
@end example
@end itemize
+ at subsection Commands
+
+This filter supports the same commands as options, excluding option @code{order}.
+
@section anull
Pass the audio source unchanged to the output.
diff --git a/libavfilter/af_anlms.c b/libavfilter/af_anlms.c
index ee5cd759ca..75bd969a83 100644
--- a/libavfilter/af_anlms.c
+++ b/libavfilter/af_anlms.c
@@ -281,6 +281,22 @@ static av_cold int init(AVFilterContext *ctx)
return 0;
}
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+ char *res, int res_len, int flags)
+{
+ AudioNLMSContext *s = ctx->priv;
+ int ret;
+
+ if ( !strcmp(cmd, "mu") || !strcmp(cmd, "eps")
+ || !strcmp(cmd, "leakage") || !strcmp(cmd, "out_mode")) {
+ ret = av_opt_set(s, cmd, args, 0);
+ } else {
+ ret = AVERROR(ENOSYS);
+ }
+
+ return ret;
+}
+
static av_cold void uninit(AVFilterContext *ctx)
{
AudioNLMSContext *s = ctx->priv;
@@ -325,4 +341,5 @@ AVFilter ff_af_anlms = {
.inputs = inputs,
.outputs = outputs,
.flags = AVFILTER_FLAG_SLICE_THREADS,
+ .process_command = process_command,
};
More information about the ffmpeg-cvslog
mailing list