summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-27 21:12:22 +0100
committerwm4 <wm4@nowhere>2014-03-27 21:15:15 +0100
commitcd2d4ebf3b05e9cfefbb868e45ed71728178a99c (patch)
tree84a7c2b816d0f2b9e94ed7ce68553a3050f2c6ef /audio
parente8d952c807f35f9fd2844aa95276c08aa1e554c2 (diff)
downloadmpv-cd2d4ebf3b05e9cfefbb868e45ed71728178a99c.tar.bz2
mpv-cd2d4ebf3b05e9cfefbb868e45ed71728178a99c.tar.xz
af_volume: fix replaygain
This was accidentally broken in commit b72ba3f7. I somehow made the wild assumption that replaygain adjusted the volume relative to 0% instead of 100%. The detach suboption was similarly broken.
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af_volume.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c
index 8c24568187..20131eb8aa 100644
--- a/audio/filter/af_volume.c
+++ b/audio/filter/af_volume.c
@@ -115,6 +115,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
}
if (af_fmt_is_planar(in->format))
mp_audio_set_format(af->data, af_fmt_to_planar(af->data->format));
+ s->rgain = 1.0;
if ((s->rgain_track || s->rgain_album) && af->metadata) {
float gain, peak;
char *gain_tag = NULL, *peak_tag = NULL;
@@ -137,7 +138,7 @@ 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)
+ if (s->detach && fabs(s->level + s->rgain - 2.0) < 0.00001)
return AF_DETACH;
return af_test_output(af, in);
}
@@ -155,7 +156,7 @@ static void filter_plane(struct af_instance *af, void *ptr, int num_samples)
{
struct priv *s = af->priv;
- float level = s->level + s->rgain;
+ float level = s->level + s->rgain - 1.0;
if (af_fmt_from_planar(af->data->format) == AF_FORMAT_S16) {
int16_t *a = ptr;