Index: mythplugins/mythmusic/mythmusic/flacdecoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/flacdecoder.cpp	(revision 13582)
+++ mythplugins/mythmusic/mythmusic/flacdecoder.cpp	(working copy)
@@ -342,23 +342,26 @@
         flacok = decoder_process_single(decoder);
         decoderstate = decoder_get_state(decoder);
 
-        if (decoderstate == 0 || decoderstate == 1)
+        if (decoderstate == STREAM_DECODER_SEARCH_FOR_METADATA ||
+            decoderstate == STREAM_DECODER_READ_METADATA ||
+            decoderstate == STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ||
+            decoderstate == STREAM_DECODER_READ_FRAME )
         {
             if (output())
                 flush();
-        } 
-        else 
+        }
+        else
         {
+            // some error condition occurred, so exit the loop
+
             flush(TRUE);
 
-            if (output()) {
-		output()->Drain();
-            }
+            if (output())
+                output()->Drain();
 
             done = TRUE;
-            if (!user_stop) {
+            if (!user_stop)
                 finish = TRUE;
-            }
         }
 
         unlock();
Index: mythplugins/mythmusic/mythmusic/flacdecoder.h
===================================================================
--- mythplugins/mythmusic/mythmusic/flacdecoder.h	(revision 13582)
+++ mythplugins/mythmusic/mythmusic/flacdecoder.h	(working copy)
@@ -42,6 +42,10 @@
   #define decoder_process_single FLAC__seekable_stream_decoder_process_single
   #define decoder_get_state FLAC__seekable_stream_decoder_get_state
   #define bytesSize unsigned
+  #define STREAM_DECODER_SEARCH_FOR_METADATA FLAC__SEEKABLE_STREAM_DECODER_OK
+  #define STREAM_DECODER_READ_METADATA FLAC__SEEKABLE_STREAM_DECODER_OK
+  #define STREAM_DECODER_SEARCH_FOR_FRAME_SYNC FLAC__SEEKABLE_STREAM_DECODER_OK
+  #define STREAM_DECODER_READ_FRAME FLAC__SEEKABLE_STREAM_DECODER_OK
 #else
   /* FLAC 1.1.3 and up */
   #define NEWFLAC
@@ -71,6 +75,10 @@
   #define decoder_process_single FLAC__stream_decoder_process_single
   #define decoder_get_state FLAC__stream_decoder_get_state
   #define bytesSize size_t
+  #define STREAM_DECODER_SEARCH_FOR_METADATA FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
+  #define STREAM_DECODER_READ_METADATA FLAC__STREAM_DECODER_READ_METADATA
+  #define STREAM_DECODER_SEARCH_FOR_FRAME_SYNC FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
+  #define STREAM_DECODER_READ_FRAME FLAC__STREAM_DECODER_READ_FRAME
 #endif
 
 #include "decoder.h"

