39 "fixed",
"float",
"double"
45 "nb_consumed_samples",
58 #define OFFSET(x) offsetof(VolumeContext, x)
59 #define A AV_OPT_FLAG_AUDIO_PARAM
60 #define F AV_OPT_FLAG_FILTERING_PARAM
63 {
"volume",
"set volume adjustment expression",
65 {
"precision",
"select mathematical precision",
86 NULL, NULL, NULL, NULL, 0, log_ctx);
89 "Error when evaluating the volume expression '%s'\n", expr);
157 int nb_samples,
int volume)
160 for (i = 0; i < nb_samples; i++)
161 dst[i] = av_clip_uint8(((((int64_t)src[i] - 128) * volume + 128) >> 8) + 128);
165 int nb_samples,
int volume)
168 for (i = 0; i < nb_samples; i++)
169 dst[i] = av_clip_uint8((((src[i] - 128) * volume + 128) >> 8) + 128);
173 int nb_samples,
int volume)
176 int16_t *smp_dst = (int16_t *)dst;
177 const int16_t *smp_src = (
const int16_t *)src;
178 for (i = 0; i < nb_samples; i++)
179 smp_dst[i] = av_clip_int16(((int64_t)smp_src[i] * volume + 128) >> 8);
183 int nb_samples,
int volume)
186 int16_t *smp_dst = (int16_t *)dst;
187 const int16_t *smp_src = (
const int16_t *)src;
188 for (i = 0; i < nb_samples; i++)
189 smp_dst[i] = av_clip_int16((smp_src[i] * volume + 128) >> 8);
193 int nb_samples,
int volume)
198 for (i = 0; i < nb_samples; i++)
199 smp_dst[i] = av_clipl_int32((((int64_t)smp_src[i] * volume + 128) >> 8));
306 if (!strcmp(cmd,
"volume")) {
316 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
317 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
318 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
364 int p, plane_samples;
372 for (p = 0; p < vol->
planes; p++) {
378 for (p = 0; p < vol->
planes; p++) {
381 vol->
volume, plane_samples);
384 for (p = 0; p < vol->
planes; p++) {
387 vol->
volume, plane_samples);
423 .priv_class = &volume_class,
426 .
inputs = avfilter_af_volume_inputs,
427 .
outputs = avfilter_af_volume_outputs,