FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_apulsator.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.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 []
 
const AVFilter ff_af_apulsator
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 59 of file af_apulsator.c.

◆ FLAGS

Definition at line 60 of file af_apulsator.c.

Enumeration Type Documentation

◆ PulsatorModes

Enumerator
SINE 
TRIANGLE 
SQUARE 
SAWUP 
SAWDOWN 
NB_MODES 

Definition at line 29 of file af_apulsator.c.

◆ PulsatorTimings

Enumerator
UNIT_BPM 
UNIT_MS 
UNIT_HZ 
NB_TIMINGS 

Definition at line 30 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 87 of file af_apulsator.c.

Referenced by filter_frame().

◆ lfo_get_value()

static double lfo_get_value ( SimpleLFO lfo)
static

Definition at line 94 of file af_apulsator.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 129 of file af_apulsator.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 188 of file af_apulsator.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 203 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, .unit = "mode" },
{ "sine", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SINE}, 0, 0, FLAGS, .unit = "mode" },
{ "triangle", NULL, 0, AV_OPT_TYPE_CONST, {.i64=TRIANGLE},0, 0, FLAGS, .unit = "mode" },
{ "square", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SQUARE}, 0, 0, FLAGS, .unit = "mode" },
{ "sawup", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SAWUP}, 0, 0, FLAGS, .unit = "mode" },
{ "sawdown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=SAWDOWN}, 0, 0, FLAGS, .unit = "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, .unit = "timing" },
{ "bpm", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_BPM}, 0, 0, FLAGS, .unit = "timing" },
{ "ms", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_MS}, 0, 0, FLAGS, .unit = "timing" },
{ "hz", NULL, 0, AV_OPT_TYPE_CONST, {.i64=UNIT_HZ}, 0, 0, FLAGS, .unit = "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 }
}

Definition at line 62 of file af_apulsator.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}

Definition at line 232 of file af_apulsator.c.

◆ ff_af_apulsator

const AVFilter ff_af_apulsator
Initial value:
= {
.name = "apulsator",
.description = NULL_IF_CONFIG_SMALL("Audio pulsator."),
.priv_size = sizeof(AudioPulsatorContext),
.priv_class = &apulsator_class,
}

Definition at line 241 of file af_apulsator.c.

SQUARE
@ SQUARE
Definition: af_apulsator.c:29
AudioPulsatorContext
Definition: af_apulsator.c:42
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
UNIT_BPM
@ UNIT_BPM
Definition: af_apulsator.c:30
UNIT_MS
@ UNIT_MS
Definition: af_apulsator.c:30
NB_TIMINGS
@ NB_TIMINGS
Definition: af_apulsator.c:30
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:237
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_apulsator.c:129
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_apulsator.c:188
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
NULL
#define NULL
Definition: coverity.c:32
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:33
TRIANGLE
@ TRIANGLE
Definition: af_apulsator.c:29
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:106
SAWUP
@ SAWUP
Definition: af_apulsator.c:29
UNIT_HZ
@ UNIT_HZ
Definition: af_apulsator.c:30
FLAGS
#define FLAGS
Definition: af_apulsator.c:60
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_apulsator.c:203
NB_MODES
@ NB_MODES
Definition: af_apulsator.c:29
SINE
@ SINE
Definition: af_apulsator.c:29
SAWDOWN
@ SAWDOWN
Definition: af_apulsator.c:29
mode
mode
Definition: ebur128.h:83
OFFSET
#define OFFSET(x)
Definition: af_apulsator.c:59
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
inputs
static const AVFilterPad inputs[]
Definition: af_apulsator.c:232
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244