39 "fixed",
"float",
"double"
42 #define OFFSET(x) offsetof(VolumeContext, x)
43 #define A AV_OPT_FLAG_AUDIO_PARAM
46 {
"volume",
"Volume adjustment.",
48 {
"precision",
"Mathematical precision.",
144 dst[i] = av_clip_uint8(((((int64_t)src[i] - 128) * volume + 128) >> 8) + 128);
152 dst[i] = av_clip_uint8((((src[i] - 128) * volume + 128) >> 8) + 128);
159 int16_t *smp_dst = (int16_t *)dst;
160 const int16_t *smp_src = (
const int16_t *)src;
162 smp_dst[i] = av_clip_int16(((int64_t)smp_src[i] * volume + 128) >> 8);
169 int16_t *smp_dst = (int16_t *)dst;
170 const int16_t *smp_src = (
const int16_t *)src;
172 smp_dst[i] = av_clip_int16((smp_src[i] * volume + 128) >> 8);
182 smp_dst[i] = av_clipl_int32((((int64_t)smp_src[i] * volume + 128) >> 8));
257 int p, plane_samples;
265 for (p = 0; p < vol->
planes; p++) {
271 for (p = 0; p < vol->
planes; p++) {
274 vol->
volume, plane_samples);
277 for (p = 0; p < vol->
planes; p++) {
280 vol->
volume, plane_samples);
315 .
inputs = avfilter_af_volume_inputs,
316 .
outputs = avfilter_af_volume_outputs,
uint8_t ** extended_data
pointers to the data planes/channels.
static av_cold int init(AVFilterContext *ctx, const char *args)
static void volume_init(VolumeContext *vol)
AVFilterBufferRef * ff_get_audio_buffer(AVFilterLink *link, int perms, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int nb_samples
number of audio samples
AVFilterBufferRefAudioProps * audio
audio buffer specific properties
static const AVFilterPad outputs[]
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
enum PrecisionType precision
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
Send a frame of data to the next filter.
int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
Parse the key/value pairs list in opts.
static enum AVSampleFormat formats[]
void avfilter_unref_buffer(AVFilterBufferRef *ref)
Remove a reference to a buffer.
const char * name
Pad name.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVFilterLink ** inputs
array of pointers to input links
void(* scale_samples)(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
static const AVOption options[]
static const AVClass volume_class
int64_t pts
presentation timestamp.
static void scale_samples_s32(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
A filter pad used for either input or output.
A link between two filters.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
void av_log(void *avcl, int level, const char *fmt,...)
void(* vector_dmul_scalar)(double *dst, const double *src, double mul, int len)
Multiply a vector of double by a scalar double.
static int query_formats(AVFilterContext *ctx)
static void scale_samples_s16(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)
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
static const AVFilterPad avfilter_af_volume_outputs[]
AVFilterContext * src
source filter
static void scale_samples_u8(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
int format
agreed upon media format
enum AVSampleFormat sample_fmt
A reference to an AVFilterBuffer.
int perms
permissions, see the AV_PERM_* flags
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
const char * name
filter name
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
static void scale_samples_s16_small(uint8_t *dst, const uint8_t *src, int nb_samples, int volume)
static const char * precision_str[]
void av_opt_free(void *obj)
Free all string and binary options in obj.
void ff_volume_init_x86(VolumeContext *vol)
static const AVFilterPad avfilter_af_volume_inputs[]
common internal and external API header
AVSampleFormat
Audio Sample Formats.
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
#define AV_PERM_WRITE
can write to the buffer
AVFilterContext * dst
dest filter
struct VolumeContext VolumeContext
void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
Initialize a float DSP context.
AVFilter avfilter_af_volume
simple arithmetic expression evaluator
static int config_output(AVFilterLink *outlink)