History

avfilter/af_lv2: add commands support

Paul B Mahol committed 4 years ago

Commit 5cd8eb21 parent 34715fe2 files · +25 −0Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/af_lv2.c +21 −0
doc/filters.texi+4−0
@@ -5433,6 +5433,10 @@ lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3 · 5432 unmodified lines
54335433 @end example
54345434 @end itemize
54355435
5436+@subsection Commands
5437+
5438+This filter supports all options that are exported by plugin as commands.
5439+
54365440 @section mcompand
54375441 Multiband Compress or expand the audio's dynamic range.
54385442
libavfilter/af_lv2.c+21−0
@@ -538,6 +538,26 @@ static int query_formats(AVFilterContext *ctx) · 537 unmodified lines
538538 return 0;
539539 }
540540
541+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
542+ char *res, int res_len, int flags)
543+{
544+ LV2Context *s = ctx->priv;
545+ const LilvPort *port;
546+ LilvNode *sym;
547+ int index;
548+
549+ sym = lilv_new_string(s->world, cmd);
550+ port = lilv_plugin_get_port_by_symbol(s->plugin, sym);
551+ lilv_node_free(sym);
552+ if (!port) {
553+ av_log(s, AV_LOG_WARNING, "Unknown option: <%s>\n", cmd);
554+ } else {
555+ index = lilv_port_get_index(s->plugin, port);
556+ s->controls[index] = atof(args);
557+ }
558+ return 0;
559+}
560+
541561 static av_cold void uninit(AVFilterContext *ctx)
542562 {
543563 LV2Context *s = ctx->priv;
@@ -578,6 +598,7 @@ const AVFilter ff_af_lv2 = { · 34 unmodified lines
578598 .priv_class = &lv2_class,
579599 .init = init,
580600 .uninit = uninit,
601+ .process_command = process_command,
581602 .inputs = 0,
582603 FILTER_OUTPUTS(lv2_outputs),
583604 FILTER_QUERY_FUNC(query_formats),

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