FFmpeg
Data Structures | Macros | Functions | Variables
af_flanger.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avfilter.h"
#include "audio.h"
#include "internal.h"
#include "generate_wave_table.h"

Go to the source code of this file.

Data Structures

struct  FlangerContext
 

Macros

#define INTERPOLATION_LINEAR   0
 
#define INTERPOLATION_QUADRATIC   1
 
#define OFFSET(x)   offsetof(FlangerContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (flanger)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption flanger_options []
 
static const AVFilterPad flanger_inputs []
 
const AVFilter ff_af_flanger
 

Macro Definition Documentation

◆ INTERPOLATION_LINEAR

#define INTERPOLATION_LINEAR   0

Definition at line 29 of file af_flanger.c.

◆ INTERPOLATION_QUADRATIC

#define INTERPOLATION_QUADRATIC   1

Definition at line 30 of file af_flanger.c.

◆ OFFSET

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

Definition at line 52 of file af_flanger.c.

◆ A

Definition at line 53 of file af_flanger.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( flanger  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 75 of file af_flanger.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 91 of file af_flanger.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 112 of file af_flanger.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 177 of file af_flanger.c.

Variable Documentation

◆ flanger_options

const AVOption flanger_options[]
static
Initial value:
= {
{ "delay", "base delay in milliseconds", OFFSET(delay_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 30, A },
{ "depth", "added swept delay in milliseconds", OFFSET(delay_depth), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, 10, A },
{ "regen", "percentage regeneration (delayed signal feedback)", OFFSET(feedback_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -95, 95, A },
{ "width", "percentage of delayed signal mixed with original", OFFSET(delay_gain), AV_OPT_TYPE_DOUBLE, {.dbl=71}, 0, 100, A },
{ "speed", "sweeps per second (Hz)", OFFSET(speed), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0.1, 10, A },
{ "shape", "swept wave shape", OFFSET(wave_shape), AV_OPT_TYPE_INT, {.i64=WAVE_SIN}, WAVE_SIN, WAVE_NB-1, A, .unit = "type" },
{ "triangular", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, .unit = "type" },
{ "t", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, .unit = "type" },
{ "sinusoidal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, .unit = "type" },
{ "s", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, .unit = "type" },
{ "phase", "swept wave percentage phase-shift for multi-channel", OFFSET(channel_phase), AV_OPT_TYPE_DOUBLE, {.dbl=25}, 0, 100, A },
{ "interp", "delay-line interpolation", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, .unit = "itype" },
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_LINEAR}, 0, 0, A, .unit = "itype" },
{ "quadratic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_QUADRATIC}, 0, 0, A, .unit = "itype" },
{ NULL }
}

Definition at line 55 of file af_flanger.c.

◆ flanger_inputs

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

Definition at line 189 of file af_flanger.c.

◆ ff_af_flanger

const AVFilter ff_af_flanger
Initial value:
= {
.name = "flanger",
.description = NULL_IF_CONFIG_SMALL("Apply a flanging effect to the audio."),
.priv_size = sizeof(FlangerContext),
.priv_class = &flanger_class,
.init = init,
}

Definition at line 198 of file af_flanger.c.

config_input
static int config_input(AVFilterLink *inlink)
Definition: af_flanger.c:91
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:175
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_flanger.c:177
INTERPOLATION_QUADRATIC
#define INTERPOLATION_QUADRATIC
Definition: af_flanger.c:30
OFFSET
#define OFFSET(x)
Definition: af_flanger.c:52
WAVE_TRI
@ WAVE_TRI
Definition: generate_wave_table.h:26
A
#define A
Definition: af_flanger.c:53
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_flanger.c:75
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:237
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
WAVE_SIN
@ WAVE_SIN
Definition: generate_wave_table.h:25
NULL
#define NULL
Definition: coverity.c:32
WAVE_NB
@ WAVE_NB
Definition: generate_wave_table.h:27
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: af_flanger.c:112
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
FlangerContext
Definition: af_flanger.c:32
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
interpolation
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
Definition: af_adeclick.c:390
INTERPOLATION_LINEAR
#define INTERPOLATION_LINEAR
Definition: af_flanger.c:29
flanger_inputs
static const AVFilterPad flanger_inputs[]
Definition: af_flanger.c:189
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244