[FFmpeg-cvslog] avfilter/af_ladspa: allow changing controls dynamically
Paul B Mahol
git at videolan.org
Fri Sep 27 15:05:20 CEST 2013
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Sep 24 16:20:53 2013 +0000| [110a2f446d54541d4e419cf20494223dd6a1a1f9] | committer: Paul B Mahol
avfilter/af_ladspa: allow changing controls dynamically
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=110a2f446d54541d4e419cf20494223dd6a1a1f9
---
doc/filters.texi | 10 ++++++++++
libavfilter/af_ladspa.c | 13 +++++++++++++
2 files changed, 23 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index 800a666..7708fe3 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1502,6 +1502,16 @@ ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
@end example
@end itemize
+ at subsection Commands
+
+This filter supports the following commands:
+ at table @option
+ at item cN
+Modify the @var{N}-th control value.
+
+If the specified value is not valid, it is ignored and prior one is kept.
+ at end table
+
@section lowpass
Apply a low-pass filter with 3dB point frequency.
diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index 45f17ff..3ceb91e 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -662,6 +662,18 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&ctx->input_pads[0].name);
}
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+ char *res, int res_len, int flags)
+{
+ LADSPA_Data value;
+ unsigned long port;
+
+ if (sscanf(cmd, "c%ld", &port) + sscanf(args, "%f", &value) != 2)
+ return AVERROR(EINVAL);
+
+ return set_control(ctx, port, value);
+}
+
static const AVFilterPad ladspa_outputs[] = {
{
.name = "default",
@@ -680,6 +692,7 @@ AVFilter avfilter_af_ladspa = {
.init = init,
.uninit = uninit,
.query_formats = query_formats,
+ .process_command = process_command,
.inputs = 0,
.outputs = ladspa_outputs,
.flags = AVFILTER_FLAG_DYNAMIC_INPUTS,
More information about the ffmpeg-cvslog
mailing list