57 const LADSPA_Descriptor *
desc;
68 #define OFFSET(x) offsetof(LADSPAContext, x)
69 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
79 {
"nb_samples",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX,
FLAGS },
90 LADSPA_Data *values,
int print)
92 const LADSPA_PortRangeHint *h = s->
desc->PortRangeHints + map[ctl];
94 av_log(ctx, level,
"c%i: %s [", ctl, s->
desc->PortNames[map[ctl]]);
96 if (LADSPA_IS_HINT_TOGGLED(h->HintDescriptor)) {
97 av_log(ctx, level,
"toggled (1 or 0)");
99 if (LADSPA_IS_HINT_HAS_DEFAULT(h->HintDescriptor))
100 av_log(ctx, level,
" (default %i)", (
int)values[ctl]);
102 if (LADSPA_IS_HINT_INTEGER(h->HintDescriptor)) {
103 av_log(ctx, level,
"<int>");
105 if (LADSPA_IS_HINT_BOUNDED_BELOW(h->HintDescriptor))
106 av_log(ctx, level,
", min: %i", (
int)h->LowerBound);
108 if (LADSPA_IS_HINT_BOUNDED_ABOVE(h->HintDescriptor))
109 av_log(ctx, level,
", max: %i", (
int)h->UpperBound);
112 av_log(ctx, level,
" (value %d)", (
int)values[ctl]);
113 else if (LADSPA_IS_HINT_HAS_DEFAULT(h->HintDescriptor))
114 av_log(ctx, level,
" (default %d)", (
int)values[ctl]);
116 av_log(ctx, level,
"<float>");
118 if (LADSPA_IS_HINT_BOUNDED_BELOW(h->HintDescriptor))
119 av_log(ctx, level,
", min: %f", h->LowerBound);
121 if (LADSPA_IS_HINT_BOUNDED_ABOVE(h->HintDescriptor))
122 av_log(ctx, level,
", max: %f", h->UpperBound);
125 av_log(ctx, level,
" (value %f)", values[ctl]);
126 else if (LADSPA_IS_HINT_HAS_DEFAULT(h->HintDescriptor))
127 av_log(ctx, level,
" (default %f)", values[ctl]);
130 if (LADSPA_IS_HINT_SAMPLE_RATE(h->HintDescriptor))
131 av_log(ctx, level,
", multiple of sample rate");
133 if (LADSPA_IS_HINT_LOGARITHMIC(h->HintDescriptor))
134 av_log(ctx, level,
", logarithmic scale");
137 av_log(ctx, level,
"]\n");
149 !(s->
desc->Properties & LADSPA_PROPERTY_INPLACE_BROKEN))) {
219 unsigned long *map, LADSPA_Data *values)
221 const LADSPA_PortRangeHint *h = s->
desc->PortRangeHints + map[ctl];
222 const LADSPA_Data lower = h->LowerBound;
223 const LADSPA_Data upper = h->UpperBound;
225 if (LADSPA_IS_HINT_DEFAULT_MINIMUM(h->HintDescriptor)) {
227 }
else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(h->HintDescriptor)) {
229 }
else if (LADSPA_IS_HINT_DEFAULT_0(h->HintDescriptor)) {
231 }
else if (LADSPA_IS_HINT_DEFAULT_1(h->HintDescriptor)) {
233 }
else if (LADSPA_IS_HINT_DEFAULT_100(h->HintDescriptor)) {
235 }
else if (LADSPA_IS_HINT_DEFAULT_440(h->HintDescriptor)) {
237 }
else if (LADSPA_IS_HINT_DEFAULT_LOW(h->HintDescriptor)) {
238 if (LADSPA_IS_HINT_LOGARITHMIC(h->HintDescriptor))
239 values[ctl] = exp(log(lower) * 0.75 + log(upper) * 0.25);
241 values[ctl] = lower * 0.75 + upper * 0.25;
242 }
else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(h->HintDescriptor)) {
243 if (LADSPA_IS_HINT_LOGARITHMIC(h->HintDescriptor))
244 values[ctl] = exp(log(lower) * 0.5 + log(upper) * 0.5);
246 values[ctl] = lower * 0.5 + upper * 0.5;
247 }
else if (LADSPA_IS_HINT_DEFAULT_HIGH(h->HintDescriptor)) {
248 if (LADSPA_IS_HINT_LOGARITHMIC(h->HintDescriptor))
249 values[ctl] = exp(log(lower) * 0.25 + log(upper) * 0.75);
251 values[ctl] = lower * 0.25 + upper * 0.75;
280 if (s->
desc->activate)
321 unsigned long *nb_inputs,
unsigned long *nb_outputs)
323 LADSPA_PortDescriptor pd;
326 for (i = 0; i < desc->PortCount; i++) {
327 pd = desc->PortDescriptors[i];
329 if (LADSPA_IS_PORT_AUDIO(pd)) {
330 if (LADSPA_IS_PORT_INPUT(pd)) {
332 }
else if (LADSPA_IS_PORT_OUTPUT(pd)) {
339 static void *
try_load(
const char *dir,
const char *soname)
345 ret = dlopen(path, RTLD_LOCAL|RTLD_NOW);
355 const char *label = s->
desc->Label;
356 LADSPA_PortRangeHint *h = (LADSPA_PortRangeHint *)s->
desc->PortRangeHints +
365 if (LADSPA_IS_HINT_BOUNDED_BELOW(h->HintDescriptor) &&
366 value < h->LowerBound) {
368 "%s: input control c%ld is below lower boundary of %0.4f.\n",
369 label, port, h->LowerBound);
373 if (LADSPA_IS_HINT_BOUNDED_ABOVE(h->HintDescriptor) &&
374 value > h->UpperBound) {
376 "%s: input control c%ld is above upper boundary of %0.4f.\n",
377 label, port, h->UpperBound);
389 LADSPA_Descriptor_Function descriptor_fn;
390 const LADSPA_Descriptor *desc;
391 LADSPA_PortDescriptor pd;
393 char *p, *
arg, *saveptr = NULL;
394 unsigned long nb_ports;
407 char *paths =
av_strdup(getenv(
"LADSPA_PATH"));
408 const char *separator =
":";
435 descriptor_fn = dlsym(s->
dl_handle,
"ladspa_descriptor");
436 if (!descriptor_fn) {
448 for (i = 0; desc = descriptor_fn(i); i++) {
460 desc = descriptor_fn(i);
466 if (desc->Label && !strcmp(desc->Label, s->
plugin))
472 nb_ports = desc->PortCount;
485 for (i = 0; i < nb_ports; i++) {
486 pd = desc->PortDescriptors[i];
488 if (LADSPA_IS_PORT_AUDIO(pd)) {
489 if (LADSPA_IS_PORT_INPUT(pd)) {
492 }
else if (LADSPA_IS_PORT_OUTPUT(pd)) {
496 }
else if (LADSPA_IS_PORT_CONTROL(pd)) {
497 if (LADSPA_IS_PORT_INPUT(pd)) {
500 if (LADSPA_IS_HINT_HAS_DEFAULT(desc->PortRangeHints[i].HintDescriptor))
506 }
else if (LADSPA_IS_PORT_OUTPUT(pd)) {
517 "The '%s' plugin does not have any input controls.\n",
521 "The '%s' plugin has the following input controls:\n",
535 if (!(arg =
av_strtok(p,
"|", &saveptr)))
539 if (sscanf(arg,
"c%d=%f", &i, &val) != 2) {
647 if (s->
desc->deactivate)
649 if (s->
desc->cleanup)
675 if (sscanf(cmd,
"c%ld", &port) + sscanf(args,
"%f", &value) != 2)
695 .priv_class = &ladspa_class,