aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-12 07:07:12 +0100
committerMax Kellermann <max@duempel.org>2008-11-12 07:07:12 +0100
commit8d1ffb16843696d7df6c25a3006d7536b25c3c5c (patch)
tree03992d578f2bdbb34295427b907dcfc022229ac3 /src
parent731e99c26ee5b865bad4e6504147c7b6aff6d94a (diff)
downloadmpd-8d1ffb16843696d7df6c25a3006d7536b25c3c5c.tar.gz
mpd-8d1ffb16843696d7df6c25a3006d7536b25c3c5c.tar.xz
mpd-8d1ffb16843696d7df6c25a3006d7536b25c3c5c.zip
mpc: get decoder command from decoder_data()
Removed 3 superfluous decoder_get_command() invocations.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/mpc_plugin.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index f3e54f4d2..34400f153 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -123,6 +123,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
mpc_uint32_t vbrUpdateBits;
float total_time;
struct replay_gain_info *replayGainInfo = NULL;
+ enum decoder_command cmd = DECODE_COMMAND_NONE;
data.inStream = inStream;
data.decoder = mpd_decoder;
@@ -164,8 +165,8 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
inStream->seekable,
mpc_streaminfo_get_length(&info));
- while (true) {
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) {
+ do {
+ if (cmd == DECODE_COMMAND_SEEK) {
samplePos = decoder_seek_where(mpd_decoder) *
audio_format.sample_rate;
if (mpc_decoder_seek_sample(&decoder, samplePos))
@@ -178,8 +179,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
vbrUpdateBits = 0;
ret = mpc_decoder_decode(&decoder, sample_buffer,
&vbrUpdateAcc, &vbrUpdateBits);
-
- if (ret <= 0 || decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP)
+ if (ret <= 0)
break;
samplePos += ret;
@@ -193,14 +193,11 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
bitRate = vbrUpdateBits * audio_format.sample_rate
/ 1152 / 1000;
- decoder_data(mpd_decoder, inStream,
- chunk, ret * sizeof(chunk[0]),
- total_time,
- bitRate, replayGainInfo);
-
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP)
- break;
- }
+ cmd = decoder_data(mpd_decoder, inStream,
+ chunk, ret * sizeof(chunk[0]),
+ total_time,
+ bitRate, replayGainInfo);
+ } while (cmd != DECODE_COMMAND_STOP);
replay_gain_info_free(replayGainInfo);
}