diff options
author | Max Kellermann <max@duempel.org> | 2008-11-02 17:02:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-02 17:02:23 +0100 |
commit | 5b13f067cd38b23e567acf16fd8506dcbdad9b31 (patch) | |
tree | a0421061964b1d29fd2cf87eec5d6fd45842aee4 /src/decoder/mod_plugin.c | |
parent | 3f6fcfd38ebe115d1ba77a7e5b3c1c757b806814 (diff) | |
download | mpd-5b13f067cd38b23e567acf16fd8506dcbdad9b31.tar.gz mpd-5b13f067cd38b23e567acf16fd8506dcbdad9b31.tar.xz mpd-5b13f067cd38b23e567acf16fd8506dcbdad9b31.zip |
aac, mod: moved decoder command check into loop condition
Avoid while(true) loops, and convert them to a loop with a proper
condition.
Diffstat (limited to 'src/decoder/mod_plugin.c')
-rw-r--r-- | src/decoder/mod_plugin.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c index 11a59f94c..3575fdf56 100644 --- a/src/decoder/mod_plugin.c +++ b/src/decoder/mod_plugin.c @@ -179,6 +179,7 @@ mod_decode(struct decoder *decoder, const char *path) float total_time = 0.0; int ret; float secPerByte; + enum decoder_command cmd = DECODE_COMMAND_NONE; if (!mod_initMikMod()) return false; @@ -199,18 +200,12 @@ mod_decode(struct decoder *decoder, const char *path) decoder_initialized(decoder, &audio_format, false, 0); - while (true) { - if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) - break; - - if (!Player_Active()) - break; - + while (cmd == DECODE_COMMAND_NONE && Player_Active()) { ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE); total_time += ret * secPerByte; - decoder_data(decoder, NULL, - (char *)data->audio_buffer, ret, - total_time, 0, NULL); + cmd = decoder_data(decoder, NULL, + data->audio_buffer, ret, + total_time, 0, NULL); } mod_close(data); |