aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/aac_plugin.c12
-rw-r--r--src/decoder/mod_plugin.c15
2 files changed, 9 insertions, 18 deletions
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index e7054b879..7961865b2 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -363,7 +363,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
advanceAacBuffer(&b, bread);
- while (true) {
+ do {
fillAacBuffer(&b);
adts_find_frame(&b);
fillAacBuffer(&b);
@@ -414,9 +414,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
decoder_data(mpd_decoder, NULL, sampleBuffer,
sampleBufferLen, file_time,
bitRate, NULL);
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP)
- break;
- }
+ } while (decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE);
faacDecClose(decoder);
if (b.buffer)
@@ -495,7 +493,7 @@ aac_decode(struct decoder *mpd_decoder, const char *path)
advanceAacBuffer(&b, bread);
- while (true) {
+ do {
fillAacBuffer(&b);
if (b.bytesIntoBuffer == 0)
@@ -544,9 +542,7 @@ aac_decode(struct decoder *mpd_decoder, const char *path)
decoder_data(mpd_decoder, NULL, sampleBuffer,
sampleBufferLen, file_time,
bitRate, NULL);
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP)
- break;
- }
+ } while (decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE);
faacDecClose(decoder);
if (b.buffer)
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);