summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-14 22:34:42 +0100
committerwm4 <wm4@nowhere>2014-03-14 22:37:46 +0100
commitdc0f2308d13e107802111eb843996972e53766ad (patch)
tree6313c60b50e95381b166487e58f6b1af427e2dab /audio
parentb72ba3f7440c7c8ac811079303e69287f03ddd90 (diff)
downloadmpv-dc0f2308d13e107802111eb843996972e53766ad.tar.bz2
mpv-dc0f2308d13e107802111eb843996972e53766ad.tar.xz
af_volume: add detach option
Maybe this should be default. On the other hand, this filter does something even if the volume is neutral: it clips samples against the allowed range, should the decoder or a previous filter output garbage.
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af_volume.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c
index 4abbded822..31f9653e6f 100644
--- a/audio/filter/af_volume.c
+++ b/audio/filter/af_volume.c
@@ -39,6 +39,7 @@ struct priv {
int rgain_clip; // Enable/disable clipping prevention
int soft; // Enable/disable soft clipping
int fast; // Use fix-point volume control
+ int detach; // Detach if gain volume is neutral
float cfg_volume;
};
@@ -136,6 +137,8 @@ static int control(struct af_instance *af, int cmd, void *arg)
s->rgain = MPMIN(s->rgain, 1.0 / peak);
}
}
+ if (s->detach && fabs(s->level + s->rgain - 1.0) < 0.00001)
+ return AF_DETACH;
return af_test_output(af, in);
}
case AF_CONTROL_SET_VOLUME:
@@ -209,6 +212,7 @@ struct af_info af_info_volume = {
OPT_FLAG("replaygain-clip", rgain_clip, 0),
OPT_FLAG("softclip", soft, 0),
OPT_FLAG("s16", fast, 0),
+ OPT_FLAG("detach", detach, 0),
{0}
},
};