diff options
author | Max Kellermann <max@duempel.org> | 2011-07-19 22:32:48 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-07-20 12:32:48 +0200 |
commit | e464be5f3922d87942a3afd0f7e9239b89901f2e (patch) | |
tree | bd6568745d68bcedce429d2b010c9d5aa448040c /src | |
parent | d7d717f2ce096015527593f8e163dc3d59cf91fc (diff) | |
download | mpd-e464be5f3922d87942a3afd0f7e9239b89901f2e.tar.gz mpd-e464be5f3922d87942a3afd0f7e9239b89901f2e.tar.xz mpd-e464be5f3922d87942a3afd0f7e9239b89901f2e.zip |
decoder/wavpack: simplify the WavpackUnpackSamples()==0 check
.. and remove one indent level.
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/wavpack_decoder_plugin.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c index efed98851..601f05065 100644 --- a/src/decoder/wavpack_decoder_plugin.c +++ b/src/decoder/wavpack_decoder_plugin.c @@ -197,7 +197,7 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek) decoder_initialized(decoder, &audio_format, can_seek, total_time); - do { + while (true) { if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { if (can_seek) { unsigned where = decoder_seek_where(decoder) * @@ -220,22 +220,19 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek) samples_got = WavpackUnpackSamples( wpc, (int32_t *)chunk, samples_requested ); - if (samples_got > 0) { - int bitrate = (int)(WavpackGetInstantBitrate(wpc) / - 1000 + 0.5); - - format_samples( - bytes_per_sample, chunk, - samples_got * audio_format.channels - ); - - decoder_data( - decoder, NULL, chunk, - samples_got * output_sample_size, - bitrate - ); - } - } while (samples_got > 0); + + if (samples_got == 0) + break; + + int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 + + 0.5); + format_samples(bytes_per_sample, chunk, + samples_got * audio_format.channels); + + decoder_data(decoder, NULL, chunk, + samples_got * output_sample_size, + bitrate); + } } /** |