From 8d3942e0c3b4108e8968e914da75bf7c6c43f408 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:04 +0200 Subject: merged start, stop, seek into DecoderControl.command Much of the existing code queries all three variables sequentially. Since only one of them can be set at a time, this can be optimized and unified by merging all of them into one enum variable. Later, the "command" checks can be expressed in a "switch" statement. --- src/inputPlugins/audiofile_plugin.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/inputPlugins/audiofile_plugin.c') diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index edc2d4b90..1d4000027 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -91,12 +91,12 @@ static int audiofile_decode(char *path) char chunk[CHUNK_SIZE]; while (!eof) { - if (dc.seek) { + if (dc.command == DECODE_COMMAND_SEEK) { ob_clear(); current = dc.seekWhere * dc.audioFormat.sampleRate; afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); - dc.seek = 0; + dc.command = DECODE_COMMAND_NONE; decoder_wakeup_player(); } @@ -108,14 +108,13 @@ static int audiofile_decode(char *path) else { current += ret; ob_send(NULL, - 1, - chunk, - ret * fs, - (float)current / - (float)dc.audioFormat. - sampleRate, bitRate, - NULL); - if (dc.stop) + 1, + chunk, ret * fs, + (float)current / + (float)dc.audioFormat. + sampleRate, bitRate, + NULL); + if (dc.command == DECODE_COMMAND_STOP) break; } } -- cgit v1.2.3