Index: trunk/src/mpc_decoder.c
===================================================================
--- trunk/src/mpc_decoder.c	(revision 3)
+++ 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;
