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/wavpack_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 '')
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 9d125f053..167278f01 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -128,6 +128,7 @@ static void wavpack_decode(struct decoder * decoder, WavpackContext *wpc, int canseek, ReplayGainInfo *replayGainInfo) { + AudioFormat audio_format; void (*format_samples)(int Bps, void *buffer, uint32_t samcnt); char chunk[CHUNK_SIZE]; float file_time; @@ -136,12 +137,12 @@ static void wavpack_decode(struct decoder * decoder, int position, outsamplesize; int Bps; - dc.audioFormat.sampleRate = WavpackGetSampleRate(wpc); - dc.audioFormat.channels = WavpackGetReducedChannels(wpc); - dc.audioFormat.bits = WavpackGetBitsPerSample(wpc); + audio_format.sampleRate = WavpackGetSampleRate(wpc); + audio_format.channels = WavpackGetReducedChannels(wpc); + audio_format.bits = WavpackGetBitsPerSample(wpc); - if (dc.audioFormat.bits > 16) - dc.audioFormat.bits = 16; + if (audio_format.bits > 16) + audio_format.bits = 16; if ((WavpackGetMode(wpc) & MODE_FLOAT) == MODE_FLOAT) format_samples = format_samples_float; @@ -159,16 +160,14 @@ static void wavpack_decode(struct decoder * decoder, outsamplesize = Bps; if (outsamplesize > 2) outsamplesize = 2; - outsamplesize *= dc.audioFormat.channels; + outsamplesize *= audio_format.channels; - samplesreq = sizeof(chunk) / (4 * dc.audioFormat.channels); + samplesreq = sizeof(chunk) / (4 * audio_format.channels); - getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); - - dc.totalTime = (float)allsamples / dc.audioFormat.sampleRate; + dc.totalTime = (float)allsamples / audio_format.sampleRate; dc.seekable = canseek; - decoder_initialized(decoder); + decoder_initialized(decoder, &audio_format); position = 0; @@ -180,7 +179,7 @@ static void wavpack_decode(struct decoder * decoder, decoder_clear(decoder); where = dc.seekWhere * - dc.audioFormat.sampleRate; + audio_format.sampleRate; if (WavpackSeekSample(wpc, where)) position = where; else @@ -202,10 +201,10 @@ static void wavpack_decode(struct decoder * decoder, 1000 + 0.5); position += samplesgot; file_time = (float)position / - dc.audioFormat.sampleRate; + audio_format.sampleRate; format_samples(Bps, chunk, - samplesgot * dc.audioFormat.channels); + samplesgot * audio_format.channels); decoder_data(decoder, NULL, 0, chunk, samplesgot * outsamplesize, |