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 "filters.h"
#include "formats.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 (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
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 ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 188 of file af_apulsator.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 214 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 243 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 252 of file af_apulsator.c.

SQUARE
@ SQUARE
Definition: af_apulsator.c:29
AudioPulsatorContext
Definition: af_apulsator.c:42
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
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
Underlying C type is double.
Definition: opt.h:267
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
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
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:34
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:94
SAWUP
@ SAWUP
Definition: af_apulsator.c:29
UNIT_HZ
@ UNIT_HZ
Definition: af_apulsator.c:30
FLAGS
#define FLAGS
Definition: af_apulsator.c:60
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: af_apulsator.c:188
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_apulsator.c:214
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
Underlying C type is int.
Definition: opt.h:259
inputs
static const AVFilterPad inputs[]
Definition: af_apulsator.c:243
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299