Index: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	(revision 4)
+++ trunk/ChangeLog	(revision 6)
@@ -1,2 +1,8 @@
+1.2.1
+    * Warnings cleanup, patch by Tomas Salfischberger, Thom Johansen and
+    Daniel Stenberg (Rockbox)
+    * Mplayer interface, patch by Reimar Doffinger
+    * Unix EOF everywhere
+
 1.2
     * 1.1.1 broke the API (BOOL type changed to mpc_bool_t). Version bumped to 1.2 to reflect the major change. Sorry to those who were caught by this error
Index: trunk/README
===================================================================
--- trunk/README	(revision 4)
+++ trunk/README	(revision 6)
@@ -1,5 +1,5 @@
-Musepack Decoder Library 1.2:
+Musepack Decoder Library:
 
-run "./configure; make"
+run "./configure [--prefix=/usr]; make"
 
 To create a sample app using the musepack decoder library in src/
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 4)
+++ trunk/configure.ac	(revision 6)
@@ -2,5 +2,5 @@
 AC_INIT(src/mpc_decoder.c)
 AC_CONFIG_AUX_DIR(config)
-AM_INIT_AUTOMAKE(libmpcdec,1.2)
+AM_INIT_AUTOMAKE(libmpcdec,1.2.1)
 AM_CONFIG_HEADER(include/config.h)
 
Index: trunk/include/mpcdec/config_types.h.in
===================================================================
--- trunk/include/mpcdec/config_types.h.in	(revision 4)
+++ trunk/include/mpcdec/config_types.h.in	(revision 6)
Index: trunk/include/mpcdec/decoder.h
===================================================================
--- trunk/include/mpcdec/decoder.h	(revision 4)
+++ trunk/include/mpcdec/decoder.h	(revision 6)
Index: trunk/include/mpcdec/huffman.h
===================================================================
--- trunk/include/mpcdec/huffman.h	(revision 4)
+++ trunk/include/mpcdec/huffman.h	(revision 6)
Index: trunk/include/mpcdec/internal.h
===================================================================
--- trunk/include/mpcdec/internal.h	(revision 4)
+++ trunk/include/mpcdec/internal.h	(revision 6)
@@ -47,8 +47,6 @@
 static __inline
 mpc_uint32_t swap32(mpc_uint32_t val) {
-    const unsigned char* src = (const unsigned char*)&val;
-    return 
-        (mpc_uint32_t)src[0] | 
-        ((mpc_uint32_t)src[1] << 8) | ((mpc_uint32_t)src[2] << 16) | ((mpc_uint32_t)src[3] << 24);
+    return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) |
+            ((val & 0x0000ff00) <<  8) | ((val & 0x000000ff) << 24));
 }
 
Index: trunk/include/mpcdec/math.h
===================================================================
--- trunk/include/mpcdec/math.h	(revision 4)
+++ trunk/include/mpcdec/math.h	(revision 6)
Index: trunk/include/mpcdec/mpcdec.h
===================================================================
--- trunk/include/mpcdec/mpcdec.h	(revision 4)
+++ trunk/include/mpcdec/mpcdec.h	(revision 6)
@@ -101,4 +101,6 @@
 mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si);
 
+void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si);
+
 /// Sets decoder sample scaling factor.  All decoded samples will be multiplied
 /// by this factor.
@@ -120,4 +122,10 @@
     mpc_uint32_t *vbr_update_bits);
 
+mpc_uint32_t mpc_decoder_decode_frame(
+    mpc_decoder *d,
+    mpc_uint32_t *in_buffer,
+    mpc_uint32_t in_len,
+    MPC_SAMPLE_FORMAT *out_buffer);
+
 /// Seeks to the specified sample in the source stream.
 mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample);
Index: trunk/include/mpcdec/reader.h
===================================================================
--- trunk/include/mpcdec/reader.h	(revision 4)
+++ trunk/include/mpcdec/reader.h	(revision 6)
Index: trunk/include/mpcdec/requant.h
===================================================================
--- trunk/include/mpcdec/requant.h	(revision 4)
+++ trunk/include/mpcdec/requant.h	(revision 6)
Index: trunk/include/mpcdec/streaminfo.h
===================================================================
--- trunk/include/mpcdec/streaminfo.h	(revision 4)
+++ trunk/include/mpcdec/streaminfo.h	(revision 6)
Index: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	(revision 4)
+++ trunk/src/Makefile.am	(revision 6)
@@ -14,5 +14,5 @@
 	streaminfo.c \
 	synth_filter.c
-libmpcdec_la_LDFLAGS = -no-undefined -version-info 3:0:0
+libmpcdec_la_LDFLAGS = -no-undefined -version-info 4:0:1
 
 noinst_PROGRAMS = sample
Index: trunk/src/huffsv46.c
===================================================================
--- trunk/src/huffsv46.c	(revision 4)
+++ trunk/src/huffsv46.c	(revision 6)
Index: trunk/src/huffsv7.c
===================================================================
--- trunk/src/huffsv7.c	(revision 4)
+++ trunk/src/huffsv7.c	(revision 6)
Index: trunk/src/idtag.c
===================================================================
--- trunk/src/idtag.c	(revision 4)
+++ trunk/src/idtag.c	(revision 6)
Index: trunk/src/mpc_decoder.c
===================================================================
--- trunk/src/mpc_decoder.c	(revision 4)
+++ trunk/src/mpc_decoder.c	(revision 6)
@@ -312,4 +312,35 @@
     memset(d->Q               , 0, sizeof d->Q                );
     memset(d->MS_Flag         , 0, sizeof d->MS_Flag          );
+}
+
+mpc_uint32_t
+mpc_decoder_decode_frame(mpc_decoder *d, mpc_uint32_t *in_buffer,
+                         mpc_uint32_t in_len, MPC_SAMPLE_FORMAT *out_buffer)
+{
+  unsigned int i;
+  mpc_decoder_reset_bitstream_decode(d);
+  if (in_len > sizeof(d->Speicher)) in_len = sizeof(d->Speicher);
+  memcpy(d->Speicher, in_buffer, in_len);
+#ifdef MPC_LITTLE_ENDIAN
+  for (i = 0; i < (in_len + 3) / 4; i++)
+    d->Speicher[i] = swap32(d->Speicher[i]);
+#endif
+  d->dword = d->Speicher[0];
+  switch (d->StreamVersion) {
+    case 0x04:
+    case 0x05:
+    case 0x06:
+        mpc_decoder_read_bitstream_sv6(d);
+        break;
+    case 0x07:
+    case 0x17:
+        mpc_decoder_read_bitstream_sv7(d);
+        break;
+    default:
+        return (mpc_uint32_t)(-1);
+  }
+  mpc_decoder_requantisierung(d, d->Max_Band);
+  mpc_decoder_synthese_filter_float(d, out_buffer);
+  return mpc_decoder_bits_read(d);
 }
 
@@ -865,8 +896,8 @@
     {
         idx   = mpc_decoder_huffman_decode_fast(d, d->HuffHdr);
-        *ResL = (idx!=4) ? *(ResL-1) + idx : mpc_decoder_bitstream_read(d, 4);
+        *ResL = (idx!=4) ? *(ResL-1) + idx : (int) mpc_decoder_bitstream_read(d, 4);
 
         idx   = mpc_decoder_huffman_decode_fast(d, d->HuffHdr);
-        *ResR = (idx!=4) ? *(ResR-1) + idx : mpc_decoder_bitstream_read(d, 4);
+        *ResR = (idx!=4) ? *(ResR-1) + idx : (int) mpc_decoder_bitstream_read(d, 4);
 
         if (d->MS_used && !(*ResL==0 && *ResR==0)) {
@@ -902,12 +933,12 @@
             case 1:
                 idx  = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
-                L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF);
-                L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 L[2] = L[1];
                 break;
             case 3:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 L[1] = L[0];
                 L[2] = L[1];
@@ -915,16 +946,16 @@
             case 2:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 L[1] = L[0];
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 break;
             case 0:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[0] = (idx!=8) ? L[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[1] = (idx!=8) ? L[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6);
+                L[2] = (idx!=8) ? L[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 break;
             default:
@@ -942,12 +973,12 @@
             case 1:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 R[2] = R[1];
                 break;
             case 3:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 R[1] = R[0];
                 R[2] = R[1];
@@ -955,16 +986,16 @@
             case 2:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 R[1] = R[0];
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 break;
             case 0:
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[0] = (idx!=8) ? R[2] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[1] = (idx!=8) ? R[0] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 idx  = mpc_decoder_huffman_decode_fast(d,  d->HuffDSCF);
-                R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6);
+                R[2] = (idx!=8) ? R[1] + idx : (int) mpc_decoder_bitstream_read(d, 6);
                 break;
             default:
@@ -1175,5 +1206,5 @@
 }
 
-static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
+void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
 {
     mpc_decoder_reset_synthesis(d);
@@ -1255,4 +1286,5 @@
 {
     mpc_uint32_t fpos = 0;
+    (void) StreamVersion;
     switch ( d->StreamVersion ) {                                                  // setting position to the beginning of the data-bitstream
     case  0x04: fpos =  48; break;
Index: trunk/src/mpc_reader.c
===================================================================
--- trunk/src/mpc_reader.c	(revision 4)
+++ trunk/src/mpc_reader.c	(revision 6)
Index: trunk/src/requant.c
===================================================================
--- trunk/src/requant.c	(revision 4)
+++ trunk/src/requant.c	(revision 6)
Index: trunk/src/sample.cpp
===================================================================
--- trunk/src/sample.cpp	(revision 4)
+++ trunk/src/sample.cpp	(revision 6)
Index: trunk/src/streaminfo.c
===================================================================
--- trunk/src/streaminfo.c	(revision 4)
+++ trunk/src/streaminfo.c	(revision 6)
@@ -64,4 +64,6 @@
 streaminfo_read_header_sv8(mpc_streaminfo * si, mpc_reader * fp)
 {
+    (void) si;
+    (void) fp;
     return 0;
 }
Index: trunk/src/synth_filter.c
===================================================================
--- trunk/src/synth_filter.c	(revision 4)
+++ trunk/src/synth_filter.c	(revision 6)
