• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017 Paul B Mahol
3  * Copyright (c) 2007-2016 David Robillard <http://drobilla.net>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * LV2 wrapper
25  */
26 
27 #include <lilv/lilv.h>
28 #include <lv2/lv2plug.in/ns/ext/atom/atom.h>
29 #include <lv2/lv2plug.in/ns/ext/buf-size/buf-size.h>
30 
31 #include "libavutil/avstring.h"
32 #include "libavutil/channel_layout.h"
33 #include "libavutil/opt.h"
34 #include "audio.h"
35 #include "avfilter.h"
36 #include "internal.h"
37 
38 typedef struct URITable {
39     char    **uris;
40     size_t    n_uris;
41 } URITable;
42 
43 typedef struct LV2Context {
44     const AVClass *class;
45     char *plugin_uri;
46     char *options;
47 
48     unsigned nb_inputs;
49     unsigned nb_inputcontrols;
50     unsigned nb_outputs;
51 
52     int sample_rate;
53     int nb_samples;
54     int64_t pts;
55     int64_t duration;
56 
57     LilvWorld         *world;
58     const LilvPlugin  *plugin;
59     uint32_t           nb_ports;
60     float             *values;
61     URITable           uri_table;
62     LV2_URID_Map       map;
63     LV2_Feature        map_feature;
64     LV2_URID_Unmap     unmap;
65     LV2_Feature        unmap_feature;
66     LV2_Atom_Sequence  seq_in[2];
67     LV2_Atom_Sequence *seq_out;
68     const LV2_Feature *features[5];
69 
70     float *mins;
71     float *maxes;
72     float *controls;
73 
74     LilvInstance *instance;
75 
76     LilvNode  *atom_AtomPort;
77     LilvNode  *atom_Sequence;
78     LilvNode  *lv2_AudioPort;
79     LilvNode  *lv2_CVPort;
80     LilvNode  *lv2_ControlPort;
81     LilvNode  *lv2_Optional;
82     LilvNode  *lv2_InputPort;
83     LilvNode  *lv2_OutputPort;
84     LilvNode  *urid_map;
85     LilvNode  *powerOf2BlockLength;
86     LilvNode  *fixedBlockLength;
87     LilvNode  *boundedBlockLength;
88 } LV2Context;
89 
90 #define OFFSET(x) offsetof(LV2Context, x)
91 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
92 
93 static const AVOption lv2_options[] = {
94     { "plugin", "set plugin uri", OFFSET(plugin_uri), AV_OPT_TYPE_STRING, .flags = FLAGS },
95     { "p",      "set plugin uri", OFFSET(plugin_uri), AV_OPT_TYPE_STRING, .flags = FLAGS },
96     { "controls", "set plugin options", OFFSET(options), AV_OPT_TYPE_STRING, .flags = FLAGS },
97     { "c",        "set plugin options", OFFSET(options), AV_OPT_TYPE_STRING, .flags = FLAGS },
98     { "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT32_MAX, FLAGS },
99     { "s",           "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT32_MAX, FLAGS },
100     { "nb_samples", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
101     { "n",          "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
102     { "duration", "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
103     { "d",        "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
104     { NULL }
105 };
106 
107 AVFILTER_DEFINE_CLASS(lv2);
108 
uri_table_init(URITable * table)109 static void uri_table_init(URITable *table)
110 {
111     table->uris   = NULL;
112     table->n_uris = 0;
113 }
114 
uri_table_destroy(URITable * table)115 static void uri_table_destroy(URITable *table)
116 {
117     int i;
118 
119     for (i = 0; i < table->n_uris; i++) {
120         av_freep(&table->uris[i]);
121     }
122 
123     av_freep(&table->uris);
124 }
125 
uri_table_map(LV2_URID_Map_Handle handle,const char * uri)126 static LV2_URID uri_table_map(LV2_URID_Map_Handle handle, const char *uri)
127 {
128     URITable *table = (URITable*)handle;
129     const size_t len = strlen(uri);
130     size_t i;
131     char **tmp;
132 
133     for (i = 0; i < table->n_uris; i++) {
134         if (!strcmp(table->uris[i], uri)) {
135             return i + 1;
136         }
137     }
138 
139     tmp = av_calloc(table->n_uris + 1, sizeof(char*));
140     if (!tmp)
141         return table->n_uris;
142     memcpy(tmp, table->uris, table->n_uris * sizeof(char**));
143 
144     av_free(table->uris);
145     table->uris = tmp;
146     table->uris[table->n_uris] = av_malloc(len + 1);
147     if (!table->uris[table->n_uris])
148         return table->n_uris;
149 
150     memcpy(table->uris[table->n_uris], uri, len + 1);
151     table->n_uris++;
152 
153     return table->n_uris;
154 }
155 
uri_table_unmap(LV2_URID_Map_Handle handle,LV2_URID urid)156 static const char *uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid)
157 {
158     URITable *table = (URITable*)handle;
159 
160     if (urid > 0 && urid <= table->n_uris) {
161         return table->uris[urid - 1];
162     }
163 
164     return NULL;
165 }
166 
connect_ports(LV2Context * s,AVFrame * in,AVFrame * out)167 static void connect_ports(LV2Context *s, AVFrame *in, AVFrame *out)
168 {
169     int ich = 0, och = 0, i;
170 
171     for (i = 0; i < s->nb_ports; i++) {
172         const LilvPort *port = lilv_plugin_get_port_by_index(s->plugin, i);
173 
174         if (lilv_port_is_a(s->plugin, port, s->lv2_AudioPort) ||
175             lilv_port_is_a(s->plugin, port, s->lv2_CVPort)) {
176             if (lilv_port_is_a(s->plugin, port, s->lv2_InputPort)) {
177                 lilv_instance_connect_port(s->instance, i, in->extended_data[ich++]);
178             } else if (lilv_port_is_a(s->plugin, port, s->lv2_OutputPort)) {
179                 lilv_instance_connect_port(s->instance, i, out->extended_data[och++]);
180             } else {
181                 av_log(s, AV_LOG_WARNING, "port %d neither input nor output, skipping\n", i);
182             }
183         } else if (lilv_port_is_a(s->plugin, port, s->atom_AtomPort)) {
184             if (lilv_port_is_a(s->plugin, port, s->lv2_InputPort)) {
185                 lilv_instance_connect_port(s->instance, i, &s->seq_in);
186             } else {
187                 lilv_instance_connect_port(s->instance, i, s->seq_out);
188             }
189         } else if (lilv_port_is_a(s->plugin, port, s->lv2_ControlPort)) {
190             lilv_instance_connect_port(s->instance, i, &s->controls[i]);
191         }
192     }
193 
194     s->seq_in[0].atom.size = sizeof(LV2_Atom_Sequence_Body);
195     s->seq_in[0].atom.type = uri_table_map(&s->uri_table, LV2_ATOM__Sequence);
196     s->seq_out->atom.size  = 9624;
197     s->seq_out->atom.type  = uri_table_map(&s->uri_table, LV2_ATOM__Chunk);
198 }
199 
filter_frame(AVFilterLink * inlink,AVFrame * in)200 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
201 {
202     AVFilterContext *ctx = inlink->dst;
203     LV2Context *s = ctx->priv;
204     AVFrame *out;
205 
206     if (!s->nb_outputs ||
207         (av_frame_is_writable(in) && s->nb_inputs == s->nb_outputs)) {
208         out = in;
209     } else {
210         out = ff_get_audio_buffer(ctx->outputs[0], in->nb_samples);
211         if (!out) {
212             av_frame_free(&in);
213             return AVERROR(ENOMEM);
214         }
215         av_frame_copy_props(out, in);
216     }
217 
218     connect_ports(s, in, out);
219 
220     lilv_instance_run(s->instance, in->nb_samples);
221 
222     if (out != in)
223         av_frame_free(&in);
224 
225     return ff_filter_frame(ctx->outputs[0], out);
226 }
227 
request_frame(AVFilterLink * outlink)228 static int request_frame(AVFilterLink *outlink)
229 {
230     AVFilterContext *ctx = outlink->src;
231     LV2Context *s = ctx->priv;
232     AVFrame *out;
233     int64_t t;
234 
235     if (ctx->nb_inputs)
236         return ff_request_frame(ctx->inputs[0]);
237 
238     t = av_rescale(s->pts, AV_TIME_BASE, s->sample_rate);
239     if (s->duration >= 0 && t >= s->duration)
240         return AVERROR_EOF;
241 
242     out = ff_get_audio_buffer(outlink, s->nb_samples);
243     if (!out)
244         return AVERROR(ENOMEM);
245 
246     connect_ports(s, out, out);
247 
248     lilv_instance_run(s->instance, out->nb_samples);
249 
250     out->sample_rate = s->sample_rate;
251     out->pts         = s->pts;
252     s->pts          += s->nb_samples;
253 
254     return ff_filter_frame(outlink, out);
255 }
256 
257 static const LV2_Feature buf_size_features[3] = {
258     { LV2_BUF_SIZE__powerOf2BlockLength, NULL },
259     { LV2_BUF_SIZE__fixedBlockLength,    NULL },
260     { LV2_BUF_SIZE__boundedBlockLength,  NULL },
261 };
262 
config_output(AVFilterLink * outlink)263 static int config_output(AVFilterLink *outlink)
264 {
265     AVFilterContext *ctx = outlink->src;
266     LV2Context *s = ctx->priv;
267     char *p, *arg, *saveptr = NULL;
268     int i, sample_rate;
269 
270     uri_table_init(&s->uri_table);
271     s->map.handle = &s->uri_table;
272     s->map.map = uri_table_map;
273     s->map_feature.URI = LV2_URID_MAP_URI;
274     s->map_feature.data = &s->map;
275     s->unmap.handle = &s->uri_table;
276     s->unmap.unmap  = uri_table_unmap;
277     s->unmap_feature.URI = LV2_URID_UNMAP_URI;
278     s->unmap_feature.data = &s->unmap;
279     s->features[0] = &s->map_feature;
280     s->features[1] = &s->unmap_feature;
281     s->features[2] = &buf_size_features[0];
282     s->features[3] = &buf_size_features[1];
283     s->features[4] = &buf_size_features[2];
284 
285     if (ctx->nb_inputs) {
286         AVFilterLink *inlink = ctx->inputs[0];
287 
288         outlink->format      = inlink->format;
289         outlink->sample_rate = sample_rate = inlink->sample_rate;
290         if (s->nb_inputs == s->nb_outputs) {
291             int ret;
292             if ((ret = av_channel_layout_copy(&outlink->ch_layout, &inlink->ch_layout)) < 0)
293                 return ret;
294 #if FF_API_OLD_CHANNEL_LAYOUT
295 FF_DISABLE_DEPRECATION_WARNINGS
296             outlink->channel_layout = inlink->channel_layout;
297 FF_ENABLE_DEPRECATION_WARNINGS
298 #endif
299         }
300 
301     } else {
302         outlink->sample_rate = sample_rate = s->sample_rate;
303         outlink->time_base   = (AVRational){1, s->sample_rate};
304     }
305 
306     s->instance = lilv_plugin_instantiate(s->plugin, sample_rate, s->features);
307     if (!s->instance) {
308         av_log(s, AV_LOG_ERROR, "Failed to instantiate <%s>\n", lilv_node_as_uri(lilv_plugin_get_uri(s->plugin)));
309         return AVERROR(EINVAL);
310     }
311 
312     s->mins     = av_calloc(s->nb_ports, sizeof(float));
313     s->maxes    = av_calloc(s->nb_ports, sizeof(float));
314     s->controls = av_calloc(s->nb_ports, sizeof(float));
315 
316     if (!s->mins || !s->maxes || !s->controls)
317         return AVERROR(ENOMEM);
318 
319     lilv_plugin_get_port_ranges_float(s->plugin, s->mins, s->maxes, s->controls);
320     s->seq_out = av_malloc(sizeof(LV2_Atom_Sequence) + 9624);
321     if (!s->seq_out)
322         return AVERROR(ENOMEM);
323 
324     if (s->options && !strcmp(s->options, "help")) {
325         if (!s->nb_inputcontrols) {
326             av_log(ctx, AV_LOG_INFO,
327                    "The '%s' plugin does not have any input controls.\n",
328                    s->plugin_uri);
329         } else {
330             av_log(ctx, AV_LOG_INFO,
331                    "The '%s' plugin has the following input controls:\n",
332                    s->plugin_uri);
333             for (i = 0; i < s->nb_ports; i++) {
334                 const LilvPort *port = lilv_plugin_get_port_by_index(s->plugin, i);
335                 const LilvNode *symbol = lilv_port_get_symbol(s->plugin, port);
336                 LilvNode *name = lilv_port_get_name(s->plugin, port);
337 
338                 if (lilv_port_is_a(s->plugin, port, s->lv2_InputPort) &&
339                     lilv_port_is_a(s->plugin, port, s->lv2_ControlPort)) {
340                     av_log(ctx, AV_LOG_INFO, "%s\t\t<float> (from %f to %f) (default %f)\t\t%s\n",
341                            lilv_node_as_string(symbol), s->mins[i], s->maxes[i], s->controls[i],
342                            lilv_node_as_string(name));
343                 }
344 
345                 lilv_node_free(name);
346             }
347         }
348         return AVERROR_EXIT;
349     }
350 
351     p = s->options;
352     while (s->options) {
353         const LilvPort *port;
354         LilvNode *sym;
355         float val;
356         char *str, *vstr;
357         int index;
358 
359         if (!(arg = av_strtok(p, " |", &saveptr)))
360             break;
361         p = NULL;
362 
363         vstr = strstr(arg, "=");
364         if (vstr == NULL) {
365             av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");
366             return AVERROR(EINVAL);
367         }
368 
369         vstr[0] = 0;
370         str  = arg;
371         val  = atof(vstr+1);
372         sym  = lilv_new_string(s->world, str);
373         port = lilv_plugin_get_port_by_symbol(s->plugin, sym);
374         lilv_node_free(sym);
375         if (!port) {
376             av_log(s, AV_LOG_WARNING, "Unknown option: <%s>\n", str);
377         } else {
378             index = lilv_port_get_index(s->plugin, port);
379             s->controls[index] = val;
380         }
381     }
382 
383     if (s->nb_inputs &&
384         (lilv_plugin_has_feature(s->plugin, s->powerOf2BlockLength) ||
385          lilv_plugin_has_feature(s->plugin, s->fixedBlockLength) ||
386          lilv_plugin_has_feature(s->plugin, s->boundedBlockLength))) {
387         AVFilterLink *inlink = ctx->inputs[0];
388 
389         inlink->min_samples = inlink->max_samples = 4096;
390     }
391 
392     return 0;
393 }
394 
init(AVFilterContext * ctx)395 static av_cold int init(AVFilterContext *ctx)
396 {
397     LV2Context *s = ctx->priv;
398     const LilvPlugins *plugins;
399     const LilvPlugin *plugin;
400     AVFilterPad pad = { NULL };
401     LilvNode *uri;
402     int i, ret;
403 
404     s->world = lilv_world_new();
405     if (!s->world)
406         return AVERROR(ENOMEM);
407 
408     uri = lilv_new_uri(s->world, s->plugin_uri);
409     if (!uri) {
410         av_log(s, AV_LOG_ERROR, "Invalid plugin URI <%s>\n", s->plugin_uri);
411         return AVERROR(EINVAL);
412     }
413 
414     lilv_world_load_all(s->world);
415     plugins = lilv_world_get_all_plugins(s->world);
416     plugin  = lilv_plugins_get_by_uri(plugins, uri);
417     lilv_node_free(uri);
418 
419     if (!plugin) {
420         av_log(s, AV_LOG_ERROR, "Plugin <%s> not found\n", s->plugin_uri);
421         return AVERROR(EINVAL);
422     }
423 
424     s->plugin = plugin;
425     s->nb_ports = lilv_plugin_get_num_ports(s->plugin);
426 
427     s->lv2_InputPort       = lilv_new_uri(s->world, LV2_CORE__InputPort);
428     s->lv2_OutputPort      = lilv_new_uri(s->world, LV2_CORE__OutputPort);
429     s->lv2_AudioPort       = lilv_new_uri(s->world, LV2_CORE__AudioPort);
430     s->lv2_ControlPort     = lilv_new_uri(s->world, LV2_CORE__ControlPort);
431     s->lv2_Optional        = lilv_new_uri(s->world, LV2_CORE__connectionOptional);
432     s->atom_AtomPort       = lilv_new_uri(s->world, LV2_ATOM__AtomPort);
433     s->atom_Sequence       = lilv_new_uri(s->world, LV2_ATOM__Sequence);
434     s->urid_map            = lilv_new_uri(s->world, LV2_URID__map);
435     s->powerOf2BlockLength = lilv_new_uri(s->world, LV2_BUF_SIZE__powerOf2BlockLength);
436     s->fixedBlockLength    = lilv_new_uri(s->world, LV2_BUF_SIZE__fixedBlockLength);
437     s->boundedBlockLength  = lilv_new_uri(s->world, LV2_BUF_SIZE__boundedBlockLength);
438 
439     for (i = 0; i < s->nb_ports; i++) {
440         const LilvPort *lport = lilv_plugin_get_port_by_index(s->plugin, i);
441         int is_input = 0;
442         int is_optional = 0;
443 
444         is_optional = lilv_port_has_property(s->plugin, lport, s->lv2_Optional);
445 
446         if (lilv_port_is_a(s->plugin, lport, s->lv2_InputPort)) {
447             is_input = 1;
448         } else if (!lilv_port_is_a(s->plugin, lport, s->lv2_OutputPort) && !is_optional) {
449             return AVERROR(EINVAL);
450         }
451 
452         if (lilv_port_is_a(s->plugin, lport, s->lv2_ControlPort)) {
453             if (is_input) {
454                 s->nb_inputcontrols++;
455             }
456         } else if (lilv_port_is_a(s->plugin, lport, s->lv2_AudioPort)) {
457             if (is_input) {
458                 s->nb_inputs++;
459             } else {
460                 s->nb_outputs++;
461             }
462         }
463     }
464 
465     pad.type = AVMEDIA_TYPE_AUDIO;
466 
467     if (s->nb_inputs) {
468         pad.name = av_asprintf("in0:%s:%u", s->plugin_uri, s->nb_inputs);
469         if (!pad.name)
470             return AVERROR(ENOMEM);
471 
472         pad.filter_frame = filter_frame;
473         if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0)
474             return ret;
475     }
476 
477     return 0;
478 }
479 
query_formats(AVFilterContext * ctx)480 static int query_formats(AVFilterContext *ctx)
481 {
482     LV2Context *s = ctx->priv;
483     AVFilterChannelLayouts *layouts;
484     AVFilterLink *outlink = ctx->outputs[0];
485     static const enum AVSampleFormat sample_fmts[] = {
486         AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
487     int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
488     if (ret < 0)
489         return ret;
490 
491     if (s->nb_inputs) {
492         ret = ff_set_common_all_samplerates(ctx);
493         if (ret < 0)
494             return ret;
495     } else {
496         int sample_rates[] = { s->sample_rate, -1 };
497 
498         ret = ff_set_common_samplerates_from_list(ctx, sample_rates);
499         if (ret < 0)
500             return ret;
501     }
502 
503     if (s->nb_inputs == 2 && s->nb_outputs == 2) {
504         layouts = NULL;
505         ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
506         if (ret < 0)
507             return ret;
508         ret = ff_set_common_channel_layouts(ctx, layouts);
509         if (ret < 0)
510             return ret;
511     } else {
512         if (s->nb_inputs >= 1) {
513             AVFilterLink *inlink = ctx->inputs[0];
514             AVChannelLayout inlayout = FF_COUNT2LAYOUT(s->nb_inputs);
515 
516             layouts = NULL;
517             ret = ff_add_channel_layout(&layouts, &inlayout);
518             if (ret < 0)
519                 return ret;
520             ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts);
521             if (ret < 0)
522                 return ret;
523 
524             if (!s->nb_outputs) {
525                 ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts);
526                 if (ret < 0)
527                     return ret;
528             }
529         }
530 
531         if (s->nb_outputs >= 1) {
532             AVChannelLayout outlayout = FF_COUNT2LAYOUT(s->nb_outputs);
533 
534             layouts = NULL;
535             ret = ff_add_channel_layout(&layouts, &outlayout);
536             if (ret < 0)
537                 return ret;
538             ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts);
539             if (ret < 0)
540                 return ret;
541         }
542     }
543 
544     return 0;
545 }
546 
process_command(AVFilterContext * ctx,const char * cmd,const char * args,char * res,int res_len,int flags)547 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
548                            char *res, int res_len, int flags)
549 {
550     LV2Context *s = ctx->priv;
551     const LilvPort *port;
552     LilvNode *sym;
553     int index;
554 
555     sym  = lilv_new_string(s->world, cmd);
556     port = lilv_plugin_get_port_by_symbol(s->plugin, sym);
557     lilv_node_free(sym);
558     if (!port) {
559         av_log(s, AV_LOG_WARNING, "Unknown option: <%s>\n", cmd);
560     } else {
561         index = lilv_port_get_index(s->plugin, port);
562         s->controls[index] = atof(args);
563     }
564     return 0;
565 }
566 
uninit(AVFilterContext * ctx)567 static av_cold void uninit(AVFilterContext *ctx)
568 {
569     LV2Context *s = ctx->priv;
570 
571     lilv_node_free(s->powerOf2BlockLength);
572     lilv_node_free(s->fixedBlockLength);
573     lilv_node_free(s->boundedBlockLength);
574     lilv_node_free(s->urid_map);
575     lilv_node_free(s->atom_Sequence);
576     lilv_node_free(s->atom_AtomPort);
577     lilv_node_free(s->lv2_Optional);
578     lilv_node_free(s->lv2_ControlPort);
579     lilv_node_free(s->lv2_AudioPort);
580     lilv_node_free(s->lv2_OutputPort);
581     lilv_node_free(s->lv2_InputPort);
582     uri_table_destroy(&s->uri_table);
583     lilv_instance_free(s->instance);
584     lilv_world_free(s->world);
585     av_freep(&s->mins);
586     av_freep(&s->maxes);
587     av_freep(&s->controls);
588     av_freep(&s->seq_out);
589 }
590 
591 static const AVFilterPad lv2_outputs[] = {
592     {
593         .name          = "default",
594         .type          = AVMEDIA_TYPE_AUDIO,
595         .config_props  = config_output,
596         .request_frame = request_frame,
597     },
598 };
599 
600 const AVFilter ff_af_lv2 = {
601     .name          = "lv2",
602     .description   = NULL_IF_CONFIG_SMALL("Apply LV2 effect."),
603     .priv_size     = sizeof(LV2Context),
604     .priv_class    = &lv2_class,
605     .init          = init,
606     .uninit        = uninit,
607     .process_command = process_command,
608     .inputs        = 0,
609     FILTER_OUTPUTS(lv2_outputs),
610     FILTER_QUERY_FUNC(query_formats),
611     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS,
612 };
613