FFmpeg
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 }
}

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 }
}

Definition at line 231 of file af_apulsator.c.

◆ outputs

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

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,
}

Definition at line 249 of file af_apulsator.c.

SQUARE
@ SQUARE
Definition: af_apulsator.c:27
AudioPulsatorContext
Definition: af_apulsator.c:40
UNIT_BPM
@ UNIT_BPM
Definition: af_apulsator.c:28
UNIT_MS
@ UNIT_MS
Definition: af_apulsator.c:28
NB_TIMINGS
@ NB_TIMINGS
Definition: af_apulsator.c:28
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_apulsator.c:127
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_apulsator.c:186
NULL
#define NULL
Definition: coverity.c:32
TRIANGLE
@ TRIANGLE
Definition: af_apulsator.c:27
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:27
UNIT_HZ
@ UNIT_HZ
Definition: af_apulsator.c:28
FLAGS
#define FLAGS
Definition: af_apulsator.c:58
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_apulsator.c:202
NB_MODES
@ NB_MODES
Definition: af_apulsator.c:27
SINE
@ SINE
Definition: af_apulsator.c:27
SAWDOWN
@ SAWDOWN
Definition: af_apulsator.c:27
mode
mode
Definition: ebur128.h:83
OFFSET
#define OFFSET(x)
Definition: af_apulsator.c:57
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
outputs
static const AVFilterPad outputs[]
Definition: af_apulsator.c:241
inputs
static const AVFilterPad inputs[]
Definition: af_apulsator.c:231
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234