summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-23 15:07:19 +0200
committerwm4 <wm4@nowhere>2015-06-23 15:07:19 +0200
commit4c6a600943cf0bc7ef5c51816b471cb688d7cd61 (patch)
tree847ce853954facf2d91710f5ff25b7dda84edd4e /audio
parente7d5a5e68815875deb48f85531657533637b6d6f (diff)
downloadmpv-4c6a600943cf0bc7ef5c51816b471cb688d7cd61.tar.bz2
mpv-4c6a600943cf0bc7ef5c51816b471cb688d7cd61.tar.xz
af_volume: add a replaygain fallback option
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af_volume.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c
index dfdf586690..8de9d8dfa9 100644
--- a/audio/filter/af_volume.c
+++ b/audio/filter/af_volume.c
@@ -37,6 +37,7 @@ struct priv {
int rgain_album; // Enable/disable album based replaygain
float rgain_preamp; // Set replaygain pre-amplification
int rgain_clip; // Enable/disable clipping prevention
+ float replaygain_fallback;
int soft; // Enable/disable soft clipping
int fast; // Use fix-point volume control
int detach; // Detach if gain volume is neutral
@@ -82,6 +83,9 @@ static int control(struct af_instance *af, int cmd, void *arg)
s->rgain = MPMIN(s->rgain, 1.0 / peak);
MP_VERBOSE(af, "...with clipping prevention: %f\n", s->rgain);
}
+ } else if (s->replaygain_fallback) {
+ af_from_dB(1, &s->replaygain_fallback, &s->rgain, 20.0, -200.0, 60.0);
+ MP_VERBOSE(af, "Applying fallback gain: %f\n", s->rgain);
}
if (s->detach && fabs(s->level * s->rgain - 1.0) < 0.00001)
return AF_DETACH;
@@ -165,6 +169,7 @@ const struct af_info af_info_volume = {
OPT_FLAG("replaygain-album", rgain_album, 0),
OPT_FLOATRANGE("replaygain-preamp", rgain_preamp, 0, -15, 15),
OPT_FLAG("replaygain-clip", rgain_clip, 0),
+ OPT_FLOATRANGE("replaygain-fallback", replaygain_fallback, 0, -200, 60),
OPT_FLAG("softclip", soft, 0),
OPT_FLAG("s16", fast, 0),
OPT_FLAG("detach", detach, 0),