FFmpeg
Data Structures | Macros | Functions | Variables
af_alimiter.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  AudioLimiterContext
 

Macros

#define OFFSET(x)   offsetof(AudioLimiterContext, x)
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (alimiter)
 
static av_cold int init (AVFilterContext *ctx)
 
static double get_rdelta (AudioLimiterContext *s, double release, int sample_rate, double peak, double limit, double patt, int asc)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int config_input (AVFilterLink *inlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption alimiter_options []
 
static const AVFilterPad alimiter_inputs []
 
static const AVFilterPad alimiter_outputs []
 
const AVFilter ff_af_alimiter
 

Detailed Description

Lookahead limiter filter

Definition in file af_alimiter.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 64 of file af_alimiter.c.

◆ AF

Definition at line 65 of file af_alimiter.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( alimiter  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 81 of file af_alimiter.c.

◆ get_rdelta()

static double get_rdelta ( AudioLimiterContext s,
double  release,
int  sample_rate,
double  peak,
double  limit,
double  patt,
int  asc 
)
static

Definition at line 94 of file af_alimiter.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 113 of file af_alimiter.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 278 of file af_alimiter.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 306 of file af_alimiter.c.

Variable Documentation

◆ alimiter_options

const AVOption alimiter_options[]
static
Initial value:
= {
{ "level_in", "set input level", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1},.015625, 64, AF },
{ "level_out", "set output level", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1},.015625, 64, AF },
{ "limit", "set limit", OFFSET(limit), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0625, 1, AF },
{ "attack", "set attack", OFFSET(attack), AV_OPT_TYPE_DOUBLE, {.dbl=5}, 0.1, 80, AF },
{ "release", "set release", OFFSET(release), AV_OPT_TYPE_DOUBLE, {.dbl=50}, 1, 8000, AF },
{ "asc", "enable asc", OFFSET(auto_release), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AF },
{ "asc_level", "set asc level", OFFSET(asc_coeff), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 1, AF },
{ "level", "auto level", OFFSET(auto_level), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, AF },
{ NULL }
}

Definition at line 67 of file af_alimiter.c.

◆ alimiter_inputs

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

Definition at line 315 of file af_alimiter.c.

◆ alimiter_outputs

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

Definition at line 324 of file af_alimiter.c.

◆ ff_af_alimiter

const AVFilter ff_af_alimiter
Initial value:
= {
.name = "alimiter",
.description = NULL_IF_CONFIG_SMALL("Audio lookahead limiter."),
.priv_size = sizeof(AudioLimiterContext),
.priv_class = &alimiter_class,
.init = init,
.process_command = ff_filter_process_command,
}

Definition at line 331 of file af_alimiter.c.

init
static av_cold int init(AVFilterContext *ctx)
Definition: af_alimiter.c:81
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:184
alimiter_inputs
static const AVFilterPad alimiter_inputs[]
Definition: af_alimiter.c:315
alimiter_outputs
static const AVFilterPad alimiter_outputs[]
Definition: af_alimiter.c:324
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_alimiter.c:306
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_alimiter.c:113
NULL
#define NULL
Definition: coverity.c:32
AudioLimiterContext
Definition: af_alimiter.c:36
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
AF
#define AF
Definition: af_alimiter.c:65
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:882
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:146
limit
static double limit(double x)
Definition: vf_pseudocolor.c:128
OFFSET
#define OFFSET(x)
Definition: af_alimiter.c:64
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_alimiter.c:278
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64