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/mp4_plugin.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/inputPlugins/mp4_plugin.c') diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 2731e5fbe..f70725f98 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -178,7 +178,7 @@ static int mp4_decode(InputStream * inStream) seekTable = xmalloc(sizeof(float) * numSamples); for (sampleId = 0; sampleId < numSamples && !eof; sampleId++) { - if (dc.seek) + if (dc.command == DECODE_COMMAND_SEEK) seeking = 1; if (seeking && seekTableEnd > 1 && @@ -213,7 +213,7 @@ static int mp4_decode(InputStream * inStream) seekPositionFound = 0; ob_clear(); seeking = 0; - dc.seek = 0; + dc.command = DECODE_COMMAND_NONE; decoder_wakeup_player(); } @@ -272,9 +272,9 @@ static int mp4_decode(InputStream * inStream) sampleBuffer += offset * channels * 2; ob_send(inStream, 1, sampleBuffer, - sampleBufferLen, file_time, - bitRate, NULL); - if (dc.stop) { + sampleBufferLen, file_time, + bitRate, NULL); + if (dc.command == DECODE_COMMAND_STOP) { eof = 1; break; } @@ -288,9 +288,9 @@ static int mp4_decode(InputStream * inStream) if (dc.state != DECODE_STATE_DECODE) return -1; - if (dc.seek && seeking) { + if (dc.command == DECODE_COMMAND_SEEK && seeking) { ob_clear(); - dc.seek = 0; + dc.command = DECODE_COMMAND_NONE; decoder_wakeup_player(); } ob_flush(); -- cgit v1.2.3