FFmpeg  4.0
Data Structures | Macros | Enumerations | Functions | Variables
af_apulsator.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
#include "audio.h"

Go to the source code of this file.

Data Structures

struct  SimpleLFO
 
struct  AudioPulsatorContext
 

Macros

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

Enumerations

enum  PulsatorModes {
  SINE, TRIANGLE, SQUARE, SAWUP,
  SAWDOWN, NB_MODES
}
 
enum  PulsatorTimings { UNIT_BPM, UNIT_MS, UNIT_HZ, NB_TIMINGS }
 

Functions

 AVFILTER_DEFINE_CLASS (apulsator)
 
static void lfo_advance (SimpleLFO *lfo, unsigned count)
 
static double lfo_get_value (SimpleLFO *lfo)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 

Variables

static const AVOption apulsator_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_af_apulsator
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 57 of file af_apulsator.c.

◆ FLAGS

Definition at line 58 of file af_apulsator.c.

Enumeration Type Documentation

◆ PulsatorModes

Enumerator
SINE 
TRIANGLE 
SQUARE 
SAWUP 
SAWDOWN 
NB_MODES 

Definition at line 27 of file af_apulsator.c.

◆ PulsatorTimings

Enumerator
UNIT_BPM 
UNIT_MS 
UNIT_HZ 
NB_TIMINGS 

Definition at line 28 of file af_apulsator.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( apulsator  )

◆ lfo_advance()

static void lfo_advance ( SimpleLFO lfo,
unsigned  count 
)
static

Definition at line 85 of file af_apulsator.c.

Referenced by filter_frame().

◆ lfo_get_value()

static double lfo_get_value ( SimpleLFO lfo)
static

Definition at line 92 of file af_apulsator.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 127 of file af_apulsator.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 186 of file af_apulsator.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 202 of file af_apulsator.c.

Variable Documentation

◆ apulsator_options

const AVOption apulsator_options[]
static
Initial value:
= {
{ "level_in", "set input gain", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, FLAGS, },
{ "level_out", "set output gain", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, FLAGS, },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=SINE}, SINE, NB_MODES-1, FLAGS, "mode" },
{ "sine", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SINE}, 0, 0, FLAGS, "mode" },
{ "triangle", NULL, 0, AV_OPT_TYPE_CONST, {.i64=TRIANGLE},0, 0, FLAGS, "mode" },
{ "square", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SQUARE}, 0, 0, FLAGS, "mode" },
{ "sawup", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SAWUP}, 0, 0, FLAGS, "mode" },
{ "sawdown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SAWDOWN}, 0, 0, FLAGS, "mode" },
{ "amount", "set modulation", OFFSET(amount), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ "offset_l", "set offset L", OFFSET(offset_l), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
{ "offset_r", "set offset R", OFFSET(offset_r), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, FLAGS },
{ "width", "set pulse width", OFFSET(pwidth), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 2, FLAGS },
{ "timing", "set timing", OFFSET(timing), AV_OPT_TYPE_INT, {.i64=2}, 0, NB_TIMINGS-1, FLAGS, "timing" },
{ "bpm", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_BPM}, 0, 0, FLAGS, "timing" },
{ "ms", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_MS}, 0, 0, FLAGS, "timing" },
{ "hz", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_HZ}, 0, 0, FLAGS, "timing" },
{ "bpm", "set BPM", OFFSET(bpm), AV_OPT_TYPE_DOUBLE, {.dbl=120}, 30, 300, FLAGS },
{ "ms", "set ms", OFFSET(ms), AV_OPT_TYPE_INT, {.i64=500}, 10, 2000, FLAGS },
{ "hz", "set frequency", OFFSET(hertz), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0.01, 100, FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: af_apulsator.c:58
#define OFFSET(x)
Definition: af_apulsator.c:57
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83

Definition at line 60 of file af_apulsator.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_apulsator.c:127
static int config_input(AVFilterLink *inlink)
Definition: af_apulsator.c:202

Definition at line 231 of file af_apulsator.c.

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 241 of file af_apulsator.c.

◆ ff_af_apulsator

AVFilter ff_af_apulsator
Initial value:
= {
.name = "apulsator",
.description = NULL_IF_CONFIG_SMALL("Audio pulsator."),
.priv_size = sizeof(AudioPulsatorContext),
.priv_class = &apulsator_class,
}
static int query_formats(AVFilterContext *ctx)
Definition: af_apulsator.c:186
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad outputs[]
Definition: af_apulsator.c:241
static const AVFilterPad inputs[]
Definition: af_apulsator.c:231

Definition at line 249 of file af_apulsator.c.