FFmpeg
Data Structures | Macros | Functions | Variables
af_ladspa.c File Reference
#include <dlfcn.h>
#include <ladspa.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/fifo.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  MetaItem
 
struct  LADSPAContext
 

Macros

#define OFFSET(x)   offsetof(LADSPAContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (ladspa)
 
static int find_latency (AVFilterContext *ctx, LADSPAContext *s)
 
static void print_ctl_info (AVFilterContext *ctx, int level, LADSPAContext *s, int ctl, unsigned long *map, LADSPA_Data *values, int print)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 
static void set_default_ctl_value (LADSPAContext *s, int ctl, unsigned long *map, LADSPA_Data *values)
 
static int connect_ports (AVFilterContext *ctx, AVFilterLink *link)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static void count_ports (const LADSPA_Descriptor *desc, unsigned long *nb_inputs, unsigned long *nb_outputs)
 
static void * try_load (const char *dir, const char *soname)
 
static int set_control (AVFilterContext *ctx, unsigned long port, LADSPA_Data value)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 

Variables

static const AVOption ladspa_options []
 
static const AVFilterPad ladspa_outputs []
 
const AVFilter ff_af_ladspa
 

Detailed Description

LADSPA wrapper

Definition in file af_ladspa.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(LADSPAContext, x)

Definition at line 84 of file af_ladspa.c.

◆ FLAGS

Definition at line 85 of file af_ladspa.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( ladspa  )

◆ find_latency()

static int find_latency ( AVFilterContext ctx,
LADSPAContext s 
)
static

Definition at line 106 of file af_ladspa.c.

Referenced by filter_frame().

◆ print_ctl_info()

static void print_ctl_info ( AVFilterContext ctx,
int  level,
LADSPAContext s,
int  ctl,
unsigned long *  map,
LADSPA_Data *  values,
int  print 
)
static

Definition at line 121 of file af_ladspa.c.

Referenced by filter_frame(), init(), and request_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 173 of file af_ladspa.c.

Referenced by init(), and request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 267 of file af_ladspa.c.

◆ set_default_ctl_value()

static void set_default_ctl_value ( LADSPAContext s,
int  ctl,
unsigned long *  map,
LADSPA_Data *  values 
)
static

Definition at line 314 of file af_ladspa.c.

Referenced by init().

◆ connect_ports()

static int connect_ports ( AVFilterContext ctx,
AVFilterLink link 
)
static

Definition at line 351 of file af_ladspa.c.

Referenced by config_input(), and config_output().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 385 of file af_ladspa.c.

Referenced by init().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 392 of file af_ladspa.c.

◆ count_ports()

static void count_ports ( const LADSPA_Descriptor *  desc,
unsigned long *  nb_inputs,
unsigned long *  nb_outputs 
)
static

Definition at line 419 of file af_ladspa.c.

Referenced by init().

◆ try_load()

static void* try_load ( const char *  dir,
const char *  soname 
)
static

Definition at line 438 of file af_ladspa.c.

Referenced by init().

◆ set_control()

static int set_control ( AVFilterContext ctx,
unsigned long  port,
LADSPA_Data  value 
)
static

Definition at line 451 of file af_ladspa.c.

Referenced by init(), and process_command().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 485 of file af_ladspa.c.

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 697 of file af_ladspa.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 765 of file af_ladspa.c.

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 792 of file af_ladspa.c.

Variable Documentation

◆ ladspa_options

const AVOption ladspa_options[]
static
Initial value:
= {
{ "file", "set library name or full path", OFFSET(dl_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "f", "set library name or full path", OFFSET(dl_name), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "plugin", "set plugin name", OFFSET(plugin), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "p", "set plugin name", OFFSET(plugin), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "controls", "set plugin options", OFFSET(options), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "c", "set plugin options", OFFSET(options), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT32_MAX, FLAGS },
{ "s", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT32_MAX, FLAGS },
{ "nb_samples", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
{ "n", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
{ "duration", "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
{ "d", "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
{ "latency", "enable latency compensation", OFFSET(latency), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "l", "enable latency compensation", OFFSET(latency), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 86 of file af_ladspa.c.

◆ ladspa_outputs

const AVFilterPad ladspa_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
}

Definition at line 804 of file af_ladspa.c.

◆ ff_af_ladspa

const AVFilter ff_af_ladspa
Initial value:
= {
.name = "ladspa",
.description = NULL_IF_CONFIG_SMALL("Apply LADSPA effect."),
.priv_size = sizeof(LADSPAContext),
.priv_class = &ladspa_class,
.init = init,
.inputs = 0,
}

Definition at line 813 of file af_ladspa.c.

AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition: opt.h:319
LADSPAContext
Definition: af_ladspa.c:45
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_ladspa.c:392
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_ladspa.c:765
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_ladspa.c:792
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_ladspa.c:267
AVFILTER_FLAG_DYNAMIC_INPUTS
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:141
duration
int64_t duration
Definition: movenc.c:65
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_ladspa.c:84
options
Definition: swscale.c:42
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: af_ladspa.c:697
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
ladspa_outputs
static const AVFilterPad ladspa_outputs[]
Definition: af_ladspa.c:804
FLAGS
#define FLAGS
Definition: af_ladspa.c:85
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_ladspa.c:485