af_volume.c File Reference

audio volume filter More...

#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/float_dsp.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "af_volume.h"
Include dependency graph for af_volume.c:

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(VolumeContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (volume)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static void scale_samples_u8 (uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
 
static void scale_samples_u8_small (uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
 
static void scale_samples_s16 (uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
 
static void scale_samples_s16_small (uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
 
static void scale_samples_s32 (uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
 
static void volume_init (VolumeContext *vol)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf)
 

Variables

static const char * precision_str []
 
static const AVOption volume_options []
 
static const AVFilterPad avfilter_af_volume_inputs []
 
static const AVFilterPad avfilter_af_volume_outputs []
 
AVFilter avfilter_af_volume
 

Detailed Description

audio volume filter

Definition in file af_volume.c.

Macro Definition Documentation

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 43 of file af_volume.c.

Definition at line 44 of file af_volume.c.

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

Definition at line 42 of file af_volume.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( volume  )
static int config_output ( AVFilterLink outlink)
static

Definition at line 202 of file af_volume.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 217 of file af_volume.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 59 of file af_volume.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 77 of file af_volume.c.

static void scale_samples_s16 ( uint8_t dst,
const uint8_t src,
int  nb_samples,
int  volume 
)
inlinestatic

Definition at line 138 of file af_volume.c.

Referenced by volume_init().

static void scale_samples_s16_small ( uint8_t dst,
const uint8_t src,
int  nb_samples,
int  volume 
)
inlinestatic

Definition at line 148 of file af_volume.c.

Referenced by volume_init().

static void scale_samples_s32 ( uint8_t dst,
const uint8_t src,
int  nb_samples,
int  volume 
)
inlinestatic

Definition at line 158 of file af_volume.c.

Referenced by volume_init().

static void scale_samples_u8 ( uint8_t dst,
const uint8_t src,
int  nb_samples,
int  volume 
)
inlinestatic

Definition at line 122 of file af_volume.c.

Referenced by volume_init().

static void scale_samples_u8_small ( uint8_t dst,
const uint8_t src,
int  nb_samples,
int  volume 
)
inlinestatic

Definition at line 130 of file af_volume.c.

Referenced by volume_init().

static void volume_init ( VolumeContext vol)
static

Definition at line 168 of file af_volume.c.

Referenced by config_output().

Variable Documentation

AVFilter avfilter_af_volume
Initial value:
= {
.name = "volume",
.description = NULL_IF_CONFIG_SMALL("Change input volume."),
.query_formats = query_formats,
.priv_size = sizeof(VolumeContext),
.priv_class = &volume_class,
.init = init,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold int init(AVFilterContext *ctx)
Definition: af_volume.c:59
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int query_formats(AVFilterContext *ctx)
Definition: af_volume.c:77
static const AVFilterPad avfilter_af_volume_outputs[]
Definition: af_volume.c:281
static const AVFilterPad avfilter_af_volume_inputs[]
Definition: af_volume.c:272
struct VolumeContext VolumeContext
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 at line 290 of file af_volume.c.

const AVFilterPad avfilter_af_volume_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
NULL
Definition: eval.c:55
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: af_volume.c:217

Definition at line 272 of file af_volume.c.

const AVFilterPad avfilter_af_volume_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}
NULL
Definition: eval.c:55
static int config_output(AVFilterLink *outlink)
Definition: af_volume.c:202

Definition at line 281 of file af_volume.c.

const char* precision_str[]
static
Initial value:
= {
"fixed", "float", "double"
}

Definition at line 38 of file af_volume.c.

Referenced by init().

const AVOption volume_options[]
static
Initial value:
= {
{ "volume", "set volume adjustment",
OFFSET(volume), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0, 0x7fffff, A|F },
{ "precision", "select mathematical precision",
OFFSET(precision), AV_OPT_TYPE_INT, { .i64 = PRECISION_FLOAT }, PRECISION_FIXED, PRECISION_DOUBLE, A|F, "precision" },
{ "fixed", "select 8-bit fixed-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FIXED }, INT_MIN, INT_MAX, A|F, "precision" },
{ "float", "select 32-bit floating-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FLOAT }, INT_MIN, INT_MAX, A|F, "precision" },
{ "double", "select 64-bit floating-point", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_DOUBLE }, INT_MIN, INT_MAX, A|F, "precision" },
{ NULL },
}
#define A
Definition: af_volume.c:43
#define F
Definition: af_volume.c:44
NULL
Definition: eval.c:55
#define OFFSET(x)
Definition: af_volume.c:42

Definition at line 46 of file af_volume.c.