diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:05 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:05 +0200 |
commit | 4590a98f0eb9484e185e7e0c25a3373c8e9076ea (patch) | |
tree | 94ea0d53bdf0b7f9b81ff679b0fb4466d971b1e5 /src/inputPlugins/mpc_plugin.c | |
parent | 0d45870cea6836cd48e6953f4e67756b2502e22c (diff) | |
download | mpd-4590a98f0eb9484e185e7e0c25a3373c8e9076ea.tar.gz mpd-4590a98f0eb9484e185e7e0c25a3373c8e9076ea.tar.xz mpd-4590a98f0eb9484e185e7e0c25a3373c8e9076ea.zip |
added audio_format parameter to decoder_initialized()
dc->audioFormat is set once by the decoder plugins before invoking
decoder_initialized(); hide dc->audioFormat and let the decoder pass
an AudioFormat pointer to decoder_initialized().
Diffstat (limited to 'src/inputPlugins/mpc_plugin.c')
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 13f2adcee..5a57ea4c8 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -111,6 +111,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) mpc_decoder decoder; mpc_reader reader; mpc_streaminfo info; + AudioFormat audio_format; MpcCallbackData data; @@ -161,11 +162,9 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) dc.totalTime = mpc_streaminfo_get_length(&info); - dc.audioFormat.bits = 16; - dc.audioFormat.channels = info.channels; - dc.audioFormat.sampleRate = info.sample_freq; - - getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); + audio_format.bits = 16; + audio_format.channels = info.channels; + audio_format.sampleRate = info.sample_freq; replayGainInfo = newReplayGainInfo(); replayGainInfo->albumGain = info.gain_album * 0.01; @@ -173,11 +172,11 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) replayGainInfo->trackGain = info.gain_title * 0.01; replayGainInfo->trackPeak = info.peak_title / 32767.0; - decoder_initialized(mpd_decoder); + decoder_initialized(mpd_decoder, &audio_format); while (!eof) { if (dc.command == DECODE_COMMAND_SEEK) { - samplePos = dc.seekWhere * dc.audioFormat.sampleRate; + samplePos = dc.seekWhere * audio_format.sampleRate; if (mpc_decoder_seek_sample(&decoder, samplePos)) { decoder_clear(mpd_decoder); s16 = (mpd_sint16 *) chunk; @@ -210,10 +209,10 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) if (chunkpos >= MPC_CHUNK_SIZE) { total_time = ((float)samplePos) / - dc.audioFormat.sampleRate; + audio_format.sampleRate; bitRate = vbrUpdateBits * - dc.audioFormat.sampleRate / 1152 / 1000; + audio_format.sampleRate / 1152 / 1000; decoder_data(mpd_decoder, inStream, inStream->seekable, @@ -232,10 +231,10 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) } if (dc.command != DECODE_COMMAND_STOP && chunkpos > 0) { - total_time = ((float)samplePos) / dc.audioFormat.sampleRate; + total_time = ((float)samplePos) / audio_format.sampleRate; bitRate = - vbrUpdateBits * dc.audioFormat.sampleRate / 1152 / 1000; + vbrUpdateBits * audio_format.sampleRate / 1152 / 1000; decoder_data(mpd_decoder, NULL, inStream->seekable, chunk, chunkpos, total_time, bitRate, |