FFmpeg
Data Structures | Macros | Functions | Variables
af_flanger.c File Reference
#include "libavutil/avstring.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 query_formats (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 []
 
static const AVFilterPad flanger_outputs []
 
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.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 91 of file af_flanger.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 120 of file af_flanger.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 141 of file af_flanger.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 206 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, "type" },
{ "triangular", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, "type" },
{ "t", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, "type" },
{ "sinusoidal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, "type" },
{ "s", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, "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, "itype" },
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_LINEAR}, 0, 0, A, "itype" },
{ "quadratic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_QUADRATIC}, 0, 0, A, "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,
},
{ NULL }
}

Definition at line 218 of file af_flanger.c.

◆ flanger_outputs

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

Definition at line 228 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."),
.query_formats = query_formats,
.priv_size = sizeof(FlangerContext),
.priv_class = &flanger_class,
.init = init,
}

Definition at line 236 of file af_flanger.c.

config_input
static int config_input(AVFilterLink *inlink)
Definition: af_flanger.c:120
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_flanger.c:91
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_flanger.c:206
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
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
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:141
flanger_outputs
static const AVFilterPad flanger_outputs[]
Definition: af_flanger.c:228
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:117
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:365
INTERPOLATION_LINEAR
#define INTERPOLATION_LINEAR
Definition: af_flanger.c:29
flanger_inputs
static const AVFilterPad flanger_inputs[]
Definition: af_flanger.c:218
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234