Index: flacdecoder.cpp
===================================================================
--- flacdecoder.cpp	(revision 13506)
+++ flacdecoder.cpp	(working copy)
@@ -342,13 +342,29 @@
         flacok = decoder_process_single(decoder);
         decoderstate = decoder_get_state(decoder);
 
-        if (decoderstate == 0 || decoderstate == 1)
-        {
+        switch(decoderstate) {
+
+        case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+        /** The decoder is ready to search for metadata. */
+
+        case FLAC__STREAM_DECODER_READ_METADATA:
+        /** The decoder is ready to or is in the process of reading metadata. */
+
+        case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
+        /** The decoder is ready to or is in the process of searching for the
+         * frame sync code.
+         */
+
+        case FLAC__STREAM_DECODER_READ_FRAME:
+        /** The decoder is ready to or is in the process of reading a frame. */
+
             if (output())
                 flush();
-        } 
-        else 
-        {
+            break;
+
+        default:
+        // some error condition occurred, so exit the loop
+
             flush(TRUE);
 
             if (output()) {
@@ -359,8 +375,9 @@
             if (!user_stop) {
                 finish = TRUE;
             }
-        }
 
+	} // switch(decoderstate)
+
         unlock();
     }
 

