diff options
Diffstat (limited to 'src/inputPlugins/mpc_plugin.c')
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index c274f0e83..05ca53ee6 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -132,7 +132,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) mpc_uint32_t vbrUpdateBits; float time; int i; - ReplayGainInfo * replayGainInfo; data.inStream = inStream; data.dc = dc; @@ -144,11 +143,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) reader.canseek = mpc_canseek_cb; reader.data = &data; - DEBUG("HERE 1\n"); - mpc_streaminfo_init(&info); - DEBUG("HERE 2\n"); if((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) { closeInputStream(inStream); if(!dc->stop) { @@ -163,9 +159,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) return 0; } - DEBUG("HERE 3\n"); mpc_decoder_setup(&decoder, &reader); - DEBUG("HERE 4\n"); + if(!mpc_decoder_initialize(&decoder, &info)) { closeInputStream(inStream); if(!dc->stop) { @@ -177,16 +172,16 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) } } - DEBUG("HERE 5\n"); dc->totalTime = mpc_streaminfo_get_length(&info); dc->audioFormat.bits = 16; - dc->audioFormat.channels = 16; + dc->audioFormat.channels = 2; dc->audioFormat.sampleRate = info.sample_freq; + + getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat)); - replayGainInfo = newReplayGainInfo(); + dc->state = DECODE_STATE_DECODE; - DEBUG("HERE 6\n"); while(!eof) { if(dc->seek) { samplePos = dc->seekWhere * dc->audioFormat.sampleRate; @@ -197,6 +192,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) else dc->seekError = 1; dc->seek = 0; } + ret = mpc_decoder_decode(&decoder, sample_buffer, &vbrUpdateAcc, &vbrUpdateBits); @@ -229,7 +225,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) chunk, chunkpos, time, bitRate, - replayGainInfo); + NULL); chunkpos = 0; s16 = (mpd_sint16 *)chunk; if(dc->stop) break; @@ -237,7 +233,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) } } - DEBUG("HERE 7\n"); if(!dc->stop && chunkpos > 0) { time = ((float)samplePos) / dc->audioFormat.sampleRate; @@ -246,22 +241,19 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable, chunk, chunkpos, time, bitRate, - replayGainInfo); + NULL); } - DEBUG("HERE 8\n"); closeInputStream(inStream); - DEBUG("HERE 9\n"); - flushOutputBuffer(cb); - - freeReplayGainInfo(replayGainInfo); - if(dc->stop) { dc->state = DECODE_STATE_STOP; dc->stop = 0; } - else dc->state = DECODE_STATE_STOP; + else { + flushOutputBuffer(cb); + dc->state = DECODE_STATE_STOP; + } return 0; } |