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 "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 []
 
const AVFilter ff_af_apulsator
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 58 of file af_apulsator.c.

◆ FLAGS

Definition at line 59 of file af_apulsator.c.

Enumeration Type Documentation

◆ PulsatorModes

Enumerator
SINE 
TRIANGLE 
SQUARE 
SAWUP 
SAWDOWN 
NB_MODES 

Definition at line 28 of file af_apulsator.c.

◆ PulsatorTimings

Enumerator
UNIT_BPM 
UNIT_MS 
UNIT_HZ 
NB_TIMINGS 

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

Referenced by filter_frame().

◆ lfo_get_value()

static double lfo_get_value ( SimpleLFO lfo)
static

Definition at line 93 of file af_apulsator.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 128 of file af_apulsator.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 187 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 }
}

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

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

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

SQUARE
@ SQUARE
Definition: af_apulsator.c:28
AudioPulsatorContext
Definition: af_apulsator.c:41
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
UNIT_BPM
@ UNIT_BPM
Definition: af_apulsator.c:29
UNIT_MS
@ UNIT_MS
Definition: af_apulsator.c:29
NB_TIMINGS
@ NB_TIMINGS
Definition: af_apulsator.c:29
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_apulsator.c:128
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_apulsator.c:187
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
NULL
#define NULL
Definition: coverity.c:32
TRIANGLE
@ TRIANGLE
Definition: af_apulsator.c:28
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:117
SAWUP
@ SAWUP
Definition: af_apulsator.c:28
UNIT_HZ
@ UNIT_HZ
Definition: af_apulsator.c:29
FLAGS
#define FLAGS
Definition: af_apulsator.c:59
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_apulsator.c:202
NB_MODES
@ NB_MODES
Definition: af_apulsator.c:28
SINE
@ SINE
Definition: af_apulsator.c:28
SAWDOWN
@ SAWDOWN
Definition: af_apulsator.c:28
mode
mode
Definition: ebur128.h:83
OFFSET
#define OFFSET(x)
Definition: af_apulsator.c:58
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
outputs
static const AVFilterPad outputs[]
Definition: af_apulsator.c:240
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
inputs
static const AVFilterPad inputs[]
Definition: af_apulsator.c:231
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233