aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-10-28 22:22:30 +0100
committerMax Kellermann <max@duempel.org>2014-10-28 22:22:30 +0100
commit54c591bd9d9657065fb1c338eefe416840c78d3e (patch)
tree2609c9db30bebe09a75658fbd0742a010641694b
parent217d88f21f11236478dd41c37b67bef5b0a06497 (diff)
downloadmpd-54c591bd9d9657065fb1c338eefe416840c78d3e.tar.gz
mpd-54c591bd9d9657065fb1c338eefe416840c78d3e.tar.xz
mpd-54c591bd9d9657065fb1c338eefe416840c78d3e.zip
decoder/mad: fix negative replay gain values
Negating an unsigned integer does not work.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx2
2 files changed, 2 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 5541db7f2..66862543b 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.19.2 (not yet released)
* decoder
- faad: remove workaround for ancient libfaad2 ABI bug
- ffmpeg: recognize MIME type audio/aacp
+ - mad: fix negative replay gain values
* output
- fix memory leak after filter initialization error
- fall back to PCM if given DSD sample rate is not supported
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index 41efb593d..de6c9b127 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -657,7 +657,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen)
unsigned name = mad_bit_read(ptr, 3); /* gain name */
unsigned orig = mad_bit_read(ptr, 3); /* gain originator */
unsigned sign = mad_bit_read(ptr, 1); /* sign bit */
- unsigned gain = mad_bit_read(ptr, 9); /* gain*10 */
+ int gain = mad_bit_read(ptr, 9); /* gain*10 */
if (gain && name == 1 && orig != 0) {
lame->track_gain = ((sign ? -gain : gain) / 10.0) + adj;
FormatDebug(mad_domain, "LAME track gain found: %f",