FFmpeg
Data Structures | Macros | Functions | Variables
af_alimiter.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/fifo.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  MetaItem
 
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 request_frame (AVFilterLink *outlink)
 
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 78 of file af_alimiter.c.

◆ AF

Definition at line 79 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 96 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 109 of file af_alimiter.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 128 of file af_alimiter.c.

Referenced by request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 338 of file af_alimiter.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 358 of file af_alimiter.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 395 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 },
{ "latency", "compensate delay", OFFSET(latency), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AF },
{ NULL }
}

Definition at line 81 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 406 of file af_alimiter.c.

◆ alimiter_outputs

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

Definition at line 415 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 423 of file af_alimiter.c.

init
static av_cold int init(AVFilterContext *ctx)
Definition: af_alimiter.c:96
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:183
alimiter_inputs
static const AVFilterPad alimiter_inputs[]
Definition: af_alimiter.c:406
alimiter_outputs
static const AVFilterPad alimiter_outputs[]
Definition: af_alimiter.c:415
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_alimiter.c:395
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_alimiter.c:128
NULL
#define NULL
Definition: coverity.c:32
AudioLimiterContext
Definition: af_alimiter.c:42
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:115
AF
#define AF
Definition: af_alimiter.c:79
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:858
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:152
limit
static double limit(double x)
Definition: vf_pseudocolor.c:130
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_alimiter.c:338
OFFSET
#define OFFSET(x)
Definition: af_alimiter.c:78
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_alimiter.c:358
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61