summaryrefslogtreecommitdiff
path: root/libavfilter/af_amix.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-12 22:58:13 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-12 23:01:52 +0100
commit95b854dd0630183d4130ad27097796ef167eb96b (patch)
treee0f9536ac85c392a465c3f27ab354920ca7ba62a /libavfilter/af_amix.c
parent05a6d82d5cc3e5c5b0ea97b9a6f4778c1c82d71c (diff)
avfilter/af_amix: rename sum option to normalize
It makes more sense to still use provided weights.
Diffstat (limited to 'libavfilter/af_amix.c')
-rw-r--r--libavfilter/af_amix.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index beaf7bcada..45a5dadf0a 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -164,7 +164,7 @@ typedef struct MixContext {
int duration_mode; /**< mode for determining duration */
float dropout_transition; /**< transition time when an input drops out */
char *weights_str; /**< string for custom weights for every input */
- int sum; /**< inputs are not scaled, only added */
+ int normalize; /**< if inputs are scaled */
int nb_channels; /**< number of channels */
int sample_rate; /**< sample rate */
@@ -196,8 +196,8 @@ static const AVOption amix_options[] = {
OFFSET(dropout_transition), AV_OPT_TYPE_FLOAT, { .dbl = 2.0 }, 0, INT_MAX, A|F },
{ "weights", "Set weight for each input.",
OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1"}, 0, 0, A|F|T },
- { "sum", "Do not scale inputs instead do only sum",
- OFFSET(sum), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A|F|T },
+ { "normalize", "Scale inputs",
+ OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, A|F|T },
{ NULL }
};
@@ -231,8 +231,8 @@ static void calculate_scales(MixContext *s, int nb_samples)
for (i = 0; i < s->nb_inputs; i++) {
if (s->input_state[i] & INPUT_ON) {
- if (s->sum)
- s->input_scale[i] = 1.0f;
+ if (!s->normalize)
+ s->input_scale[i] = FFABS(s->weights[i]);
else
s->input_scale[i] = 1.0f / s->scale_norm[i] * FFSIGN(s->weights[i]);
} else {