Commit 110a2f44 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_ladspa: allow changing controls dynamically

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 4d86a945
...@@ -1502,6 +1502,16 @@ ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2 ...@@ -1502,6 +1502,16 @@ ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
@end example @end example
@end itemize @end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item cN
Modify the @var{N}-th control value.
If the specified value is not valid, it is ignored and prior one is kept.
@end table
@section lowpass @section lowpass
Apply a low-pass filter with 3dB point frequency. Apply a low-pass filter with 3dB point frequency.
......
...@@ -662,6 +662,18 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -662,6 +662,18 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&ctx->input_pads[0].name); 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[] = { static const AVFilterPad ladspa_outputs[] = {
{ {
.name = "default", .name = "default",
...@@ -680,6 +692,7 @@ AVFilter avfilter_af_ladspa = { ...@@ -680,6 +692,7 @@ AVFilter avfilter_af_ladspa = {
.init = init, .init = init,
.uninit = uninit, .uninit = uninit,
.query_formats = query_formats, .query_formats = query_formats,
.process_command = process_command,
.inputs = 0, .inputs = 0,
.outputs = ladspa_outputs, .outputs = ladspa_outputs,
.flags = AVFILTER_FLAG_DYNAMIC_INPUTS, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment