aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 21:21:54 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 21:21:54 +0100
commit0cba1ae312bb8dcf61078ce4109a9542c69cfe73 (patch)
treee1166b053ed5c3d1cc069bdc9684902e35e60f4c
parent7b575b55c2c1184e9131888a49dfacf81cdca32c (diff)
downloadmpd-0cba1ae312bb8dcf61078ce4109a9542c69cfe73.tar.gz
mpd-0cba1ae312bb8dcf61078ce4109a9542c69cfe73.tar.xz
mpd-0cba1ae312bb8dcf61078ce4109a9542c69cfe73.zip
ogg: get decoder command from decoder_data()
Eliminate two decoder_get_command() invocations from the main loop.
Diffstat (limited to '')
-rw-r--r--src/decoder/oggvorbis_plugin.c17
1 files changed, 8 insertions, 9 deletions
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);