Index: xmms-musepack/trunk/src/libmpc.cpp
===================================================================
--- xmms-musepack/trunk/src/libmpc.cpp	(revision 79)
+++ xmms-musepack/trunk/src/libmpc.cpp	(revision 102)
@@ -326,14 +326,19 @@
 static void mpcGetSongInfo(char* p_Filename, char** p_Title, int* p_Length)
 {
-	mpc_reader reader;
-	if (mpc_reader_init_stdio(&reader, p_Filename) == MPC_STATUS_OK) {
+    FILE* input = fopen(p_Filename, "rb");
+    if(input)
+    {
         MpcInfo tags = getTags(p_Filename);
         *p_Title = mpcGenerateTitle(tags, p_Filename);
         freeTags(tags);
         mpc_streaminfo info;
-		mpc_streaminfo_init(&info, &reader);
+        mpc_reader_file reader;
+        mpc_reader_setup_file_reader(&reader, input);
+        mpc_streaminfo_read(&info, &reader.reader);
         *p_Length = static_cast<int> (1000 * mpc_streaminfo_get_length(&info));
-		mpc_reader_exit_stdio(&reader);
-    } else {
+        fclose(input);
+    }
+    else
+    {
         char* temp = g_strdup_printf("[xmms-musepack] mpcGetSongInfo is unable to open %s\n", p_Filename);
         perror(temp);
@@ -521,8 +526,11 @@
         GtkWidget* albumGainLabel = mpcGtkLabel(infoVbox);
 
-		mpc_reader reader;
-		if (mpc_reader_init_stdio(&reader, p_Filename) == MPC_STATUS_OK) {
+        FILE* input = fopen(p_Filename, "rb");
+        if(input)
+        {
             mpc_streaminfo info;
-			mpc_streaminfo_init(&info, &reader);
+            mpc_reader_file reader;
+            mpc_reader_setup_file_reader(&reader, input);
+            mpc_streaminfo_read(&info, &reader.reader);
 
             int time = static_cast<int> (mpc_streaminfo_get_length(&info));
@@ -559,5 +567,5 @@
             free(entry);
             freeTags(tags);
-			mpc_reader_exit_stdio(&reader);
+            fclose(input);
         }
         else
@@ -746,15 +754,19 @@
     lockAcquire();
     const char* filename = static_cast<const char*> (data);
-	mpc_reader reader;
-	if (mpc_reader_init_stdio(&reader, filename) != MPC_STATUS_OK) {
+    FILE* input = fopen(filename, "rb");
+    if (!input)
+    {
         mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to open %s", filename);
-        return endThread(0, true);
-    }
+        return endThread(input, true);
+    }
+
+    mpc_reader_file reader;
+    mpc_reader_setup_file_reader(&reader, input);
 
     mpc_streaminfo info;
-	if (mpc_streaminfo_init(&info, &reader) != MPC_STATUS_OK) {
+    if (mpc_streaminfo_read(&info, &reader.reader) != ERROR_CODE_OK)
+    {
         mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to read %s", filename);
-		mpc_reader_exit_stdio(&reader);
-        return endThread(0, true);
+        return endThread(input, true);
     }
 
@@ -769,13 +781,14 @@
     MpcPlugin.set_info(track.display, track.length, track.bitrate, track.sampleFreq, track.channels);
 
-    mpc_decoder * decoder;
-	if (mpc_decoder_init(&decoder, &reader, &info) != MPC_STATUS_OK) {
+    mpc_decoder decoder;
+    mpc_decoder_setup(&decoder, &reader.reader);
+    if (!mpc_decoder_initialize(&decoder, &info))
+    {
         mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to initialize decoder on %s", filename);
-		mpc_reader_exit_stdio(&reader);
-        return endThread(0, true);
-    }
-
-	mpc_decoder_set_seeking(decoder, &info, pluginConfig.fastSeek);
-    setReplaygain(info, *decoder);
+        return endThread(input, true);
+    }
+
+    mpc_decoder_set_seeking(&decoder, &info, pluginConfig.fastSeek);
+    setReplaygain(info, decoder);
 
     MPC_SAMPLE_FORMAT sampleBuffer[MPC_DECODER_BUFFER_LENGTH];
@@ -784,7 +797,6 @@
     if (!MpcPlugin.output->open_audio(FMT_S16_LE, track.sampleFreq, track.channels))
     {
-		mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to open an audio output");
-		mpc_reader_exit_stdio(&reader);
-        return endThread(0, true);
+        mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to open an audio output");
+        return endThread(input, true);
     }
     else
@@ -800,5 +812,5 @@
         if (getOffset() != -1)
         {
-            mpc_decoder_seek_seconds(decoder, mpcDecoder.offset);
+            mpc_decoder_seek_seconds(&decoder, mpcDecoder.offset);
             setOffset(-1);
         }
@@ -809,16 +821,14 @@
         if (!mpcDecoder.isPause &&  iFree >= ((1152 * 4) << iPlaying))
         {
-            unsigned status = processBuffer(sampleBuffer, xmmsBuffer, *decoder);
+            unsigned status = processBuffer(sampleBuffer, xmmsBuffer, decoder);
             if (status == (unsigned) (-1))
             {
-				mpcDecoder.isError = g_strdup_printf("[xmms-musepack] error from internal decoder on %s", filename);
-				mpc_reader_exit_stdio(&reader);
-                return endThread(0, true);
+                mpcDecoder.isError = g_strdup_printf("[xmms-musepack] error from internal decoder on %s", filename);
+                return endThread(input, true);
             }
 	    else if (status == 0)
             {
                 //mpcDecoder.isError = g_strdup_printf("[xmms-musepack] null output from internal decoder on %s", filename);
-				mpc_reader_exit_stdio(&reader);
-                return endThread(0, true);
+                return endThread(input, true);
             }
             lockRelease();
@@ -839,7 +849,6 @@
             xmms_usleep(10000);
         }
-	}
-	mpc_reader_exit_stdio(&reader);
-    return endThread(0, false);
+    }
+    return endThread(input, false);
 }
 
