From 0cba1ae312bb8dcf61078ce4109a9542c69cfe73 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Nov 2008 21:21:54 +0100 Subject: ogg: get decoder command from decoder_data() Eliminate two decoder_get_command() invocations from the main loop. --- src/decoder/oggvorbis_plugin.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c index 32742142a..bb0c7617d 100644 --- a/src/decoder/oggvorbis_plugin.c +++ b/src/decoder/oggvorbis_plugin.c @@ -214,6 +214,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream) char **comments; const char *errorStr; bool initialized = false; + enum decoder_command cmd = DECODE_COMMAND_NONE; if (ogg_stream_type_detect(inStream) != VORBIS) return; @@ -259,8 +260,8 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream) } audio_format.bits = 16; - while (true) { - if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { + do { + if (cmd == DECODE_COMMAND_SEEK) { double seek_where = decoder_seek_where(decoder); if (0 == ov_time_seek_page(&vf, seek_where)) { decoder_command_finished(decoder); @@ -309,13 +310,11 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream) if ((test = ov_bitrate_instant(&vf)) > 0) bitRate = test / 1000; - decoder_data(decoder, inStream, - chunk, ret, - ov_pcm_tell(&vf) / audio_format.sample_rate, - bitRate, replayGainInfo); - if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) - break; - } + cmd = decoder_data(decoder, inStream, + chunk, ret, + ov_pcm_tell(&vf) / audio_format.sample_rate, + bitRate, replayGainInfo); + } while (cmd != DECODE_COMMAND_STOP); if (replayGainInfo) replay_gain_info_free(replayGainInfo); -- cgit v1.2.3