diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-06-03 14:14:37 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-06-03 14:20:19 +0200 |
commit | 97ddc5d1f741ed246fd81234a4ec3d3ef7038593 (patch) | |
tree | 1b6c1422c8e342cd1b3855049ccfa8c1f2a36e8d /libavfilter/af_anlmdn.c | |
parent | 0b7bfa8ad79e483fd81fc006b35c4ef86990d46f (diff) | |
download | ffmpeg-97ddc5d1f741ed246fd81234a4ec3d3ef7038593.tar.gz |
avfilter/af_anlmdn: add support for commands
Diffstat (limited to 'libavfilter/af_anlmdn.c')
-rw-r--r-- | libavfilter/af_anlmdn.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c index 93b76e0dff..b5bc94b4eb 100644 --- a/libavfilter/af_anlmdn.c +++ b/libavfilter/af_anlmdn.c @@ -22,6 +22,7 @@ #include "libavutil/avassert.h" #include "libavutil/audio_fifo.h" +#include "libavutil/avstring.h" #include "libavutil/opt.h" #include "avfilter.h" #include "audio.h" @@ -338,6 +339,29 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(&s->cache); } +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + AudioNLMeansContext *s = ctx->priv; + + if (!strcmp(cmd, "s")) { + float a; + + if (av_sscanf(args, "%f", &a) == 1) + s->a = av_clipf(a, 0.00001, 10); + } else if (!strcmp(cmd, "o")) { + if (!strcmp(args, "i")) { + s->om = IN_MODE; + } else if (!strcmp(args, "o")) { + s->om = OUT_MODE; + } else if (!strcmp(args, "n")) { + s->om = NOISE_MODE; + } + } + + return 0; +} + static const AVFilterPad inputs[] = { { .name = "default", @@ -366,6 +390,7 @@ AVFilter ff_af_anlmdn = { .uninit = uninit, .inputs = inputs, .outputs = outputs, + .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; |