aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mpcdec_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-03-28 19:31:47 +0200
committerMax Kellermann <max@duempel.org>2010-03-28 19:31:47 +0200
commite9beea072d17ec01a124c189c42df1a1350a4106 (patch)
tree7334654ded3a281e53546671f9fcb8e4b1857545 /src/decoder/mpcdec_decoder_plugin.c
parente69bb3b337c8f805302a4ba9e46c7bc36d8df80c (diff)
parentd612e5e0ab27b93fcfdcf25eb3014ea4e17cd41c (diff)
downloadmpd-e9beea072d17ec01a124c189c42df1a1350a4106.tar.gz
mpd-e9beea072d17ec01a124c189c42df1a1350a4106.tar.xz
mpd-e9beea072d17ec01a124c189c42df1a1350a4106.zip
Merge release 0.15.9 from branch 'v0.15.x'
Conflicts: NEWS configure.ac src/cue/cue_tag.c src/decoder/mpcdec_decoder_plugin.c src/player_thread.c
Diffstat (limited to 'src/decoder/mpcdec_decoder_plugin.c')
-rw-r--r--src/decoder/mpcdec_decoder_plugin.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/decoder/mpcdec_decoder_plugin.c b/src/decoder/mpcdec_decoder_plugin.c
index e41ae779d..4df8dd218 100644
--- a/src/decoder/mpcdec_decoder_plugin.c
+++ b/src/decoder/mpcdec_decoder_plugin.c
@@ -25,6 +25,7 @@
#include <mpcdec/mpcdec.h>
#else
#include <mpc/mpcdec.h>
+#include <math.h>
#endif
#include <glib.h>
@@ -105,7 +106,7 @@ mpc_to_mpd_sample(MPC_SAMPLE_FORMAT sample)
const int shift = bits - MPC_FIXED_POINT_SCALE_SHIFT;
if (shift < 0)
- val = sample << -shift;
+ val = sample >> -shift;
else
val = sample << shift;
#else
@@ -206,10 +207,18 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is)
struct replay_gain_info replay_gain_info;
replay_gain_info_init(&replay_gain_info);
+#ifdef MPC_IS_OLD_API
replay_gain_info.tuples[REPLAY_GAIN_ALBUM].gain = info.gain_album * 0.01;
replay_gain_info.tuples[REPLAY_GAIN_ALBUM].peak = info.peak_album / 32767.0;
replay_gain_info.tuples[REPLAY_GAIN_TRACK].gain = info.gain_title * 0.01;
replay_gain_info.tuples[REPLAY_GAIN_TRACK].peak = info.peak_title / 32767.0;
+#else
+ replay_gain_info.tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.);
+ replay_gain_info.tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767;
+ replay_gain_info.tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.);
+ replay_gain_info.tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767;
+#endif
+
decoder_replay_gain(mpd_decoder, &replay_gain_info);
decoder_initialized(mpd_decoder, &audio_format,