aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inputPlugins/mpc_plugin.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index 5bccb3f3d..b0cf24ab3 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -132,6 +132,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
mpc_uint32_t vbrUpdateBits;
float time;
int i;
+ ReplayGainInfo * replayGainInfo = NULL;
data.inStream = inStream;
data.dc = dc;
@@ -174,11 +175,17 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
dc->totalTime = mpc_streaminfo_get_length(&info);
dc->audioFormat.bits = 16;
- dc->audioFormat.channels = 2;
+ dc->audioFormat.channels = info.channels;
dc->audioFormat.sampleRate = info.sample_freq;
getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat));
+ replayGainInfo = newReplayGainInfo();
+ replayGainInfo->albumGain = info.gain_album;
+ replayGainInfo->albumPeak = info.peak_album;
+ replayGainInfo->trackGain = info.gain_title;
+ replayGainInfo->trackPeak = info.peak_title;
+
dc->state = DECODE_STATE_DECODE;
while(!eof) {
@@ -224,7 +231,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
chunk, chunkpos,
time,
bitRate,
- NULL);
+ replayGainInfo);
+
chunkpos = 0;
s16 = (mpd_sint16 *)chunk;
if(dc->stop) {
@@ -243,13 +251,15 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable,
chunk, chunkpos, time, bitRate,
- NULL);
+ replayGainInfo);
}
closeInputStream(inStream);
flushOutputBuffer(cb);
+ freeReplayGainInfo(replayGainInfo);
+
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;