Index: libmpc/branches/r2d/include/mpc/mpc_types.h
===================================================================
--- libmpc/branches/r2d/include/mpc/mpc_types.h	(revision 185)
+++ libmpc/branches/r2d/include/mpc/mpc_types.h	(revision 195)
@@ -70,6 +70,9 @@
 typedef int mpc_int_t;
 typedef unsigned int mpc_uint_t;
-// FIXME : must be the same size as a pointer
 typedef size_t mpc_size_t;
+typedef mpc_uint8_t mpc_bool_t;
+
+# define mpc_int64_min -9223372036854775808ll
+# define mpc_int64_max 9223372036854775807ll
 
 /// Libmpcdec error codes
@@ -90,6 +93,4 @@
 #endif
 
-typedef mpc_uint8_t mpc_bool_t;
-
 enum {
     MPC_FALSE = 0,
@@ -97,4 +98,15 @@
 };
 
+//// 'Cdecl' forces the use of standard C/C++ calling convention ///////
+#if   defined _WIN32
+# define mpc_cdecl           __cdecl
+#elif defined __ZTC__
+# define mpc_cdecl           _cdecl
+#elif defined __TURBOC__
+# define mpc_cdecl           cdecl
+#else
+# define mpc_cdecl
+#endif
+
 #ifdef __cplusplus
 }
Index: libmpc/branches/r2d/include/mpc/mpcdec.h
===================================================================
--- libmpc/branches/r2d/include/mpc/mpcdec.h	(revision 195)
+++ libmpc/branches/r2d/include/mpc/mpcdec.h	(revision 195)
@@ -0,0 +1,116 @@
+/*
+  Copyright (c) 2005, The Musepack Development Team
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+
+  * Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the following
+  disclaimer in the documentation and/or other materials provided
+  with the distribution.
+
+  * Neither the name of the The Musepack Development Team nor the
+  names of its contributors may be used to endorse or promote
+  products derived from this software without specific prior
+  written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/// \file mpcdec.h
+/// Top level include file for libmpcdec.
+#ifndef _MPCDEC_H_
+#define _MPCDEC_H_
+#ifdef WIN32
+#pragma once
+#endif
+
+#include "streaminfo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    MPC_FRAME_LENGTH          = (36 * 32),              ///< Samples per mpc frame
+    MPC_DECODER_BUFFER_LENGTH = (MPC_FRAME_LENGTH * 4), ///< Required buffer size for decoder
+    MPC_DECODER_SYNTH_DELAY   = 481
+};
+
+typedef struct mpc_decoder_t mpc_decoder;
+typedef struct mpc_bits_reader_t mpc_bits_reader;
+typedef struct mpc_demux_t mpc_demux;
+
+typedef struct mpc_frame_info_t {
+	mpc_uint32_t samples;	/// number of samples in the frame (counting once for multiple channels)
+	mpc_int32_t bits;	/// number of bits consumed by this frame (-1) if end of stream
+	MPC_SAMPLE_FORMAT * buffer;	/// frame samples buffer (size = samples * channels * sizeof(MPC_SAMPLE_FORMAT))
+	mpc_bool_t is_key_frame; /// 1 if this frame is a key frame (first in block) 0 else. Set by the demuxer.
+} mpc_frame_info;
+
+/// Initializes mpc decoder with the supplied stream info parameters.
+/// \param si streaminfo structure indicating format of source stream
+/// \return pointer on the initialized decoder structure if successful, 0 if not
+mpc_decoder * mpc_decoder_init(mpc_streaminfo *si);
+
+/// Releases input mpc decoder
+void mpc_decoder_exit(mpc_decoder *p_dec);
+
+/// Call this next after calling mpc_decoder_setup.
+/// \param si streaminfo structure indicating format of source stream
+/// \param fast_seeking boolean 0 = use fast seeking if safe, 1 = force fast seeking
+// void mpc_decoder_set_seeking(mpc_decoder *p_dec, mpc_streaminfo *si, mpc_bool_t fast_seeking);
+
+/**
+ * set the scf indexes for seeking use
+ * needed only for sv7 seeking
+ * @param d
+ */
+void mpc_decoder_reset_scf(mpc_decoder * d);
+
+/// Sets decoder sample scaling factor.  All decoded samples will be multiplied
+/// by this factor.
+/// \param scale_factor multiplicative scaling factor
+void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor);
+
+/// Actually reads data from previously initialized stream.  Call
+/// this iteratively to decode the mpc stream.
+/// \param buffer destination buffer for decoded samples
+/// \param vbr_update_acc \todo document me
+/// \param vbr_update_bits \todo document me
+/// \return -1 if an error is encountered
+/// \return 0 if the stream has been completely decoded successfully and there are no more samples
+/// \return > 0 to indicate the number of bytes that were actually read from the stream.
+void mpc_decoder_decode_frame(mpc_decoder * d, mpc_bits_reader * r, mpc_frame_info * i);
+
+// init demuxer
+mpc_demux * mpc_demux_init(mpc_reader * p_reader);
+// free demuxer
+void mpc_demux_exit(mpc_demux * d);
+// decode frame
+void mpc_demux_decode(mpc_demux * d, mpc_frame_info * i);
+// get streaminfo
+void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i);
+// seek
+mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample);
+mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: libmpc/branches/r2d/include/mpc/reader.h
===================================================================
--- libmpc/branches/r2d/include/mpc/reader.h	(revision 195)
+++ libmpc/branches/r2d/include/mpc/reader.h	(revision 195)
@@ -0,0 +1,90 @@
+/*
+  Copyright (c) 2005, The Musepack Development Team
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+
+  * Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the following
+  disclaimer in the documentation and/or other materials provided
+  with the distribution.
+
+  * Neither the name of the The Musepack Development Team nor the
+  names of its contributors may be used to endorse or promote
+  products derived from this software without specific prior
+  written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/// \file reader.h
+#ifndef _MPCDEC_READER_H_
+#define _MPCDEC_READER_H_
+#ifdef WIN32
+#pragma once
+#endif
+
+#include <mpc/mpc_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/// \brief Stream reader interface structure.
+///
+/// This is the structure you must supply to the musepack decoding library
+/// to feed it with raw data.  Implement the five member functions to provide
+/// a functional reader.
+typedef struct mpc_reader_t mpc_reader;
+struct mpc_reader_t {
+    /// Reads size bytes of data into buffer at ptr.
+    mpc_int32_t (*read)(mpc_reader *p_reader, void *ptr, mpc_int32_t size);
+
+    /// Seeks to byte position offset.
+    mpc_bool_t (*seek)(mpc_reader *p_reader, mpc_int32_t offset);
+
+    /// Returns the current byte offset in the stream.
+    mpc_int32_t (*tell)(mpc_reader *p_reader);
+
+    /// Returns the total length of the source stream, in bytes.
+    mpc_int32_t (*get_size)(mpc_reader *p_reader);
+
+    /// True if the stream is a seekable stream.
+    mpc_bool_t (*canseek)(mpc_reader *p_reader);
+
+    /// Field that can be used to identify a particular instance of
+    /// reader or carry along data associated with that reader.
+    void *data;
+};
+
+/// Initializes reader with default stdio file reader implementation.  Use
+/// this if you're just reading from a plain file.
+///
+/// \param r p_reader handle to initialize
+/// \param filename input filename to attach to the reader
+mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename);
+
+/// Release reader with default stdio file reader implementation.
+///
+/// \param r reader handle to release
+void mpc_reader_exit_stdio(mpc_reader *p_reader);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: libmpc/branches/r2d/include/mpc/streaminfo.h
===================================================================
--- libmpc/branches/r2d/include/mpc/streaminfo.h	(revision 195)
+++ libmpc/branches/r2d/include/mpc/streaminfo.h	(revision 195)
@@ -0,0 +1,109 @@
+/*
+  Copyright (c) 2005, The Musepack Development Team
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+
+  * Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the following
+  disclaimer in the documentation and/or other materials provided
+  with the distribution.
+
+  * Neither the name of the The Musepack Development Team nor the
+  names of its contributors may be used to endorse or promote
+  products derived from this software without specific prior
+  written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/// \file streaminfo.h
+#ifndef _MPCDEC_STREAMINFO_H_
+#define _MPCDEC_STREAMINFO_H_
+#ifdef WIN32
+#pragma once
+#endif
+
+#include <mpc/mpc_types.h>
+#include "reader.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef mpc_int32_t mpc_streaminfo_off_t;
+
+/// \brief mpc stream properties structure
+///
+/// Structure containing all the properties of an mpc stream.  Populated
+/// by the streaminfo_read function.
+typedef struct mpc_streaminfo {
+    /// @name Core mpc stream properties
+    //@{
+    mpc_uint32_t         sample_freq;        ///< Sample frequency of stream
+    mpc_uint32_t         channels;           ///< Number of channels in stream
+    mpc_uint32_t         stream_version;     ///< Streamversion of stream
+    mpc_uint32_t         bitrate;            ///< Bitrate of stream file (in bps)
+    double               average_bitrate;    ///< Average bitrate of stream (in bits/sec)
+    mpc_uint32_t         max_band;           ///< Maximum band-index used in stream (0...31)
+    mpc_uint32_t         ms;                 ///< Mid/side stereo (0: off, 1: on)
+	mpc_uint32_t         fast_seek;          ///< True if stream supports fast-seeking (sv7)
+	mpc_uint32_t         block_pwr;          ///< Number of frames in a block = 2^block_pwr (sv8)
+    //@}
+
+    /// @name Replaygain properties
+    //@{
+    mpc_int16_t          gain_title;         ///< Replaygain title value
+    mpc_int16_t          gain_album;         ///< Replaygain album value
+    mpc_uint16_t         peak_album;         ///< Peak album loudness level
+    mpc_uint16_t         peak_title;         ///< Peak title loudness level
+    //@}
+
+    /// @name True gapless properties
+    //@{
+    mpc_uint32_t         is_true_gapless;    ///< True gapless? (0: no, 1: yes)
+	mpc_uint64_t         samples;            ///< Number of samples in the stream
+    //@}
+
+	/// @name Encoder informations
+    //@{
+    mpc_uint32_t         encoder_version;    ///< Version of encoder used
+    char                 encoder[256];       ///< Encoder name
+	mpc_bool_t           pns;                ///< pns used
+	mpc_uint32_t         profile;            ///< Quality profile of stream
+	const char*          profile_name;       ///< Name of profile used by stream
+	//@}
+
+
+	mpc_streaminfo_off_t header_position;    ///< Byte offset of position of header in stream
+    mpc_streaminfo_off_t tag_offset;         ///< Offset to file tags
+    mpc_streaminfo_off_t total_file_length;  ///< Total length of underlying file
+} mpc_streaminfo;
+
+/// Gets length of stream si, in seconds.
+/// \return length of stream in seconds
+double mpc_streaminfo_get_length(mpc_streaminfo *si);
+
+/// Returns length of stream si, in samples.
+/// \return length of stream in samples
+mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
