[SCM] deadbeef/master: Update and refresh patches

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Mon Jan 3 15:10:49 UTC 2011


The following commit has been merged in the master branch:
commit 08c2b921fcd97b807f951a641825a995022de300
Author: Alessandro Ghedini <al3xbio at gmail.com>
Date:   Mon Jan 3 12:34:30 2011 +0100

    Update and refresh patches

diff --git a/debian/patches/0002-fix-spelling-error.patch b/debian/patches/0002-fix-spelling-error.patch
deleted file mode 100644
index 62db971..0000000
--- a/debian/patches/0002-fix-spelling-error.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From: Alessandro Ghedini <al3xbio at gmail.com>
-Date: Thu, 2 Dec 2010 16:07:08 +0100
-Subject: [PATCH] fix spelling error
-
-Change the spelling error Psychadelic to Psychedelic
----
- junklib.c                   |    2 +-
- plugins/aac/mp4ff/mp4meta.c |    2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/junklib.c b/junklib.c
-index 254f994..bb88179 100644
---- a/junklib.c
-+++ b/junklib.c
-@@ -256,7 +256,7 @@ static const char *junk_genretbl[] = {
-     "Native American",
-     "Cabaret",
-     "New Wave",
--    "Psychadelic",
-+    "Psychedelic",
-     "Rave",
-     "Showtunes",
-     "Trailer",
-diff --git a/plugins/aac/mp4ff/mp4meta.c b/plugins/aac/mp4ff/mp4meta.c
-index a0c1b7e..f902322 100644
---- a/plugins/aac/mp4ff/mp4meta.c
-+++ b/plugins/aac/mp4ff/mp4meta.c
-@@ -115,7 +115,7 @@ static const char* ID3v1GenreList[] = {
-     "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk",
-     "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
-     "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
--    "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
-+    "New Wave", "Psychedelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
-     "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical",
-     "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing",
-     "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
--- 
diff --git a/debian/patches/0003-remove-deadbeef.desktop-file.patch b/debian/patches/0002-remove-deadbeef.desktop-file.patch
similarity index 100%
rename from debian/patches/0003-remove-deadbeef.desktop-file.patch
rename to debian/patches/0002-remove-deadbeef.desktop-file.patch
diff --git a/debian/patches/0004-add-quilt-file-to-POTFILES-skip.patch b/debian/patches/0003-add-quilt-file-to-POTFILES-skip.patch
similarity index 100%
rename from debian/patches/0004-add-quilt-file-to-POTFILES-skip.patch
rename to debian/patches/0003-add-quilt-file-to-POTFILES-skip.patch
diff --git a/debian/patches/0004-use-system-libmpcdec.patch b/debian/patches/0004-use-system-libmpcdec.patch
new file mode 100644
index 0000000..e472c1c
--- /dev/null
+++ b/debian/patches/0004-use-system-libmpcdec.patch
@@ -0,0 +1,136 @@
+From: Alessandro Ghedini <al3xbio at gmail.com>
+Date: Tue, 7 Dec 2010 18:39:59 +0100
+Subject: [PATCH] use system libmpcdec
+
+Make the build system use the system libmpcdec instead of the bundled one
+---
+ plugins/musepack/Makefile.am |   26 ++--------------------
+ plugins/musepack/Makefile.in |   47 ++++-------------------------------------
+ plugins/musepack/musepack.c  |    2 +-
+ 3 files changed, 9 insertions(+), 66 deletions(-)
+
+diff --git a/plugins/musepack/Makefile.am b/plugins/musepack/Makefile.am
+index 213fee3..1e7c419 100644
+--- a/plugins/musepack/Makefile.am
++++ b/plugins/musepack/Makefile.am
+@@ -2,30 +2,10 @@ if HAVE_MUSEPACK
+ 
+ pkglib_LTLIBRARIES = musepack.la
+ 
+-musepack_la_SOURCES = musepack.c\
+-huffman.c\
+-mpc_bits_reader.c\
+-mpc_decoder.c\
+-mpc_demux.c\
+-mpc_reader.c\
+-requant.c\
+-streaminfo.c\
+-synth_filter.c\
+-crc32.c\
+-decoder.h\
+-huffman.h\
+-internal.h\
+-mpc_bits_reader.h\
+-mpc/mpcdec.h\
+-mpcdec_math.h\
+-mpc/reader.h\
+-requant.h\
+-mpc/streaminfo.h\
+-mpc/mpc_types.h\
+-mpc/minimax.h
++musepack_la_SOURCES = musepack.c
+ 
+-musepack_la_LDFLAGS = -module
+-musepack_la_LIBADD = $(LDADD) -lm
++musepack_la_LDFLAGS = -module -lm -lmpcdec
++musepack_la_LIBADD = $(LDADD)
+ 
+ AM_CFLAGS = $(CFLAGS) -fPIC
+ 
+diff --git a/plugins/musepack/Makefile.in b/plugins/musepack/Makefile.in
+index 988a0a0..6d0a0ff 100644
+--- a/plugins/musepack/Makefile.in
++++ b/plugins/musepack/Makefile.in
+@@ -69,15 +69,8 @@ am__base_list = \
+ am__installdirs = "$(DESTDIR)$(pkglibdir)"
+ LTLIBRARIES = $(pkglib_LTLIBRARIES)
+ musepack_la_DEPENDENCIES =
+-am__musepack_la_SOURCES_DIST = musepack.c huffman.c mpc_bits_reader.c \
+-	mpc_decoder.c mpc_demux.c mpc_reader.c requant.c streaminfo.c \
+-	synth_filter.c crc32.c decoder.h huffman.h internal.h \
+-	mpc_bits_reader.h mpc/mpcdec.h mpcdec_math.h mpc/reader.h \
+-	requant.h mpc/streaminfo.h mpc/mpc_types.h mpc/minimax.h
+- at HAVE_MUSEPACK_TRUE@am_musepack_la_OBJECTS = musepack.lo huffman.lo \
+- at HAVE_MUSEPACK_TRUE@	mpc_bits_reader.lo mpc_decoder.lo \
+- at HAVE_MUSEPACK_TRUE@	mpc_demux.lo mpc_reader.lo requant.lo \
+- at HAVE_MUSEPACK_TRUE@	streaminfo.lo synth_filter.lo crc32.lo
++am__musepack_la_SOURCES_DIST = musepack.c
++ at HAVE_MUSEPACK_TRUE@am_musepack_la_OBJECTS = musepack.lo
+ musepack_la_OBJECTS = $(am_musepack_la_OBJECTS)
+ musepack_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+@@ -311,30 +304,9 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @HAVE_MUSEPACK_TRUE at pkglib_LTLIBRARIES = musepack.la
+- at HAVE_MUSEPACK_TRUE@musepack_la_SOURCES = musepack.c\
+- at HAVE_MUSEPACK_TRUE@huffman.c\
+- at HAVE_MUSEPACK_TRUE@mpc_bits_reader.c\
+- at HAVE_MUSEPACK_TRUE@mpc_decoder.c\
+- at HAVE_MUSEPACK_TRUE@mpc_demux.c\
+- at HAVE_MUSEPACK_TRUE@mpc_reader.c\
+- at HAVE_MUSEPACK_TRUE@requant.c\
+- at HAVE_MUSEPACK_TRUE@streaminfo.c\
+- at HAVE_MUSEPACK_TRUE@synth_filter.c\
+- at HAVE_MUSEPACK_TRUE@crc32.c\
+- at HAVE_MUSEPACK_TRUE@decoder.h\
+- at HAVE_MUSEPACK_TRUE@huffman.h\
+- at HAVE_MUSEPACK_TRUE@internal.h\
+- at HAVE_MUSEPACK_TRUE@mpc_bits_reader.h\
+- at HAVE_MUSEPACK_TRUE@mpc/mpcdec.h\
+- at HAVE_MUSEPACK_TRUE@mpcdec_math.h\
+- at HAVE_MUSEPACK_TRUE@mpc/reader.h\
+- at HAVE_MUSEPACK_TRUE@requant.h\
+- at HAVE_MUSEPACK_TRUE@mpc/streaminfo.h\
+- at HAVE_MUSEPACK_TRUE@mpc/mpc_types.h\
+- at HAVE_MUSEPACK_TRUE@mpc/minimax.h
+-
+- at HAVE_MUSEPACK_TRUE@musepack_la_LDFLAGS = -module
+- at HAVE_MUSEPACK_TRUE@musepack_la_LIBADD = $(LDADD) -lm
++ at HAVE_MUSEPACK_TRUE@musepack_la_SOURCES = musepack.c
++ at HAVE_MUSEPACK_TRUE@musepack_la_LDFLAGS = -module -lm -lmpcdec
++ at HAVE_MUSEPACK_TRUE@musepack_la_LIBADD = $(LDADD)
+ @HAVE_MUSEPACK_TRUE at AM_CFLAGS = $(CFLAGS) -fPIC
+ all: all-am
+ 
+@@ -410,16 +382,7 @@ mostlyclean-compile:
+ distclean-compile:
+ 	-rm -f *.tab.c
+ 
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crc32.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_bits_reader.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_decoder.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_demux.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_reader.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/musepack.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/requant.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/streaminfo.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/synth_filter.Plo at am__quote@
+ 
+ .c.o:
+ @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+diff --git a/plugins/musepack/musepack.c b/plugins/musepack/musepack.c
+index 69d1802..7ad0a5b 100644
+--- a/plugins/musepack/musepack.c
++++ b/plugins/musepack/musepack.c
+@@ -21,7 +21,7 @@
+ #include <limits.h>
+ #include <unistd.h>
+ #include <math.h>
+-#include "mpc/mpcdec.h"
++#include <mpc/mpcdec.h>
+ #ifdef HAVE_CONFIG_H
+ #  include <config.h>
+ #endif
+-- 
diff --git a/debian/patches/0005-remove-bundled-libmpcdec.patch b/debian/patches/0005-remove-bundled-libmpcdec.patch
deleted file mode 100644
index e099d41..0000000
--- a/debian/patches/0005-remove-bundled-libmpcdec.patch
+++ /dev/null
@@ -1,4914 +0,0 @@
-From: Alessandro Ghedini <al3xbio at gmail.com>
-Date: Tue, 7 Dec 2010 18:39:59 +0100
-Subject: [PATCH] remove bundled libmpcdec
-
-Removes the bundled libmpc under plugins/musepack and plugins/musepack/mpc
-and update references
----
- plugins/musepack/Makefile.am       |   26 +--
- plugins/musepack/Makefile.in       |  655 ----------------------------------
- plugins/musepack/crc32.c           |   56 ---
- plugins/musepack/decoder.h         |  101 ------
- plugins/musepack/huffman.c         |  358 -------------------
- plugins/musepack/huffman.h         |   83 -----
- plugins/musepack/internal.h        |   94 -----
- plugins/musepack/mpc/minimax.h     |   57 ---
- plugins/musepack/mpc/mpc_types.h   |  138 --------
- plugins/musepack/mpc/mpcdec.h      |  148 --------
- plugins/musepack/mpc/reader.h      |   98 -----
- plugins/musepack/mpc/streaminfo.h  |  109 ------
- plugins/musepack/mpc_bits_reader.c |  179 ----------
- plugins/musepack/mpc_bits_reader.h |  149 --------
- plugins/musepack/mpc_decoder.c     |  681 ------------------------------------
- plugins/musepack/mpc_demux.c       |  661 ----------------------------------
- plugins/musepack/mpc_reader.c      |  144 --------
- plugins/musepack/mpcdec_math.h     |  135 -------
- plugins/musepack/musepack.c        |    2 +-
- plugins/musepack/requant.c         |  124 -------
- plugins/musepack/requant.h         |   61 ----
- plugins/musepack/streaminfo.c      |  244 -------------
- plugins/musepack/synth_filter.c    |  430 -----------------------
- 23 files changed, 4 insertions(+), 4729 deletions(-)
- delete mode 100644 plugins/musepack/Makefile.in
- delete mode 100644 plugins/musepack/crc32.c
- delete mode 100644 plugins/musepack/decoder.h
- delete mode 100644 plugins/musepack/huffman.c
- delete mode 100644 plugins/musepack/huffman.h
- delete mode 100644 plugins/musepack/internal.h
- delete mode 100644 plugins/musepack/mpc/minimax.h
- delete mode 100644 plugins/musepack/mpc/mpc_types.h
- delete mode 100644 plugins/musepack/mpc/mpcdec.h
- delete mode 100644 plugins/musepack/mpc/reader.h
- delete mode 100644 plugins/musepack/mpc/streaminfo.h
- delete mode 100644 plugins/musepack/mpc_bits_reader.c
- delete mode 100644 plugins/musepack/mpc_bits_reader.h
- delete mode 100644 plugins/musepack/mpc_decoder.c
- delete mode 100644 plugins/musepack/mpc_demux.c
- delete mode 100644 plugins/musepack/mpc_reader.c
- delete mode 100644 plugins/musepack/mpcdec_math.h
- delete mode 100644 plugins/musepack/requant.c
- delete mode 100644 plugins/musepack/requant.h
- delete mode 100644 plugins/musepack/streaminfo.c
- delete mode 100644 plugins/musepack/synth_filter.c
-
-Index: deadbeef/plugins/musepack/Makefile.am
-===================================================================
---- deadbeef.orig/plugins/musepack/Makefile.am	2010-12-08 16:27:44.325000059 +0100
-+++ deadbeef/plugins/musepack/Makefile.am	2010-12-08 16:29:45.514000060 +0100
-@@ -2,30 +2,10 @@
- 
- pkglib_LTLIBRARIES = musepack.la
- 
--musepack_la_SOURCES = musepack.c\
--huffman.c\
--mpc_bits_reader.c\
--mpc_decoder.c\
--mpc_demux.c\
--mpc_reader.c\
--requant.c\
--streaminfo.c\
--synth_filter.c\
--crc32.c\
--decoder.h\
--huffman.h\
--internal.h\
--mpc_bits_reader.h\
--mpc/mpcdec.h\
--mpcdec_math.h\
--mpc/reader.h\
--requant.h\
--mpc/streaminfo.h\
--mpc/mpc_types.h\
--mpc/minimax.h
-+musepack_la_SOURCES = musepack.c
- 
--musepack_la_LDFLAGS = -module
--musepack_la_LIBADD = $(LDADD) -lm
-+musepack_la_LDFLAGS = -module -lm -lmpcdec
-+musepack_la_LIBADD = $(LDADD)
- 
- AM_CFLAGS = $(CFLAGS) -fPIC
- 
-Index: deadbeef/plugins/musepack/Makefile.in
-===================================================================
---- deadbeef.orig/plugins/musepack/Makefile.in	2010-12-08 16:27:43.961000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,655 +0,0 @@
--# Makefile.in generated by automake 1.11.1 from Makefile.am.
--# @configure_input@
--
--# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
--# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
--# Inc.
--# This Makefile.in is free software; the Free Software Foundation
--# gives unlimited permission to copy and/or distribute it,
--# with or without modifications, as long as this notice is preserved.
--
--# This program is distributed in the hope that it will be useful,
--# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
--# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
--# PARTICULAR PURPOSE.
--
-- at SET_MAKE@
--
--VPATH = @srcdir@
--pkgdatadir = $(datadir)/@PACKAGE@
--pkgincludedir = $(includedir)/@PACKAGE@
--pkglibdir = $(libdir)/@PACKAGE@
--pkglibexecdir = $(libexecdir)/@PACKAGE@
--am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
--install_sh_PROGRAM = $(install_sh) -c
--install_sh_SCRIPT = $(install_sh) -c
--INSTALL_HEADER = $(INSTALL_DATA)
--transform = $(program_transform_name)
--NORMAL_INSTALL = :
--PRE_INSTALL = :
--POST_INSTALL = :
--NORMAL_UNINSTALL = :
--PRE_UNINSTALL = :
--POST_UNINSTALL = :
--build_triplet = @build@
--host_triplet = @host@
--subdir = plugins/musepack
--DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
--ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
--am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
--	$(top_srcdir)/configure.ac
--am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
--	$(ACLOCAL_M4)
--mkinstalldirs = $(install_sh) -d
--CONFIG_HEADER = $(top_builddir)/config.h
--CONFIG_CLEAN_FILES =
--CONFIG_CLEAN_VPATH_FILES =
--am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
--am__vpath_adj = case $$p in \
--    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
--    *) f=$$p;; \
--  esac;
--am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
--am__install_max = 40
--am__nobase_strip_setup = \
--  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
--am__nobase_strip = \
--  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
--am__nobase_list = $(am__nobase_strip_setup); \
--  for p in $$list; do echo "$$p $$p"; done | \
--  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
--  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
--    if (++n[$$2] == $(am__install_max)) \
--      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
--    END { for (dir in files) print dir, files[dir] }'
--am__base_list = \
--  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
--  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
--am__installdirs = "$(DESTDIR)$(pkglibdir)"
--LTLIBRARIES = $(pkglib_LTLIBRARIES)
--musepack_la_DEPENDENCIES =
--am__musepack_la_SOURCES_DIST = musepack.c huffman.c mpc_bits_reader.c \
--	mpc_decoder.c mpc_demux.c mpc_reader.c requant.c streaminfo.c \
--	synth_filter.c crc32.c decoder.h huffman.h internal.h \
--	mpc_bits_reader.h mpc/mpcdec.h mpcdec_math.h mpc/reader.h \
--	requant.h mpc/streaminfo.h mpc/mpc_types.h mpc/minimax.h
-- at HAVE_MUSEPACK_TRUE@am_musepack_la_OBJECTS = musepack.lo huffman.lo \
-- at HAVE_MUSEPACK_TRUE@	mpc_bits_reader.lo mpc_decoder.lo \
-- at HAVE_MUSEPACK_TRUE@	mpc_demux.lo mpc_reader.lo requant.lo \
-- at HAVE_MUSEPACK_TRUE@	streaminfo.lo synth_filter.lo crc32.lo
--musepack_la_OBJECTS = $(am_musepack_la_OBJECTS)
--musepack_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
--	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
--	$(musepack_la_LDFLAGS) $(LDFLAGS) -o $@
-- at HAVE_MUSEPACK_TRUE@am_musepack_la_rpath = -rpath $(pkglibdir)
--DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
--depcomp = $(SHELL) $(top_srcdir)/depcomp
--am__depfiles_maybe = depfiles
--am__mv = mv -f
--COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
--	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--CCLD = $(CC)
--LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
--	$(LDFLAGS) -o $@
--SOURCES = $(musepack_la_SOURCES)
--DIST_SOURCES = $(am__musepack_la_SOURCES_DIST)
--ETAGS = etags
--CTAGS = ctags
--DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
--ACLOCAL = @ACLOCAL@
--ALLOCA = @ALLOCA@
--ALL_LINGUAS = @ALL_LINGUAS@
--ALSA_DEPS_CFLAGS = @ALSA_DEPS_CFLAGS@
--ALSA_DEPS_LIBS = @ALSA_DEPS_LIBS@
--AMTAR = @AMTAR@
--AR = @AR@
--AUTOCONF = @AUTOCONF@
--AUTOHEADER = @AUTOHEADER@
--AUTOMAKE = @AUTOMAKE@
--AWK = @AWK@
--BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
--CATOBJEXT = @CATOBJEXT@
--CC = @CC@
--CCDEPMODE = @CCDEPMODE@
--CDDA_LIBS = @CDDA_LIBS@
--CFLAGS = @CFLAGS@
--CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
--CPP = @CPP@
--CPPFLAGS = @CPPFLAGS@
--CURL_LIBS = @CURL_LIBS@
--CXX = @CXX@
--CXXCPP = @CXXCPP@
--CXXDEPMODE = @CXXDEPMODE@
--CXXFLAGS = @CXXFLAGS@
--CYGPATH_W = @CYGPATH_W@
--DATADIRNAME = @DATADIRNAME@
--DBUS_DEPS_CFLAGS = @DBUS_DEPS_CFLAGS@
--DBUS_DEPS_LIBS = @DBUS_DEPS_LIBS@
--DEFS = @DEFS@
--DEPDIR = @DEPDIR@
--DEPS_CFLAGS = @DEPS_CFLAGS@
--DEPS_LIBS = @DEPS_LIBS@
--DLLTOOL = @DLLTOOL@
--DSYMUTIL = @DSYMUTIL@
--DUMPBIN = @DUMPBIN@
--ECHO_C = @ECHO_C@
--ECHO_N = @ECHO_N@
--ECHO_T = @ECHO_T@
--EGREP = @EGREP@
--EXEEXT = @EXEEXT@
--FAAD2_LIBS = @FAAD2_LIBS@
--FFMPEG_DEPS_CFLAGS = @FFMPEG_DEPS_CFLAGS@
--FFMPEG_DEPS_LIBS = @FFMPEG_DEPS_LIBS@
--FGREP = @FGREP@
--FLAC_LIBS = @FLAC_LIBS@
--GENCAT = @GENCAT@
--GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
--GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
--GLIBC2 = @GLIBC2@
--GLIBC21 = @GLIBC21@
--GMSGFMT = @GMSGFMT@
--GMSGFMT_015 = @GMSGFMT_015@
--GREP = @GREP@
--GTKUI_DEPS_CFLAGS = @GTKUI_DEPS_CFLAGS@
--GTKUI_DEPS_LIBS = @GTKUI_DEPS_LIBS@
--HAVE_ASPRINTF = @HAVE_ASPRINTF@
--HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
--HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
--HAVE_SNPRINTF = @HAVE_SNPRINTF@
--HAVE_VISIBILITY = @HAVE_VISIBILITY@
--HAVE_WPRINTF = @HAVE_WPRINTF@
--HOTKEYS_LIBS = @HOTKEYS_LIBS@
--ICONV_LIB = @ICONV_LIB@
--INSANE_CFLAGS = @INSANE_CFLAGS@
--INSANE_CXXFLAGS = @INSANE_CXXFLAGS@
--INSTALL = @INSTALL@
--INSTALL_DATA = @INSTALL_DATA@
--INSTALL_PROGRAM = @INSTALL_PROGRAM@
--INSTALL_SCRIPT = @INSTALL_SCRIPT@
--INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
--INSTOBJEXT = @INSTOBJEXT@
--INTLBISON = @INTLBISON@
--INTLLIBS = @INTLLIBS@
--INTLOBJS = @INTLOBJS@
--INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
--INTLTOOL_MERGE = @INTLTOOL_MERGE@
--INTLTOOL_PERL = @INTLTOOL_PERL@
--INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
--INTL_DEFAULT_VERBOSITY = @INTL_DEFAULT_VERBOSITY@
--INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
--INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
--LD = @LD@
--LDFLAGS = @LDFLAGS@
--LIBICONV = @LIBICONV@
--LIBINTL = @LIBINTL@
--LIBMMS_LIBS = @LIBMMS_LIBS@
--LIBMULTITHREAD = @LIBMULTITHREAD@
--LIBOBJS = @LIBOBJS@
--LIBPTH = @LIBPTH@
--LIBPTH_PREFIX = @LIBPTH_PREFIX@
--LIBS = @LIBS@
--LIBTHREAD = @LIBTHREAD@
--LIBTOOL = @LIBTOOL@
--LIPO = @LIPO@
--LN_S = @LN_S@
--LTLIBC = @LTLIBC@
--LTLIBICONV = @LTLIBICONV@
--LTLIBINTL = @LTLIBINTL@
--LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
--LTLIBOBJS = @LTLIBOBJS@
--LTLIBPTH = @LTLIBPTH@
--LTLIBTHREAD = @LTLIBTHREAD@
--MAD_LIBS = @MAD_LIBS@
--MAINT = @MAINT@
--MAKEINFO = @MAKEINFO@
--MANIFEST_TOOL = @MANIFEST_TOOL@
--MKDIR_P = @MKDIR_P@
--MSGFMT = @MSGFMT@
--MSGFMT_015 = @MSGFMT_015@
--MSGMERGE = @MSGMERGE@
--NM = @NM@
--NMEDIT = @NMEDIT@
--NOTIFY_CFLAGS = @NOTIFY_CFLAGS@
--NOTIFY_LIBS = @NOTIFY_LIBS@
--OBJDUMP = @OBJDUMP@
--OBJEXT = @OBJEXT@
--OSS_CFLAGS = @OSS_CFLAGS@
--OTOOL = @OTOOL@
--OTOOL64 = @OTOOL64@
--PACKAGE = @PACKAGE@
--PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
--PACKAGE_NAME = @PACKAGE_NAME@
--PACKAGE_STRING = @PACKAGE_STRING@
--PACKAGE_TARNAME = @PACKAGE_TARNAME@
--PACKAGE_URL = @PACKAGE_URL@
--PACKAGE_VERSION = @PACKAGE_VERSION@
--PATH_SEPARATOR = @PATH_SEPARATOR@
--PKG_CONFIG = @PKG_CONFIG@
--PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
--PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
--PLUGINS_DIRS = @PLUGINS_DIRS@
--POSUB = @POSUB@
--PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
--PULSE_DEPS_CFLAGS = @PULSE_DEPS_CFLAGS@
--PULSE_DEPS_LIBS = @PULSE_DEPS_LIBS@
--RANLIB = @RANLIB@
--SED = @SED@
--SET_MAKE = @SET_MAKE@
--SHELL = @SHELL@
--SNDFILE_LIBS = @SNDFILE_LIBS@
--STRIP = @STRIP@
--USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
--USE_NLS = @USE_NLS@
--VALAC = @VALAC@
--VERSION = @VERSION@
--VFS_CURL_LIBS = @VFS_CURL_LIBS@
--VORBIS_LIBS = @VORBIS_LIBS@
--WAVPACK_LIBS = @WAVPACK_LIBS@
--WINDRES = @WINDRES@
--WOE32 = @WOE32@
--WOE32DLL = @WOE32DLL@
--XGETTEXT = @XGETTEXT@
--XGETTEXT_015 = @XGETTEXT_015@
--XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
--ZLIB_LIBS = @ZLIB_LIBS@
--abs_builddir = @abs_builddir@
--abs_srcdir = @abs_srcdir@
--abs_top_builddir = @abs_top_builddir@
--abs_top_srcdir = @abs_top_srcdir@
--ac_ct_AR = @ac_ct_AR@
--ac_ct_CC = @ac_ct_CC@
--ac_ct_CXX = @ac_ct_CXX@
--ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
--am__include = @am__include@
--am__leading_dot = @am__leading_dot@
--am__quote = @am__quote@
--am__tar = @am__tar@
--am__untar = @am__untar@
--bindir = @bindir@
--build = @build@
--build_alias = @build_alias@
--build_cpu = @build_cpu@
--build_os = @build_os@
--build_vendor = @build_vendor@
--builddir = @builddir@
--datadir = @datadir@
--datarootdir = @datarootdir@
--docdir = @docdir@
--dvidir = @dvidir@
--exec_prefix = @exec_prefix@
--host = @host@
--host_alias = @host_alias@
--host_cpu = @host_cpu@
--host_os = @host_os@
--host_vendor = @host_vendor@
--htmldir = @htmldir@
--includedir = @includedir@
--infodir = @infodir@
--install_sh = @install_sh@
--libdir = @libdir@
--libexecdir = @libexecdir@
--localedir = @localedir@
--localstatedir = @localstatedir@
--mandir = @mandir@
--mkdir_p = @mkdir_p@
--oldincludedir = @oldincludedir@
--pdfdir = @pdfdir@
--prefix = @prefix@
--program_transform_name = @program_transform_name@
--psdir = @psdir@
--sbindir = @sbindir@
--sharedstatedir = @sharedstatedir@
--srcdir = @srcdir@
--sysconfdir = @sysconfdir@
--target_alias = @target_alias@
--top_build_prefix = @top_build_prefix@
--top_builddir = @top_builddir@
--top_srcdir = @top_srcdir@
-- at HAVE_MUSEPACK_TRUE@pkglib_LTLIBRARIES = musepack.la
-- at HAVE_MUSEPACK_TRUE@musepack_la_SOURCES = musepack.c\
-- at HAVE_MUSEPACK_TRUE@huffman.c\
-- at HAVE_MUSEPACK_TRUE@mpc_bits_reader.c\
-- at HAVE_MUSEPACK_TRUE@mpc_decoder.c\
-- at HAVE_MUSEPACK_TRUE@mpc_demux.c\
-- at HAVE_MUSEPACK_TRUE@mpc_reader.c\
-- at HAVE_MUSEPACK_TRUE@requant.c\
-- at HAVE_MUSEPACK_TRUE@streaminfo.c\
-- at HAVE_MUSEPACK_TRUE@synth_filter.c\
-- at HAVE_MUSEPACK_TRUE@crc32.c\
-- at HAVE_MUSEPACK_TRUE@decoder.h\
-- at HAVE_MUSEPACK_TRUE@huffman.h\
-- at HAVE_MUSEPACK_TRUE@internal.h\
-- at HAVE_MUSEPACK_TRUE@mpc_bits_reader.h\
-- at HAVE_MUSEPACK_TRUE@mpc/mpcdec.h\
-- at HAVE_MUSEPACK_TRUE@mpcdec_math.h\
-- at HAVE_MUSEPACK_TRUE@mpc/reader.h\
-- at HAVE_MUSEPACK_TRUE@requant.h\
-- at HAVE_MUSEPACK_TRUE@mpc/streaminfo.h\
-- at HAVE_MUSEPACK_TRUE@mpc/mpc_types.h\
-- at HAVE_MUSEPACK_TRUE@mpc/minimax.h
--
-- at HAVE_MUSEPACK_TRUE@musepack_la_LDFLAGS = -module
-- at HAVE_MUSEPACK_TRUE@musepack_la_LIBADD = $(LDADD) -lm
-- at HAVE_MUSEPACK_TRUE@AM_CFLAGS = $(CFLAGS) -fPIC
--all: all-am
--
--.SUFFIXES:
--.SUFFIXES: .c .lo .o .obj
--$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
--	@for dep in $?; do \
--	  case '$(am__configure_deps)' in \
--	    *$$dep*) \
--	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
--	        && { if test -f $@; then exit 0; else break; fi; }; \
--	      exit 1;; \
--	  esac; \
--	done; \
--	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/musepack/Makefile'; \
--	$(am__cd) $(top_srcdir) && \
--	  $(AUTOMAKE) --gnu plugins/musepack/Makefile
--.PRECIOUS: Makefile
--Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
--	@case '$?' in \
--	  *config.status*) \
--	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
--	  *) \
--	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
--	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
--	esac;
--
--$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--
--$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--$(am__aclocal_m4_deps):
--install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
--	@$(NORMAL_INSTALL)
--	test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
--	@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
--	list2=; for p in $$list; do \
--	  if test -f $$p; then \
--	    list2="$$list2 $$p"; \
--	  else :; fi; \
--	done; \
--	test -z "$$list2" || { \
--	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
--	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
--	}
--
--uninstall-pkglibLTLIBRARIES:
--	@$(NORMAL_UNINSTALL)
--	@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
--	for p in $$list; do \
--	  $(am__strip_dir) \
--	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
--	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
--	done
--
--clean-pkglibLTLIBRARIES:
--	-test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
--	@list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
--	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
--	  test "$$dir" != "$$p" || dir=.; \
--	  echo "rm -f \"$${dir}/so_locations\""; \
--	  rm -f "$${dir}/so_locations"; \
--	done
--musepack.la: $(musepack_la_OBJECTS) $(musepack_la_DEPENDENCIES) 
--	$(musepack_la_LINK) $(am_musepack_la_rpath) $(musepack_la_OBJECTS) $(musepack_la_LIBADD) $(LIBS)
--
--mostlyclean-compile:
--	-rm -f *.$(OBJEXT)
--
--distclean-compile:
--	-rm -f *.tab.c
--
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crc32.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_bits_reader.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_decoder.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_demux.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpc_reader.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/musepack.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/requant.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/streaminfo.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/synth_filter.Plo at am__quote@
--
--.c.o:
-- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(COMPILE) -c $<
--
--.c.obj:
-- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
--
--.c.lo:
-- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
--
--mostlyclean-libtool:
--	-rm -f *.lo
--
--clean-libtool:
--	-rm -rf .libs _libs
--
--ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
--	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	mkid -fID $$unique
--tags: TAGS
--
--TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
--		$(TAGS_FILES) $(LISP)
--	set x; \
--	here=`pwd`; \
--	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	shift; \
--	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
--	  test -n "$$unique" || unique=$$empty_fix; \
--	  if test $$# -gt 0; then \
--	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
--	      "$$@" $$unique; \
--	  else \
--	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
--	      $$unique; \
--	  fi; \
--	fi
--ctags: CTAGS
--CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
--		$(TAGS_FILES) $(LISP)
--	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	test -z "$(CTAGS_ARGS)$$unique" \
--	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
--	     $$unique
--
--GTAGS:
--	here=`$(am__cd) $(top_builddir) && pwd` \
--	  && $(am__cd) $(top_srcdir) \
--	  && gtags -i $(GTAGS_ARGS) "$$here"
--
--distclean-tags:
--	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
--
--distdir: $(DISTFILES)
--	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
--	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
--	list='$(DISTFILES)'; \
--	  dist_files=`for file in $$list; do echo $$file; done | \
--	  sed -e "s|^$$srcdirstrip/||;t" \
--	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
--	case $$dist_files in \
--	  */*) $(MKDIR_P) `echo "$$dist_files" | \
--			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
--			   sort -u` ;; \
--	esac; \
--	for file in $$dist_files; do \
--	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
--	  if test -d $$d/$$file; then \
--	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
--	    if test -d "$(distdir)/$$file"; then \
--	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
--	    fi; \
--	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
--	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
--	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
--	    fi; \
--	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
--	  else \
--	    test -f "$(distdir)/$$file" \
--	    || cp -p $$d/$$file "$(distdir)/$$file" \
--	    || exit 1; \
--	  fi; \
--	done
--check-am: all-am
--check: check-am
--all-am: Makefile $(LTLIBRARIES)
--installdirs:
--	for dir in "$(DESTDIR)$(pkglibdir)"; do \
--	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
--	done
--install: install-am
--install-exec: install-exec-am
--install-data: install-data-am
--uninstall: uninstall-am
--
--install-am: all-am
--	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
--
--installcheck: installcheck-am
--install-strip:
--	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
--	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
--	  `test -z '$(STRIP)' || \
--	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
--mostlyclean-generic:
--
--clean-generic:
--
--distclean-generic:
--	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
--	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
--
--maintainer-clean-generic:
--	@echo "This command is intended for maintainers to use"
--	@echo "it deletes files that may require special tools to rebuild."
--clean: clean-am
--
--clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
--	mostlyclean-am
--
--distclean: distclean-am
--	-rm -rf ./$(DEPDIR)
--	-rm -f Makefile
--distclean-am: clean-am distclean-compile distclean-generic \
--	distclean-tags
--
--dvi: dvi-am
--
--dvi-am:
--
--html: html-am
--
--html-am:
--
--info: info-am
--
--info-am:
--
--install-data-am:
--
--install-dvi: install-dvi-am
--
--install-dvi-am:
--
--install-exec-am: install-pkglibLTLIBRARIES
--
--install-html: install-html-am
--
--install-html-am:
--
--install-info: install-info-am
--
--install-info-am:
--
--install-man:
--
--install-pdf: install-pdf-am
--
--install-pdf-am:
--
--install-ps: install-ps-am
--
--install-ps-am:
--
--installcheck-am:
--
--maintainer-clean: maintainer-clean-am
--	-rm -rf ./$(DEPDIR)
--	-rm -f Makefile
--maintainer-clean-am: distclean-am maintainer-clean-generic
--
--mostlyclean: mostlyclean-am
--
--mostlyclean-am: mostlyclean-compile mostlyclean-generic \
--	mostlyclean-libtool
--
--pdf: pdf-am
--
--pdf-am:
--
--ps: ps-am
--
--ps-am:
--
--uninstall-am: uninstall-pkglibLTLIBRARIES
--
--.MAKE: install-am install-strip
--
--.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
--	clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
--	distclean-compile distclean-generic distclean-libtool \
--	distclean-tags distdir dvi dvi-am html html-am info info-am \
--	install install-am install-data install-data-am install-dvi \
--	install-dvi-am install-exec install-exec-am install-html \
--	install-html-am install-info install-info-am install-man \
--	install-pdf install-pdf-am install-pkglibLTLIBRARIES \
--	install-ps install-ps-am install-strip installcheck \
--	installcheck-am installdirs maintainer-clean \
--	maintainer-clean-generic mostlyclean mostlyclean-compile \
--	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
--	tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES
--
--
--# Tell versions [3.59,3.63) of GNU make to not export all variables.
--# Otherwise a system limit (for SysV at least) may be exceeded.
--.NOEXPORT:
-Index: deadbeef/plugins/musepack/crc32.c
-===================================================================
---- deadbeef.orig/plugins/musepack/crc32.c	2010-12-08 16:27:44.079000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,56 +0,0 @@
--/*
--*  C Implementation: crc32
--*
--*  code from http://www.w3.org/TR/PNG/#D-CRCAppendix
--*
--*/
--
--/* Table of CRCs of all 8-bit messages. */
--static unsigned long crc_table[256];
--
--/* Flag: has the table been computed? Initially false. */
--static int crc_table_computed = 0;
--
--/* Make the table for a fast CRC. */
--static void make_crc_table(void)
--{
--	unsigned long c;
--	int n, k;
--
--	for (n = 0; n < 256; n++) {
--		c = (unsigned long) n;
--		for (k = 0; k < 8; k++) {
--			if (c & 1)
--				c = 0xedb88320L ^ (c >> 1);
--			else
--				c = c >> 1;
--		}
--		crc_table[n] = c;
--	}
--	crc_table_computed = 1;
--}
--
--
--/* Update a running CRC with the bytes buf[0..len-1]--the CRC
--	should be initialized to all 1's, and the transmitted value
--	is the 1's complement of the final running CRC (see the
--	crc() routine below). */
--
--static unsigned long update_crc(unsigned long crc, unsigned char *buf, int len)
--{
--	unsigned long c = crc;
--	int n;
--
--	if (!crc_table_computed)
--		make_crc_table();
--	for (n = 0; n < len; n++) {
--		c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8);
--	}
--	return c;
--}
--
--/* Return the CRC of the bytes buf[0..len-1]. */
--unsigned long crc32(unsigned char *buf, int len)
--{
--	return update_crc(0xffffffffL, buf, len) ^ 0xffffffffL;
--}
-Index: deadbeef/plugins/musepack/decoder.h
-===================================================================
---- deadbeef.orig/plugins/musepack/decoder.h	2010-12-08 16:27:44.391000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,101 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 decoder.h
--#ifndef _MPCDEC_DECODER_H_
--#define _MPCDEC_DECODER_H_
--#ifdef WIN32
--#pragma once
--#endif
--
--#include <mpc/reader.h>
--
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#define SEEKING_TABLE_SIZE  256u
--// set it to SLOW_SEEKING_WINDOW to not use fast seeking
--#define FAST_SEEKING_WINDOW 32
--// set it to FAST_SEEKING_WINDOW to only use fast seeking
--#define SLOW_SEEKING_WINDOW 0x80000000
--
--enum {
--    MPC_V_MEM           = 2304,
--    MPC_DECODER_MEMSIZE = 16384,  // overall buffer size
--};
--
--struct mpc_decoder_t {
--    /// @name internal state variables
--    //@{
--	mpc_uint32_t stream_version;     ///< Streamversion of stream
--	mpc_int32_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 channels;           ///< Number of channels in stream
--
--	mpc_uint64_t samples;            ///< Number of samples in stream
--
--	mpc_uint64_t decoded_samples;    ///< Number of samples decoded from file begining
--	mpc_uint32_t samples_to_skip;    ///< Number samples to skip (used for seeking)
--	mpc_int32_t last_max_band;       ///< number of bands used in the last frame
--
--    // randomizer state variables
--    mpc_uint32_t  __r1;
--    mpc_uint32_t  __r2;
--
--    mpc_int32_t   SCF_Index_L [32] [3];
--    mpc_int32_t   SCF_Index_R [32] [3];       // holds scalefactor-indices
--    mpc_quantizer Q [32];                     // holds quantized samples
--    mpc_int32_t   Res_L [32];
--    mpc_int32_t   Res_R [32];                 // holds the chosen quantizer for each subband
--    mpc_bool_t    DSCF_Flag_L [32];
--    mpc_bool_t    DSCF_Flag_R [32];           // differential SCF used?
--    mpc_int32_t   SCFI_L [32];
--    mpc_int32_t   SCFI_R [32];                // describes order of transmitted SCF
--    mpc_bool_t    MS_Flag[32];                // MS used?
--#ifdef MPC_FIXED_POINT
--    mpc_uint8_t   SCF_shift[256];
--#endif
--
--    MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960];
--    MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960];
--    MPC_SAMPLE_FORMAT Y_L[36][32];
--    MPC_SAMPLE_FORMAT Y_R[36][32];
--    MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention)
--    //@}
--};
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/huffman.c
-===================================================================
---- deadbeef.orig/plugins/musepack/huffman.c	2010-12-08 16:27:44.007000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,358 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 huffman.c
--/// Implementations of sv7/sv8 huffman decoding functions.
--#include "huffman.h"
--
--
--// sv7 huffman tables
--static const mpc_huffman mpc_table_HuffHdr [10] = {
--{0x8000, 1, 0}, {0x6000, 3, 1}, {0x5e00, 7, -4}, {0x5d80, 9, 3}, {0x5d00, 9, 4}, {0x5c00, 8, -5}, {0x5800, 6, 2}, {0x5000, 5, -3}, {0x4000, 4, -2}, {0x0, 2, -1}
--};
--mpc_lut_data mpc_HuffHdr = {mpc_table_HuffHdr};
--
--const mpc_huffman mpc_table_HuffSCFI [4] = {
--	{0x8000, 1, 1}, {0x6000, 3, 2}, {0x4000, 3, 0}, {0x0, 2, 3}
--};
--
--static const mpc_huffman mpc_table_HuffDSCF [16] = {
--	{0xf800, 5, 5}, {0xf000, 5, -4}, {0xe000, 4, 3}, {0xd000, 4, -3}, {0xc000, 4, 8}, {0xa000, 3, 1}, {0x9000, 4, 0}, {0x8800, 5, -5}, {0x8400, 6, 7}, {0x8000, 6, -7}, {0x6000, 3, -1}, {0x4000, 3, 2}, {0x3000, 4, 4}, {0x2800, 5, 6}, {0x2000, 5, -6}, {0x0, 3, -2}
--};
--mpc_lut_data mpc_HuffDSCF = {mpc_table_HuffDSCF};
--
--static const mpc_huffman mpc_table_HuffQ1 [2] [27] = {
--	{
--		{0xe000, 3, 13}, {0xdc00, 6, 26}, {0xd800, 6, 0}, {0xd400, 6, 20}, {0xd000, 6, 6}, {0xc000, 4, 14}, {0xb000, 4, 12}, {0xa000, 4, 4}, {0x9000, 4, 22}, {0x8c00, 6, 8}, {0x8800, 6, 18}, {0x8400, 6, 24}, {0x8000, 6, 2}, {0x7000, 4, 16}, {0x6000, 4, 10}, {0x5800, 5, 17}, {0x5000, 5, 9}, {0x4800, 5, 1}, {0x4000, 5, 25}, {0x3800, 5, 5}, {0x3000, 5, 21}, {0x2800, 5, 3}, {0x2000, 5, 11}, {0x1800, 5, 15}, {0x1000, 5, 23}, {0x800, 5, 19}, {0x0, 5, 7}
--	}, {
--		{0x8000, 1, 13}, {0x7e00, 7, 15}, {0x7c00, 7, 1}, {0x7a00, 7, 11}, {0x7800, 7, 7}, {0x7600, 7, 17}, {0x7400, 7, 25}, {0x7200, 7, 19}, {0x7180, 9, 8}, {0x7100, 9, 18}, {0x7080, 9, 2}, {0x7000, 9, 24}, {0x6e00, 7, 3}, {0x6c00, 7, 23}, {0x6a00, 7, 21}, {0x6800, 7, 5}, {0x6700, 8, 0}, {0x6600, 8, 26}, {0x6500, 8, 6}, {0x6400, 8, 20}, {0x6000, 6, 9}, {0x5000, 4, 14}, {0x4000, 4, 12}, {0x3000, 4, 4}, {0x2000, 4, 22}, {0x1000, 4, 16}, {0x0, 4, 10}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ2 [2] [25] = {
--	{
--		{0xf000, 4, 13}, {0xe000, 4, 17}, {0xd000, 4, 7}, {0xc000, 4, 11}, {0xbc00, 6, 1}, {0xb800, 6, 23}, {0xb600, 7, 4}, {0xb400, 7, 20}, {0xb200, 7, 0}, {0xb000, 7, 24}, {0xa800, 5, 22}, {0xa000, 5, 10}, {0x8000, 3, 12}, {0x7800, 5, 2}, {0x7000, 5, 14}, {0x6000, 4, 6}, {0x5000, 4, 18}, {0x4000, 4, 8}, {0x3000, 4, 16}, {0x2800, 5, 9}, {0x2000, 5, 5}, {0x1800, 5, 15}, {0x1000, 5, 21}, {0x800, 5, 19}, {0x0, 5, 3}
--	}, {
--		{0xf800, 5, 18}, {0xf000, 5, 6}, {0xe800, 5, 8}, {0xe700, 8, 3}, {0xe6c0, 10, 24}, {0xe680, 10, 4}, {0xe640, 10, 0}, {0xe600, 10, 20}, {0xe400, 7, 23}, {0xe200, 7, 1}, {0xe000, 7, 19}, {0xd800, 5, 16}, {0xd600, 7, 15}, {0xd400, 7, 21}, {0xd200, 7, 9}, {0xd000, 7, 5}, {0xcc00, 6, 2}, {0xc800, 6, 10}, {0xc400, 6, 14}, {0xc000, 6, 22}, {0x8000, 2, 12}, {0x6000, 3, 13}, {0x4000, 3, 17}, {0x2000, 3, 11}, {0x0, 3, 7}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ3 [2] [7] = {
--	{
--		{0xe000, 3, 1}, {0xd000, 4, 3}, {0xc000, 4, -3}, {0xa000, 3, 2}, {0x8000, 3, -2}, {0x4000, 2, 0}, {0x0, 2, -1}
--	}, {
--		{0xc000, 2, 0}, {0x8000, 2, -1}, {0x4000, 2, 1}, {0x3000, 4, -2}, {0x2800, 5, 3}, {0x2000, 5, -3}, {0x0, 3, 2}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ4 [2] [9] = {
--	{
--		{0xe000, 3, 0}, {0xc000, 3, -1}, {0xa000, 3, 1}, {0x8000, 3, -2}, {0x6000, 3, 2}, {0x5000, 4, -4}, {0x4000, 4, 4}, {0x2000, 3, 3}, {0x0, 3, -3}
--	}, {
--		{0xe000, 3, 1}, {0xd000, 4, 2}, {0xc000, 4, -3}, {0x8000, 2, 0}, {0x6000, 3, -2}, {0x5000, 4, 3}, {0x4800, 5, -4}, {0x4000, 5, 4}, {0x0, 2, -1}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ5 [2] [15] = {
--	{
--		{0xf000, 4, 2}, {0xe800, 5, 5}, {0xe400, 6, -7}, {0xe000, 6, 7}, {0xd000, 4, -3}, {0xc000, 4, 3}, {0xb800, 5, -6}, {0xb000, 5, 6}, {0xa000, 4, -4}, {0x9000, 4, 4}, {0x8000, 4, -5}, {0x6000, 3, 0}, {0x4000, 3, -1}, {0x2000, 3, 1}, {0x0, 3, -2}
--	}, {
--		{0xf000, 4, 3}, {0xe800, 5, 4}, {0xe600, 7, 6}, {0xe500, 8, -7}, {0xe400, 8, 7}, {0xe000, 6, -6}, {0xc000, 3, 0}, {0xa000, 3, -1}, {0x8000, 3, 1}, {0x6000, 3, -2}, {0x4000, 3, 2}, {0x3800, 5, -5}, {0x3000, 5, 5}, {0x2000, 4, -4}, {0x0, 3, -3}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ6 [2] [31] = {
--	{
--		{0xf800, 5, 3}, {0xf000, 5, -4}, {0xec00, 6, -11}, {0xe800, 6, 12}, {0xe000, 5, 4}, {0xd800, 5, 6}, {0xd000, 5, -5}, {0xc800, 5, 5}, {0xc000, 5, 7}, {0xb800, 5, -7}, {0xb400, 6, -12}, {0xb000, 6, -13}, {0xa800, 5, -6}, {0xa000, 5, 8}, {0x9800, 5, -8}, {0x9000, 5, 9}, {0x8800, 5, -9}, {0x8400, 6, 13}, {0x8200, 7, -15}, {0x8000, 7, 15}, {0x7000, 4, 0}, {0x6800, 5, -10}, {0x6000, 5, 10}, {0x5000, 4, -1}, {0x4000, 4, 2}, {0x3000, 4, 1}, {0x2000, 4, -2}, {0x1c00, 6, 14}, {0x1800, 6, -14}, {0x1000, 5, 11}, {0x0, 4, -3}
--	}, {
--		{0xf800, 5, -6}, {0xf000, 5, 6}, {0xe000, 4, 1}, {0xd000, 4, -1}, {0xce00, 7, 10}, {0xcc00, 7, -10}, {0xcb00, 8, -11}, {0xca80, 9, -12}, {0xca60, 11, 13}, {0xca58, 13, 15}, {0xca50, 13, -14}, {0xca48, 13, 14}, {0xca40, 13, -15}, {0xca00, 10, -13}, {0xc900, 8, 11}, {0xc800, 8, 12}, {0xc400, 6, -9}, {0xc000, 6, 9}, {0xb000, 4, -2}, {0xa000, 4, 2}, {0x9000, 4, 3}, {0x8000, 4, -3}, {0x7800, 5, -7}, {0x7000, 5, 7}, {0x6000, 4, -4}, {0x5000, 4, 4}, {0x4800, 5, -8}, {0x4000, 5, 8}, {0x3000, 4, 5}, {0x2000, 4, -5}, {0x0, 3, 0}
--	}
--};
--
--static const mpc_huffman mpc_table_HuffQ7 [2] [63] = {
--	{
--		{0xfc00, 6, 7}, {0xf800, 6, 8}, {0xf400, 6, 9}, {0xf000, 6, -8}, {0xec00, 6, 11}, {0xea00, 7, 21}, {0xe900, 8, -28}, {0xe800, 8, 28}, {0xe400, 6, -9}, {0xe200, 7, -22}, {0xe000, 7, -21}, {0xdc00, 6, -10}, {0xd800, 6, -11}, {0xd400, 6, 10}, {0xd000, 6, 12}, {0xcc00, 6, -13}, {0xca00, 7, 22}, {0xc800, 7, 23}, {0xc400, 6, -12}, {0xc000, 6, 13}, {0xbc00, 6, 14}, {0xb800, 6, -14}, {0xb600, 7, -23}, {0xb500, 8, -29}, {0xb400, 8, 29}, {0xb000, 6, -15}, {0xac00, 6, 15}, {0xa800, 6, 16}, {0xa400, 6, -16}, {0xa200, 7, -24}, {0xa000, 7, 24}, {0x9c00, 6, 17}, {0x9a00, 7, -25}, {0x9900, 8, -30}, {0x9800, 8, 30}, {0x9400, 6, -17}, {0x9000, 6, 18}, {0x8c00, 6, -18}, {0x8a00, 7, 25}, {0x8800, 7, 26}, {0x8400, 6, 19}, {0x8200, 7, -26}, {0x8000, 7, -27}, {0x7800, 5, 2}, {0x7400, 6, -19}, {0x7000, 6, 20}, {0x6800, 5, -1}, {0x6700, 8, -31}, {0x6600, 8, 31}, {0x6400, 7, 27}, {0x6000, 6, -20}, {0x5800, 5, 1}, {0x5000, 5, -5}, {0x4800, 5, -3}, {0x4000, 5, 3}, {0x3800, 5, 0}, {0x3000, 5, -2}, {0x2800, 5, -4}, {0x2000, 5, 4}, {0x1800, 5, 5}, {0x1000, 5, -6}, {0x800, 5, 6}, {0x0, 5, -7}
--	}, {
--		{0xf800, 5, -1}, {0xf000, 5, 2}, {0xe800, 5, -2}, {0xe000, 5, 3}, {0xdf00, 8, -20}, {0xdec0, 10, 24}, {0xdebc, 14, 28}, {0xdeb8, 14, -28}, {0xdeb4, 14, -30}, {0xdeb0, 14, 30}, {0xdea0, 12, -27}, {0xde9c, 14, 29}, {0xde98, 14, -29}, {0xde94, 14, 31}, {0xde90, 14, -31}, {0xde80, 12, 27}, {0xde00, 9, -22}, {0xdc00, 7, -17}, {0xd800, 6, -11}, {0xd000, 5, -3}, {0xc800, 5, 4}, {0xc000, 5, -4}, {0xbe00, 7, 17}, {0xbd00, 8, 20}, {0xbc80, 9, 22}, {0xbc40, 10, -25}, {0xbc00, 10, -26}, {0xb800, 6, 12}, {0xb000, 5, 5}, {0xa800, 5, -5}, {0xa000, 5, 6}, {0x9800, 5, -6}, {0x9400, 6, -12}, {0x9200, 7, -18}, {0x9000, 7, 18}, {0x8c00, 6, 13}, {0x8800, 6, -13}, {0x8000, 5, -7}, {0x7c00, 6, 14}, {0x7b00, 8, 21}, {0x7a00, 8, -21}, {0x7800, 7, -19}, {0x7000, 5, 7}, {0x6800, 5, 8}, {0x6400, 6, -14}, {0x6000, 6, -15}, {0x5800, 5, -8}, {0x5400, 6, 15}, {0x5200, 7, 19}, {0x51c0, 10, 25}, {0x5180, 10, 26}, {0x5100, 9, -23}, {0x5080, 9, 23}, {0x5000, 9, -24}, {0x4800, 5, -9}, {0x4000, 5, 9}, {0x3c00, 6, 16}, {0x3800, 6, -16}, {0x3000, 5, 10}, {0x2000, 4, 0}, {0x1800, 5, -10}, {0x1000, 5, 11}, {0x0, 4, 1}
--	}
--};
--
--mpc_lut_data mpc_HuffQ [7] [2] = {
--	{{mpc_table_HuffQ1[0]}, {mpc_table_HuffQ1[1]}},
--	{{mpc_table_HuffQ2[0]}, {mpc_table_HuffQ2[1]}},
--	{{mpc_table_HuffQ3[0]}, {mpc_table_HuffQ3[1]}},
--	{{mpc_table_HuffQ4[0]}, {mpc_table_HuffQ4[1]}},
--	{{mpc_table_HuffQ5[0]}, {mpc_table_HuffQ5[1]}},
--	{{mpc_table_HuffQ6[0]}, {mpc_table_HuffQ6[1]}},
--	{{mpc_table_HuffQ7[0]},	{mpc_table_HuffQ7[1]}}
--};
--
--
--// sv8 huffman tables
--static const mpc_huffman mpc_huff_SCFI_1 [3] = {
--	{0x8000, 1, 1}, {0x4000, 2, 2}, {0x0, 3, 3}
--}; // 3
--static const mpc_int8_t mpc_sym_SCFI_1 [4] = {
--	2, 3, 1, 0
--};
--static const mpc_huffman mpc_huff_SCFI_2 [5] = {
--	{0x8000, 2, 3}, {0x4000, 3, 5}, {0x1800, 5, 11}, {0x400, 6, 14}, {0x0, 7, 15}
--}; // 5
--static const mpc_int8_t mpc_sym_SCFI_2 [16] = {
--	15, 10, 14, 11, 13, 9, 7, 6, 5, 12, 8, 3, 2, 0, 4, 1
--};
--mpc_can_data mpc_can_SCFI[2] = {{mpc_huff_SCFI_1, mpc_sym_SCFI_1}, {mpc_huff_SCFI_2, mpc_sym_SCFI_2}};
--
--static const mpc_huffman mpc_huff_DSCF_1 [12] = {
--	{0xa000, 3, 7}, {0x4000, 4, 12}, {0x2800, 5, 16}, {0x1800, 6, 21}, {0xe00, 7, 27}, {0x700, 8, 34}, {0x380, 9, 41}, {0x140, 10, 48}, {0x80, 11, 53}, {0x30, 12, 57}, {0x18, 13, 60}, {0x0, 14, 63}
--}; // 12
--static const mpc_int8_t mpc_sym_DSCF_1 [64] = {
--	35, 34, 33, 36, 32, 30, 29, 27, 26, 37, 28, 25, 39, 38, 24, 23, 40, 22, 21, 20, 19, 43, 42, 41, 18, 17, 16, 15, 46, 45, 44, 14, 13, 12, 11, 49, 48, 47, 31, 10, 9, 8, 7, 6, 52, 51, 50, 5, 4, 3, 54, 53, 2, 1, 0, 57, 56, 55, 63, 62, 61, 60, 59, 58
--};
--static const mpc_huffman mpc_huff_DSCF_2 [13] = {
--	{0x6000, 3, 7}, {0x3000, 4, 10}, {0x1800, 5, 13}, {0x1000, 6, 16}, {0xa00, 7, 20}, {0x600, 8, 25}, {0x380, 9, 31}, {0x1c0, 10, 38}, {0xe0, 11, 45}, {0x50, 12, 52}, {0x20, 13, 57}, {0xc, 14, 61}, {0x0, 15, 64}
--}; // 13
--static const mpc_int8_t mpc_sym_DSCF_2 [65] = {
--	33, 32, 31, 30, 29, 34, 28, 27, 36, 35, 26, 37, 25, 38, 24, 23, 40, 39, 22, 21, 42, 41, 20, 19, 18, 45, 44, 43, 17, 16, 15, 14, 48, 47, 46, 13, 12, 11, 10, 64, 52, 51, 50, 49, 9, 8, 7, 6, 55, 54, 53, 5, 4, 3, 58, 57, 56, 2, 1, 63, 62, 61, 60, 59, 0
--};
--mpc_can_data mpc_can_DSCF[2] = {{mpc_huff_DSCF_1, mpc_sym_DSCF_1}, {mpc_huff_DSCF_2, mpc_sym_DSCF_2}};
--
--static const mpc_huffman mpc_huff_Bands [12] = {
--	{0x8000, 1, 1}, {0x4000, 2, 2}, {0x2000, 3, 3}, {0x1000, 5, 6}, {0x800, 6, 8}, {0x600, 7, 10}, {0x300, 8, 13}, {0x200, 9, 16}, {0x140, 10, 20}, {0xc0, 11, 25}, {0x10, 12, 31}, {0x0, 13, 32}
--}; // 12
--static const mpc_int8_t mpc_sym_Bands [33] = {
--	0, 32, 1, 31, 2, 30, 3, 4, 29, 6, 5, 28, 7, 27, 26, 8, 25, 24, 23, 9, 22, 21, 20, 18, 17, 16, 15, 14, 12, 11, 10, 19, 13
--};
--mpc_can_data mpc_can_Bands = {mpc_huff_Bands, mpc_sym_Bands};
--
--static const mpc_huffman mpc_huff_Res_1 [16] = {
--	{0x8000, 1, 1}, {0x4000, 2, 2}, {0x2000, 3, 3}, {0x1000, 4, 4}, {0x800, 5, 5}, {0x400, 6, 6}, {0x200, 7, 7}, {0x100, 8, 8}, {0x80, 9, 9}, {0x40, 10, 10}, {0x20, 11, 11}, {0x10, 12, 12}, {0x8, 13, 13}, {0x4, 14, 14}, {0x2, 15, 15}, {0x0, 16, 16}
--}; // 16
--static const mpc_int8_t mpc_sym_Res_1 [17] = {
--	0, 1, 16, 2, 3, 4, 5, 15, 6, 7, 8, 9, 10, 11, 12, 14, 13
--};
--static const mpc_huffman mpc_huff_Res_2 [12] = {
--	{0x4000, 2, 3}, {0x2000, 3, 4}, {0x1000, 4, 5}, {0x800, 5, 6}, {0x400, 6, 7}, {0x200, 7, 8}, {0x100, 8, 9}, {0x80, 9, 10}, {0x40, 10, 11}, {0x20, 11, 12}, {0x10, 12, 13}, {0x0, 14, 16}
--}; // 12
--static const mpc_int8_t mpc_sym_Res_2 [17] = {
--	16, 1, 0, 2, 15, 3, 14, 4, 5, 13, 6, 12, 7, 11, 10, 9, 8
--};
--mpc_can_data mpc_can_Res[2] = {{mpc_huff_Res_1, mpc_sym_Res_1}, {mpc_huff_Res_2, mpc_sym_Res_2}};
--
--static const mpc_huffman mpc_huff_Q1 [10] = {
--	{0x6000, 3, 7}, {0x1000, 4, 10}, {0x800, 5, 11}, {0x400, 6, 12}, {0x200, 7, 13}, {0x100, 8, 14}, {0x80, 9, 15}, {0x40, 10, 16}, {0x20, 11, 17}, {0x0, 12, 18}
--}; // 10
--static const mpc_int8_t mpc_sym_Q1 [19] = {
--	7, 6, 5, 4, 3, 10, 9, 8, 2, 1, 11, 0, 12, 13, 14, 15, 16, 18, 17
--};
--mpc_can_data mpc_can_Q1 = {mpc_huff_Q1, mpc_sym_Q1};
--
--static const mpc_huffman mpc_huff_Q2_1 [10] = {
--	{0xe000, 3, 7}, {0x8000, 4, 14}, {0x3c00, 6, 38}, {0x2a00, 7, 53}, {0x1200, 8, 74}, {0x600, 9, 92}, {0x3c0, 10, 104}, {0x60, 11, 119}, {0x20, 12, 122}, {0x0, 13, 124}
--}; // 10
--static const mpc_int8_t mpc_sym_Q2_1 [125] = {
--	62, 87, 67, 63, 61, 57, 37, 93, 92, 88, 86, 83, 82, 81, 68, 66, 58, 56, 42, 41, 38, 36, 32, 31, 112, 91, 72, 64, 60, 52, 43, 33, 12, 117, 113, 111, 107, 97, 89, 85, 77, 73, 71, 69, 65, 59, 55, 53, 51, 47, 39, 35, 27, 17, 13, 11, 7, 118, 116, 108, 106, 98, 96, 94, 90, 84, 80, 78, 76, 48, 46, 44, 40, 34, 30, 28, 26, 18, 16, 8, 6, 122, 110, 102, 74, 70, 54, 50, 22, 2, 123, 121, 119, 115, 114, 109, 105, 103, 101, 99, 95, 79, 75, 49, 45, 29, 25, 23, 21, 19, 15, 14, 10, 9, 5, 3, 1, 124, 104, 20, 0, 120, 100, 24, 4
--};
--static const mpc_huffman mpc_huff_Q2_2 [9] = {
--	{0xf000, 4, 15}, {0x7000, 5, 30}, {0x4800, 6, 44}, {0x3c00, 7, 62}, {0xc00, 8, 92}, {0x780, 9, 104}, {0xc0, 10, 119}, {0x40, 11, 122}, {0x0, 12, 124}
--}; // 9
--static const mpc_int8_t mpc_sym_Q2_2 [125] = {
--	62, 92, 87, 86, 82, 68, 67, 66, 63, 61, 58, 57, 56, 42, 38, 37, 32, 93, 91, 88, 83, 81, 43, 41, 36, 33, 31, 112, 72, 64, 60, 52, 12, 118, 117, 116, 113, 111, 108, 107, 106, 98, 97, 96, 94, 90, 89, 85, 84, 80, 78, 77, 76, 73, 71, 69, 65, 59, 55, 53, 51, 48, 47, 46, 44, 40, 39, 35, 34, 30, 28, 27, 26, 18, 17, 16, 13, 11, 8, 7, 6, 122, 110, 74, 70, 54, 50, 22, 14, 2, 123, 121, 119, 115, 114, 109, 105, 103, 102, 101, 99, 95, 79, 75, 49, 45, 29, 25, 23, 21, 19, 15, 10, 9, 5, 3, 1, 124, 104, 20, 0, 120, 100, 24, 4
--};
--
--static const mpc_huffman mpc_huff_Q3 [7] = {
--	{0xe000, 3, 7}, {0x8000, 4, 14}, {0x5000, 5, 22}, {0x2400, 6, 32}, {0xa00, 7, 41}, {0x200, 8, 46}, {0x0, 9, 48}
--}; // 7
--static const mpc_int8_t mpc_sym_Q3 [49] = {
--	0, 17, 16, 1, 15, -16, -1, 32, 31, 2, 14, -15, -32, 34, 33, 47, 46, 18, 30, -14, -2, -31, -17, -18, 49, 48, 63, 19, 29, 3, 13, -13, -3, -30, -47, -48, -33, 50, 62, 35, 45, -29, -19, -46, -34, 51, 61, -45, -35
--};
--
--static const mpc_huffman mpc_huff_Q4 [8] = {
--	{0xf000, 4, 15}, {0x9000, 5, 30}, {0x3400, 6, 48}, {0x1800, 7, 61}, {0x500, 8, 73}, {0x100, 9, 78}, {0x0, 10, 80}, {0x0, 0, 90}
--}; // 8
--static const mpc_int8_t mpc_sym_Q4 [91] = {
--	0, 32, 17, 16, 31, 2, 1, 15, 14, -15, -16, -1, -32, 49, 48, 34, 33, 47, 46, 19, 18, 30, 29, 3, 13, -13, -14, -2, -3, -30, -31, -17, -18, -47, -48, -33, 64, 50, 63, 62, 35, 45, 4, 12, -29, -19, -46, -34, -64, -49, 66, 65, 79, 78, 51, 61, 36, 44, 20, 28, -12, -4, -28, -20, -45, -35, -62, -63, -50, 67, 77, 52, 60, -44, -36, -61, -51, 68, 76, -60, -52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
--};
--
--static const mpc_huffman mpc_huff_Q5_1 [6] = {
--	{0xc000, 2, 3}, {0x4000, 3, 6}, {0x2000, 4, 8}, {0x1000, 5, 10}, {0x800, 6, 12}, {0x0, 7, 14}
--}; // 6
--static const mpc_int8_t mpc_sym_Q5_1 [15] = {
--	0, 2, 1, -1, -2, 3, -3, 4, -4, 5, -5, 7, 6, -6, -7
--};
--static const mpc_huffman mpc_huff_Q5_2 [4] = {
--	{0x6000, 3, 7}, {0x2000, 4, 10}, {0x1000, 5, 12}, {0x0, 6, 14}
--}; // 4
--static const mpc_int8_t mpc_sym_Q5_2 [15] = {
--	2, 1, 0, -1, -2, 4, 3, -3, -4, 5, -5, 7, 6, -6, -7
--};
--
--static const mpc_huffman mpc_huff_Q6_1 [8] = {
--	{0xc000, 2, 3}, {0x8000, 3, 6}, {0x4000, 4, 10}, {0x2800, 5, 14}, {0xc00, 6, 19}, {0x800, 7, 22}, {0x400, 8, 26}, {0x0, 9, 30}
--}; // 8
--static const mpc_int8_t mpc_sym_Q6_1 [31] = {
--	0, 1, -1, 3, 2, -2, -3, 4, -4, -5, 8, 7, 6, 5, -6, -7, -8, 9, -9, 11, 10, -10, -11, 15, 14, 13, 12, -12, -13, -14, -15
--};
--static const mpc_huffman mpc_huff_Q6_2 [5] = {
--	{0x5000, 4, 15}, {0x2000, 5, 20}, {0x1000, 6, 24}, {0x400, 7, 28}, {0x0, 8, 30}
--}; // 5
--static const mpc_int8_t mpc_sym_Q6_2 [31] = {
--	5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, 8, 7, 6, -6, -7, -8, 10, 9, -9, -10, 13, 12, 11, -11, -12, -13, 15, 14, -14, -15
--};
--
--static const mpc_huffman mpc_huff_Q7_1 [9] = {
--	{0xc000, 2, 3}, {0x8000, 3, 6}, {0x6000, 4, 10}, {0x4000, 5, 16}, {0x2800, 6, 24}, {0x1400, 7, 34}, {0xa00, 8, 44}, {0x400, 9, 54}, {0x0, 10, 62}
--}; // 9
--static const mpc_int8_t mpc_sym_Q7_1 [63] = {
--	0, 1, -1, 2, -2, 4, 3, -3, -4, 7, 6, 5, -5, -6, -7, 13, 11, 10, 9, 8, -8, -9, -10, -11, -12, 17, 16, 15, 14, 12, -13, -14, -15, -16, -17, 28, 27, 21, 20, 19, 18, -18, -19, -20, -21, -27, -28, 31, 30, 29, 26, 25, 24, 23, 22, -22, -23, -24, -25, -26, -29, -30, -31
--};
--static const mpc_huffman mpc_huff_Q7_2 [5] = {
--	{0x6000, 5, 31}, {0x2400, 6, 43}, {0x1000, 7, 52}, {0x200, 8, 60}, {0x0, 9, 62}
--}; // 5
--static const mpc_int8_t mpc_sym_Q7_2 [63] = {
--	10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, 17, 16, 15, 14, 13, 12, 11, -10, -11, -12, -13, -14, -15, -16, -17, 22, 21, 20, 19, 18, -18, -19, -20, -21, -22, 29, 28, 27, 26, 25, 24, 23, -23, -24, -25, -26, -27, -28, -29, 31, 30, -30, -31
--};
--
--static const mpc_huffman mpc_huff_Q8_1 [11] = {
--	{0xc000, 2, 3}, {0x8000, 3, 6}, {0x7000, 4, 10}, {0x5800, 5, 17}, {0x3800, 6, 28}, {0x2800, 7, 42}, {0x1900, 8, 62}, {0xd00, 9, 87}, {0x280, 10, 113}, {0x60, 11, 123}, {0x0, 12, 126}
--}; // 11
--static const mpc_int8_t mpc_sym_Q8_1 [127] = {
--	0, 1, -1, -2, 3, 2, -3, 7, 6, 5, 4, -4, -5, -6, -7, 11, 10, 9, 8, -8, -9, -10, -11, 19, 18, 17, 16, 15, 14, 13, 12, -12, -13, -14, -15, -16, -17, -19, 56, 55, 31, 28, 27, 26, 25, 24, 23, 22, 21, 20, -18, -20, -21, -22, -23, -24, -25, -26, -27, -33, -54, -56, 63, 62, 61, 60, 59, 58, 57, 54, 53, 43, 40, 39, 38, 37, 36, 35, 34, 33, 32, 30, 29, -28, -29, -30, -31, -32, -34, -35, -36, -37, -38, -39, -40, -41, -43, -53, -55, -57, -58, -59, -60, -61, 49, 47, 46, 45, 44, 42, 41, -42, -44, -45, -46, -47, -48, -49, -50, -62, -63, 52, 51, 50, 48, -51, -52
--};
--static const mpc_huffman mpc_huff_Q8_2 [4] = {
--	{0x9800, 6, 63}, {0x2a00, 7, 101}, {0x400, 8, 122}, {0x0, 9, 126}
--}; // 4
--static const mpc_int8_t mpc_sym_Q8_2 [127] = {
--	13, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 12, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, -42, -43, -44, -45, -46, -47, -48, -49, -50, -51, -52, -53, -54, -55, -56, -57, -58, -59, 63, 62, 61, 60, -60, -61, -62, -63
--};
--
--static const mpc_huffman mpc_huff_Q9up [6] = {
--	{0xf800, 6, 63}, {0xac00, 7, 125}, {0x2600, 8, -45}, {0x280, 9, -7}, {0x40, 10, -2}, {0x0, 11, -1}
--}; // 6
--static const mpc_int8_t mpc_sym_Q9up [256] = {
--	-128, 127, -108, -110, -111, -112, -113, -114, -115, -116, -117, -118, -119, -120, -121, -122, -123, -124, -125, -126, -127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, -44, -45, -46, -47, -48, -49, -50, -51, -52, -53, -54, -55, -56, -57, -58, -59, -60, -61, -62, -63, -64, -65, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76, -77, -78, -79, -80, -81, -82, -83, -84, -85, -86, -87, -88, -89, -90, -91, -92, -93, -94, -95, -96, -97, -98, -99, -100, -101, -102, -103, -104, -105, -106, -107, -109, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 40, 20, 19, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, -42, -43, 41, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, -3, -4, -5, -6, 4, 3, 2, 1, 0, -1, -2
--};
--mpc_can_data mpc_can_Q9up = {mpc_huff_Q9up, mpc_sym_Q9up};
--
--
--mpc_can_data mpc_can_Q [6][2] = {
--	{{mpc_huff_Q2_1, mpc_sym_Q2_1}, {mpc_huff_Q2_2, mpc_sym_Q2_2}},
--	{{mpc_huff_Q3, mpc_sym_Q3},     {mpc_huff_Q4, mpc_sym_Q4}},
--	{{mpc_huff_Q5_1, mpc_sym_Q5_1}, {mpc_huff_Q5_2, mpc_sym_Q5_2}},
--	{{mpc_huff_Q6_1, mpc_sym_Q6_1}, {mpc_huff_Q6_2, mpc_sym_Q6_2}},
--	{{mpc_huff_Q7_1, mpc_sym_Q7_1}, {mpc_huff_Q7_2, mpc_sym_Q7_2}},
--	{{mpc_huff_Q8_1, mpc_sym_Q8_1}, {mpc_huff_Q8_2, mpc_sym_Q8_2}}
--};
--
--static void huff_fill_lut(const mpc_huffman * table, mpc_huff_lut * lut, const int bits)
--{
--	int i, idx = 0;
--	const int shift = 16 - bits;
--	for (i = (1 << bits) - 1; i >= 0 ; i--) {
--		if ((table[idx].Code >> shift) < i) {
--			lut[i].Length = table[idx].Length;
--			lut[i].Value = table[idx].Value;
--		} else {
--			if (table[idx].Length <= bits) {
--				lut[i].Length = table[idx].Length;
--				lut[i].Value = table[idx].Value;
--			} else {
--				lut[i].Length = 0;
--				lut[i].Value = idx;
--			}
--			if (i != 0)
--				do {
--					idx++;
--				} while ((table[idx].Code >> shift) == i);
--		}
--	}
--}
--
--static void can_fill_lut(mpc_can_data * data, const int bits)
--{
--	int i, idx = 0;
--	const int shift = 16 - bits;
--	const mpc_huffman * table = data->table;
--	const mpc_int8_t * sym = data->sym;
--	mpc_huff_lut * lut = data->lut;
--	for (i = (1 << bits) - 1; i >= 0 ; i--) {
--		if ((table[idx].Code >> shift) < i) {
--			if (table[idx].Length <= bits) {
--				lut[i].Length = table[idx].Length;
--				lut[i].Value = sym[(table[idx].Value - (i >> (bits - table[idx].Length))) & 0xFF];
--			} else {
--				lut[i].Length = 0;
--				lut[i].Value = idx;
--			}
--		} else {
--			if (table[idx].Length <= bits) {
--				lut[i].Length = table[idx].Length;
--				lut[i].Value = sym[(table[idx].Value - (i >> (bits - table[idx].Length))) & 0xFF];
--			} else {
--				lut[i].Length = 0;
--				lut[i].Value = idx;
--			}
--			if (i != 0)
--				do {
--					idx++;
--				} while ((table[idx].Code >> shift) == i);
--		}
--	}
--}
--
--void huff_init_lut(const int bits)
--{
--	int i, j;
--
--	huff_fill_lut(mpc_HuffDSCF.table, mpc_HuffDSCF.lut, bits);
--	huff_fill_lut(mpc_HuffHdr.table, mpc_HuffHdr.lut, bits);
--
--	can_fill_lut(&mpc_can_SCFI[0], bits);
--	can_fill_lut(&mpc_can_SCFI[1], bits);
--	can_fill_lut(&mpc_can_DSCF[0], bits);
--	can_fill_lut(&mpc_can_DSCF[1], bits);
--	can_fill_lut(&mpc_can_Res[0], bits);
--	can_fill_lut(&mpc_can_Res[1], bits);
--	can_fill_lut(&mpc_can_Q1, bits);
--	can_fill_lut(&mpc_can_Q9up, bits);
--
--
--	for( i = 0; i < 7; i++){
--		for( j = 0; j < 2; j++){
--			if (i != 6) can_fill_lut(&mpc_can_Q[i][j], bits);
--			huff_fill_lut(mpc_HuffQ[i][j].table, mpc_HuffQ[i][j].lut, bits);
--		}
--	}
--}
--
--
-Index: deadbeef/plugins/musepack/huffman.h
-===================================================================
---- deadbeef.orig/plugins/musepack/huffman.h	2010-12-08 16:27:44.053000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,83 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 huffman.h
--/// Data structures and functions for huffman coding.
--
--#ifndef _MPCDEC_HUFFMAN_H_
--#define _MPCDEC_HUFFMAN_H_
--#ifdef WIN32
--#pragma once
--#endif
--
--#include <mpc/mpc_types.h>
--
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--// LUT size parameter, LUT size is 1 << LUT_DEPTH
--#define LUT_DEPTH 6
--
--/// Huffman table entry.
--typedef struct mpc_huffman_t {
--    mpc_uint16_t  Code;
--    mpc_uint8_t  Length;
--    mpc_int8_t   Value;
--} mpc_huffman;
--
--/// Huffman LUT entry.
--typedef struct mpc_huff_lut_t {
--	mpc_uint8_t  Length;
--	mpc_int8_t   Value;
--} mpc_huff_lut;
--
--/// Type used for huffman LUT decoding
--typedef struct mpc_lut_data_t {
--	mpc_huffman const * const table;
--	mpc_huff_lut lut[1 << LUT_DEPTH];
--} mpc_lut_data;
--
--/// Type used for canonical huffman decoding
--typedef struct mpc_can_data_t {
--	mpc_huffman const * const table;
--	mpc_int8_t const * const sym;
--	mpc_huff_lut lut[1 << LUT_DEPTH];
--} mpc_can_data;
--
--void huff_init_lut(const int bits);
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/internal.h
-===================================================================
---- deadbeef.orig/plugins/musepack/internal.h	2010-12-08 16:27:44.103000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,94 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 internal.h
--/// Definitions and structures used only internally by the libmpcdec.
--#ifndef _MPCDEC_INTERNAL_H_
--#define _MPCDEC_INTERNAL_H_
--#ifdef WIN32
--#pragma once
--#endif
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#include <mpc/mpcdec.h>
--
--/// Big/little endian 32 bit byte swapping routine.
--static mpc_inline
--mpc_uint32_t mpc_swap32(mpc_uint32_t val) {
--    return (((val & 0xFF000000) >> 24) | ((val & 0x00FF0000) >> 8)
--          | ((val & 0x0000FF00) <<  8) | ((val & 0x000000FF) << 24));
--}
--
--typedef struct mpc_block_t {
--	char key[2];	// block key
--	mpc_uint64_t size;	// block size minus the block header size
--} mpc_block;
--
--#define MAX_FRAME_SIZE 4352
--#define DEMUX_BUFFER_SIZE (65536 - MAX_FRAME_SIZE) // need some space as sand box
--
--struct mpc_demux_t {
--	mpc_reader * r;
--	mpc_decoder * d;
--	mpc_streaminfo si;
--
--	// buffer
--	mpc_uint8_t buffer[DEMUX_BUFFER_SIZE + MAX_FRAME_SIZE];
--	mpc_size_t bytes_total;
--	mpc_bits_reader bits_reader;
--	mpc_int32_t block_bits; /// bits remaining in current audio block
--	mpc_uint_t block_frames; /// frames remaining in current audio block
--
--	// seeking
--	mpc_seek_t * seek_table;
--	mpc_uint_t seek_pwr; /// distance between 2 frames in seek_table = 2^seek_pwr
--	mpc_uint32_t seek_table_size; /// used size in seek_table
--
--	// chapters
--	mpc_seek_t chap_pos; /// supposed position of the first chapter block
--	mpc_int_t chap_nb; /// number of chapters (-1 if unknown, 0 if no chapter)
--	mpc_chap_info * chap; /// chapters position and tag
--
--};
--
--/// helper functions used by multiple files
--mpc_uint32_t mpc_random_int(mpc_decoder *d); // in synth_filter.c
--void mpc_decoder_init_quant(mpc_decoder *d, double scale_factor);
--void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData, mpc_int_t channels);
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/mpc/minimax.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc/minimax.h	2010-12-08 16:27:44.516000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,57 +0,0 @@
--/*
-- * Musepack audio compression
-- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License as published by the Free Software Foundation; either
-- * version 2.1 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-- */
--
--#pragma once
--
--# define clip(x,min,max) ( (x) < (min) ? (min) : (x) > (max) ? (max) : (x) )
--
--#ifdef __cplusplus
--
--# define maxi(A,B)  ( (A) >? (B) )
--# define mini(A,B)  ( (A) <? (B) )
--# define maxd(A,B)  ( (A) >? (B) )
--# define mind(A,B)  ( (A) <? (B) )
--# define maxf(A,B)  ( (A) >? (B) )
--# define minf(A,B)  ( (A) <? (B) )
--
--#else
--
--# define maxi(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
--# define mini(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
--# define maxd(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
--# define mind(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
--# define maxf(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
--# define minf(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
--
--#endif
--
--#ifdef __GNUC__
--
--# define absi(A)    abs   (A)
--# define absf(A)    fabsf (A)
--# define absd(A)    fabs  (A)
--
--#else
--
--# define absi(A)    ( (A) >= 0    ?  (A)  : -(A) )
--# define absf(A)    ( (A) >= 0.f  ?  (A)  : -(A) )
--# define absd(A)    ( (A) >= 0.   ?  (A)  : -(A) )
--
--#endif
--
-Index: deadbeef/plugins/musepack/mpc/mpc_types.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc/mpc_types.h	2010-12-08 16:27:44.484000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,138 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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.
--*/
--#ifndef _MPC_TYPES_H_
--#define _MPC_TYPES_H_
--#ifdef WIN32
--#pragma once
--#endif
--
--#include <stdlib.h>
--#include <memory.h>
--
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifdef _MSC_VER
--typedef __int8           mpc_int8_t;
--typedef unsigned __int8  mpc_uint8_t;
--typedef __int16          mpc_int16_t;
--typedef unsigned __int16 mpc_uint16_t;
--typedef __int32          mpc_int32_t;
--typedef unsigned __int32 mpc_uint32_t;
--typedef __int64          mpc_int64_t;
--typedef unsigned __int64 mpc_uint64_t;
--#define mpc_inline __inline
--#else
--#include <stdint.h>
--typedef int8_t   mpc_int8_t;
--typedef uint8_t  mpc_uint8_t;
--typedef int16_t  mpc_int16_t;
--typedef uint16_t mpc_uint16_t;
--typedef int32_t  mpc_int32_t;
--typedef uint32_t mpc_uint32_t;
--typedef int64_t  mpc_int64_t;
--typedef uint64_t  mpc_uint64_t;
--#define mpc_inline inline
--#endif
--
--typedef int mpc_int_t;
--typedef unsigned int mpc_uint_t;
--typedef size_t mpc_size_t;
--typedef mpc_uint8_t mpc_bool_t;
--
--// #define LONG_SEEK_TABLE
--#ifdef LONG_SEEK_TABLE  // define as needed (mpc_uint32_t supports files up to 512 MB)
--typedef mpc_uint64_t mpc_seek_t;
--#else
--typedef mpc_uint32_t mpc_seek_t;
--#endif
--
--# define mpc_int64_min -9223372036854775808ll
--# define mpc_int64_max 9223372036854775807ll
--
--typedef struct mpc_quantizer {
--	mpc_int16_t  L [36];
--	mpc_int16_t  R [36];
--} mpc_quantizer;
--
--/// Libmpcdec error codes
--typedef enum mpc_status {
--    MPC_STATUS_OK        =  0,
--    MPC_STATUS_FILE      = -1,
--    MPC_STATUS_SV7BETA   = -2,
--    MPC_STATUS_CBR       = -3,
--    MPC_STATUS_IS        = -4,
--    MPC_STATUS_BLOCKSIZE = -5,
--    MPC_STATUS_INVALIDSV = -6
--} mpc_status;
--
--
--#define MPC_FIXED_POINT_SHIFT 16
--
--#ifdef MPC_FIXED_POINT
--# define MPC_FIXED_POINT_FRACTPART 14
--# define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART)
--# define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1))
--typedef mpc_int32_t MPC_SAMPLE_FORMAT;
--#else
--typedef float       MPC_SAMPLE_FORMAT;
--#endif
--
--enum {
--    MPC_FALSE = 0,
--    MPC_TRUE  = !MPC_FALSE
--};
--
--//// '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 __GNUC__
--# define MPC_API __attribute__ ((visibility("default")))
--#else
--# define MPC_API
--#endif
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/mpc/mpcdec.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc/mpcdec.h	2010-12-08 16:27:44.577000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,148 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 "reader.h"
--#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_demux_t mpc_demux;
--
--typedef struct mpc_bits_reader_t {
--	unsigned char * buff; /// pointer on current byte
--	unsigned int count; /// unread bits in current byte
--} mpc_bits_reader;
--
--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;
--
--typedef struct mpc_chap_info_t {
--	mpc_uint64_t sample;	/// sample where the chapter starts
--	mpc_uint16_t gain;		/// replaygain chapter value
--	mpc_uint16_t peak;		/// peak chapter loudness level
--	mpc_uint_t tag_size;	/// size of the tag element (0 if no tag is present for this chapter)
--	char * tag;				/// pointer to an APEv2 tag without the preamble
--} mpc_chap_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_API mpc_decoder * mpc_decoder_init(mpc_streaminfo *si);
--
--/// Releases input mpc decoder
--MPC_API void mpc_decoder_exit(mpc_decoder *p_dec);
--
--/**
-- * Sets decoder sample scaling factor.  All decoded samples will be multiplied
-- * by this factor. Useful for applying replay gain.
-- * @param scale_factor multiplicative scaling factor
-- */
--MPC_API void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor);
--
--MPC_API void mpc_decoder_decode_frame(mpc_decoder * d, mpc_bits_reader * r, mpc_frame_info * i);
--
--// This is the gain reference used in old replaygain
--#define MPC_OLD_GAIN_REF 64.82
--
--/**
-- * init demuxer
-- * @param p_reader initialized mpc_reader pointer
-- * @return an initialized mpc_demux pointer
-- */
--MPC_API mpc_demux * mpc_demux_init(mpc_reader * p_reader);
--/// free demuxer
--MPC_API void mpc_demux_exit(mpc_demux * d);
--/**
-- * Calls mpc_decoder_scale_output to set the scaling factor according to the
-- * replay gain stream information and the supplied ouput level
-- * @param d pointer to a musepack demuxer
-- * @param level the desired ouput level (in db). Must be MPC_OLD_GAIN_REF (64.82 db) if you want to get the old replaygain behavior
-- * @param use_gain set it to MPC_TRUE if you want to set the scaling factor according to the stream gain
-- * @param use_title MPC_TRUE : uses the title gain, MPC_FALSE : uses the album gain
-- * @param clip_prevention MPC_TRUE : uses cliping prevention
-- */
--MPC_API void mpc_set_replay_level(mpc_demux * d, float level, mpc_bool_t use_gain,
--                          mpc_bool_t use_title, mpc_bool_t clip_prevention);
--/// decode frame
--MPC_API mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i);
--/// get streaminfo
--MPC_API void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i);
--/// seeks to a given sample
--MPC_API mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample);
--/// seeks to a given second
--MPC_API mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds);
--
--/// \return the current position in the stream (in bits) from the beginning of the file
--MPC_API mpc_seek_t mpc_demux_pos(mpc_demux * d);
--
--/// chapters : only for sv8 streams
--/**
-- * Gets the number of chapters in the stream
-- * @param d pointer to a musepack demuxer
-- * @return the number of chapters found in the stream
-- */
--MPC_API mpc_int_t mpc_demux_chap_nb(mpc_demux * d);
--/**
-- * Gets datas associated to a given chapter
-- * The chapter tag is an APEv2 tag without the preamble
-- * @param d pointer to a musepack demuxer
-- * @param chap_nb chapter number you want datas (from 0 to mpc_demux_chap_nb(d) - 1)
-- * @return the chapter information structure
-- */
--MPC_API mpc_chap_info const * mpc_demux_chap(mpc_demux * d, int chap_nb);
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/mpc/reader.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc/reader.h	2010-12-08 16:27:44.613000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,98 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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>
--#include <stdio.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_API mpc_status mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename);
--
--/// Initializes reader with default stdio file reader implementation.  Use
--/// this if you prefer to open the file yourself.
--///
--/// \param r p_reader handle to initialize
--/// \param p_file input file handle (already open)
--MPC_API mpc_status mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file);
--
--/// Release reader with default stdio file reader implementation.
--///
--/// \param r reader handle to release
--MPC_API void mpc_reader_exit_stdio(mpc_reader *p_reader);
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/mpc/streaminfo.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc/streaminfo.h	2010-12-08 16:27:44.546000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,109 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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>
--
--#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_uint16_t         gain_title;         ///< Replaygain title value
--    mpc_uint16_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
--	mpc_uint64_t         beg_silence;        ///< Number of samples that must not be played at the beginning of 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
--	float                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
--MPC_API double mpc_streaminfo_get_length(mpc_streaminfo *si);
--
--/// Returns length of stream si, in samples.
--/// \return length of stream in samples
--MPC_API mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si);
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/mpc_bits_reader.c
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc_bits_reader.c	2010-12-08 16:27:44.272000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,179 +0,0 @@
--/*
--  Copyright (c) 2007-2009, 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.
--*/
--
--#include <mpc/mpcdec.h>
--#include "internal.h"
--#include "huffman.h"
--#include "mpc_bits_reader.h"
--
--const mpc_uint32_t Cnk[MAX_ENUM / 2][MAX_ENUM] =
--{
--	{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},
--	{0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465},
--	{0, 0, 0, 1, 4, 10, 20, 35, 56, 84, 120, 165, 220, 286, 364, 455, 560, 680, 816, 969, 1140, 1330, 1540, 1771, 2024, 2300, 2600, 2925, 3276, 3654, 4060, 4495},
--	{0, 0, 0, 0, 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465},
--	{0, 0, 0, 0, 0, 1, 6, 21, 56, 126, 252, 462, 792, 1287, 2002, 3003, 4368, 6188, 8568, 11628, 15504, 20349, 26334, 33649, 42504, 53130, 65780, 80730, 98280, 118755, 142506, 169911},
--	{0, 0, 0, 0, 0, 0, 1, 7, 28, 84, 210, 462, 924, 1716, 3003, 5005, 8008, 12376, 18564, 27132, 38760, 54264, 74613, 100947, 134596, 177100, 230230, 296010, 376740, 475020, 593775, 736281},
--	{0, 0, 0, 0, 0, 0, 0, 1, 8, 36, 120, 330, 792, 1716, 3432, 6435, 11440, 19448, 31824, 50388, 77520, 116280, 170544, 245157, 346104, 480700, 657800, 888030, 1184040, 1560780, 2035800, 2629575},
--	{0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 45, 165, 495, 1287, 3003, 6435, 12870, 24310, 43758, 75582, 125970, 203490, 319770, 490314, 735471, 1081575, 1562275, 2220075, 3108105, 4292145, 5852925, 7888725},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10, 55, 220, 715, 2002, 5005, 11440, 24310, 48620, 92378, 167960, 293930, 497420, 817190, 1307504, 2042975, 3124550, 4686825, 6906900, 10015005, 14307150, 20160075},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 66, 286, 1001, 3003, 8008, 19448, 43758, 92378, 184756, 352716, 646646, 1144066, 1961256, 3268760, 5311735, 8436285, 13123110, 20030010, 30045015, 44352165},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 78, 364, 1365, 4368, 12376, 31824, 75582, 167960, 352716, 705432, 1352078, 2496144, 4457400, 7726160, 13037895, 21474180, 34597290, 54627300, 84672315},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 91, 455, 1820, 6188, 18564, 50388, 125970, 293930, 646646, 1352078, 2704156, 5200300, 9657700, 17383860, 30421755, 51895935, 86493225, 141120525},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 105, 560, 2380, 8568, 27132, 77520, 203490, 497420, 1144066, 2496144, 5200300, 10400600, 20058300, 37442160, 67863915, 119759850, 206253075},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 15, 120, 680, 3060, 11628, 38760, 116280, 319770, 817190, 1961256, 4457400, 9657700, 20058300, 40116600, 77558760, 145422675, 265182525},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 136, 816, 3876, 15504, 54264, 170544, 490314, 1307504, 3268760, 7726160, 17383860, 37442160, 77558760, 155117520, 300540195},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 153, 969, 4845, 20349, 74613, 245157, 735471, 2042975, 5311735, 13037895, 30421755, 67863915, 145422675, 300540195}
--};
--
--const mpc_uint8_t Cnk_len[MAX_ENUM / 2][MAX_ENUM] =
--{
--	{0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
--	{0, 0, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9},
--	{0, 0, 0, 2, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13},
--	{0, 0, 0, 0, 3, 4, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16},
--	{0, 0, 0, 0, 0, 3, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18},
--	{0, 0, 0, 0, 0, 0, 3, 5, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20},
--	{0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22},
--	{0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 9, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 23, 24},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 10, 12, 13, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 25, 26, 26},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 27},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 11, 13, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 28},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 10, 12, 14, 15, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 10, 12, 14, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 28, 29},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 10, 12, 14, 16, 18, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 13, 15, 17, 18, 20, 21, 23, 24, 25, 27, 28, 29, 30}
--
--};
--
--const mpc_uint32_t Cnk_lost[MAX_ENUM / 2][MAX_ENUM] =
--{
--	{0, 0, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
--	{0, 0, 1, 2, 6, 1, 11, 4, 28, 19, 9, 62, 50, 37, 23, 8, 120, 103, 85, 66, 46, 25, 3, 236, 212, 187, 161, 134, 106, 77, 47, 16},
--	{0, 0, 0, 0, 6, 12, 29, 8, 44, 8, 91, 36, 226, 148, 57, 464, 344, 208, 55, 908, 718, 508, 277, 24, 1796, 1496, 1171, 820, 442, 36, 3697, 3232},
--	{0, 0, 0, 0, 3, 1, 29, 58, 2, 46, 182, 17, 309, 23, 683, 228, 1716, 1036, 220, 3347, 2207, 877, 7529, 5758, 3734, 1434, 15218, 12293, 9017, 5363, 1303, 29576},
--	{0, 0, 0, 0, 0, 2, 11, 8, 2, 4, 50, 232, 761, 46, 1093, 3824, 2004, 7816, 4756, 880, 12419, 6434, 31887, 23032, 12406, 65292, 50342, 32792, 12317, 119638, 92233, 60768},
--	{0, 0, 0, 0, 0, 0, 1, 4, 44, 46, 50, 100, 332, 1093, 3187, 184, 4008, 14204, 5636, 26776, 11272, 56459, 30125, 127548, 85044, 31914, 228278, 147548, 49268, 454801, 312295, 142384},
--	{0, 0, 0, 0, 0, 0, 0, 0, 28, 8, 182, 232, 332, 664, 1757, 4944, 13320, 944, 15148, 53552, 14792, 91600, 16987, 178184, 43588, 390776, 160546, 913112, 536372, 61352, 1564729, 828448},
--	{0, 0, 0, 0, 0, 0, 0, 0, 7, 19, 91, 17, 761, 1093, 1757, 3514, 8458, 21778, 55490, 5102, 58654, 204518, 33974, 313105, 1015577, 534877, 1974229, 1086199, 4096463, 2535683, 499883, 6258916},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 9, 36, 309, 46, 3187, 4944, 8458, 16916, 38694, 94184, 230358, 26868, 231386, 789648, 54177, 1069754, 3701783, 1481708, 6762211, 2470066, 13394357, 5505632},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 62, 226, 23, 1093, 184, 13320, 21778, 38694, 77388, 171572, 401930, 953086, 135896, 925544, 3076873, 8340931, 3654106, 13524422, 3509417, 22756699, 2596624},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 50, 148, 683, 3824, 4008, 944, 55490, 94184, 171572, 343144, 745074, 1698160, 3931208, 662448, 3739321, 12080252, 32511574, 12481564, 49545413, 5193248},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 57, 228, 2004, 14204, 15148, 5102, 230358, 401930, 745074, 1490148, 3188308, 7119516, 16170572, 3132677, 15212929, 47724503, 127314931, 42642616},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 23, 464, 1716, 7816, 5636, 53552, 58654, 26868, 953086, 1698160, 3188308, 6376616, 13496132, 29666704, 66353813, 14457878, 62182381, 189497312},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 344, 1036, 4756, 26776, 14792, 204518, 231386, 135896, 3931208, 7119516, 13496132, 26992264, 56658968, 123012781, 3252931, 65435312},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 208, 220, 880, 11272, 91600, 33974, 789648, 925544, 662448, 16170572, 29666704, 56658968, 113317936, 236330717, 508019104},
--	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 103, 55, 3347, 12419, 56459, 16987, 313105, 54177, 3076873, 3739321, 3132677, 66353813, 123012781, 236330717}
--};
--
--static const mpc_uint8_t log2[32] =
--{ 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6};
--
--static const mpc_uint8_t log2_lost[32] =
--{ 0, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31};
--
--mpc_int32_t mpc_bits_golomb_dec(mpc_bits_reader * r, const mpc_uint_t k)
--{
--	unsigned int l = 0;
--	unsigned int code = r->buff[0] & ((1 << r->count) - 1);
--
--	while( code == 0 ) {
--		l += r->count;
--		r->buff++;
--		code = r->buff[0];
--		r->count = 8;
--	}
--
--	while( ((1 << (r->count - 1)) & code) == 0 ) {
--		l++;
--		r->count--;
--	}
--	r->count--;
--
--	while( r->count < k ) {
--		r->buff++;
--		r->count += 8;
--		code = (code << 8) | r->buff[0];
--	}
--
--	r->count -= k;
--
--	return (l << k) | ((code >> r->count) & ((1 << k) - 1));
--}
--
--mpc_uint32_t mpc_bits_log_dec(mpc_bits_reader * r, mpc_uint_t max)
--{
--	mpc_uint32_t value = 0;
--	if (log2[max - 1] > 1)
--		value = mpc_bits_read(r, log2[max - 1] - 1);
--	if (value >= log2_lost[max - 1])
--		value = ((value << 1) | mpc_bits_read(r, 1)) - log2_lost[max - 1];
--	return value;
--}
--
--unsigned int mpc_bits_get_size(mpc_bits_reader * r, mpc_uint64_t * p_size)
--{
--	unsigned char tmp;
--	mpc_uint64_t size = 0;
--	unsigned int ret = 0;
--
--	do {
--		tmp = mpc_bits_read(r, 8);
--		size = (size << 7) | (tmp & 0x7F);
--		ret++;
--	} while((tmp & 0x80));
--
--	*p_size = size;
--	return ret;
--}
--
--int mpc_bits_get_block(mpc_bits_reader * r, mpc_block * p_block)
--{
--	int size = 2;
--
--	p_block->size = 0;
--	p_block->key[0] = mpc_bits_read(r, 8);
--	p_block->key[1] = mpc_bits_read(r, 8);
--
--	size += mpc_bits_get_size(r, &(p_block->size));
--
--	if (p_block->size >= size) // check if the block size doesn't conflict with the header size
--		p_block->size -= size;
--
--	return size;
--}
--
--
--
-Index: deadbeef/plugins/musepack/mpc_bits_reader.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc_bits_reader.h	2010-12-08 16:27:44.238000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,149 +0,0 @@
--/*
--  Copyright (c) 2007-2009, 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.
--*/
--
--#define MAX_ENUM 32
--
--MPC_API int mpc_bits_get_block(mpc_bits_reader * r, mpc_block * p_block);
--mpc_int32_t mpc_bits_golomb_dec(mpc_bits_reader * r, const mpc_uint_t k);
--MPC_API unsigned int mpc_bits_get_size(mpc_bits_reader * r, mpc_uint64_t * p_size);
--mpc_uint32_t mpc_bits_log_dec(mpc_bits_reader * r, mpc_uint_t max);
--
--extern const mpc_uint32_t Cnk[MAX_ENUM / 2][MAX_ENUM];
--extern const mpc_uint8_t Cnk_len[MAX_ENUM / 2][MAX_ENUM];
--extern const mpc_uint32_t Cnk_lost[MAX_ENUM / 2][MAX_ENUM];
--
--// can read up to 31 bits
--static mpc_inline mpc_uint32_t mpc_bits_read(mpc_bits_reader * r, const unsigned int nb_bits)
--{
--	mpc_uint32_t ret;
--
--	r->buff -= (int)(r->count - nb_bits) >> 3;
--	r->count = (r->count - nb_bits) & 0x07;
--
--	ret = (r->buff[0] | (r->buff[-1] << 8)) >> r->count;
--	if (nb_bits > (16 - r->count)) {
--		ret |= (mpc_uint32_t)((r->buff[-2] << 16) | (r->buff[-3] << 24)) >> r->count;
--		if (nb_bits > 24 && r->count != 0)
--			ret |= r->buff[-4] << (32 - r->count);
--	}
--
--	return ret & ((1 << nb_bits) - 1);
--}
--
--// basic huffman decoding routine
--// works with maximum lengths up to 16
--static mpc_inline mpc_int32_t mpc_bits_huff_dec(mpc_bits_reader * r, const mpc_huffman *Table)
--{
--	mpc_uint16_t code;
--	code = (mpc_uint16_t)((((r->buff[0] << 16) | (r->buff[1] << 8) | r->buff[2]) >> r->count) & 0xFFFF);
--
--	while (code < Table->Code) Table++;
--
--	r->buff -= (int)(r->count - Table->Length) >> 3;
--	r->count = (r->count - Table->Length) & 0x07;
--
--	return Table->Value;
--}
--
--static mpc_inline mpc_int32_t mpc_bits_can_dec(mpc_bits_reader * r, const mpc_can_data *can)
--{
--	mpc_uint16_t code;
--	mpc_huff_lut tmp;
--	const mpc_huffman * Table;
--	code = (mpc_uint16_t)((((r->buff[0] << 16) | (r->buff[1] << 8) | r->buff[2]) >> r->count) & 0xFFFF);
--
--	tmp = can->lut[code >> (16 - LUT_DEPTH)];
--	if (tmp.Length != 0) {
--		r->buff -= (int)(r->count - tmp.Length) >> 3;
--		r->count = (r->count - tmp.Length) & 0x07;
--		return tmp.Value;
--	}
--
--	Table = can->table + (unsigned char)tmp.Value;
--	while (code < Table->Code) Table++;
--
--	r->buff -= (int)(r->count - Table->Length) >> 3;
--	r->count = (r->count - Table->Length) & 0x07;
--
--	return can->sym[(Table->Value - (code >> (16 - Table->Length))) & 0xFF] ;
--}
--
--// LUT-based huffman decoding routine
--// works with maximum lengths up to 16
--static mpc_inline mpc_int32_t mpc_bits_huff_lut(mpc_bits_reader * r, const mpc_lut_data *lut)
--{
--	mpc_uint16_t code;
--	mpc_huff_lut tmp;
--	const mpc_huffman * Table;
--	code = (mpc_uint16_t)((((r->buff[0] << 16) | (r->buff[1] << 8) | r->buff[2]) >> r->count) & 0xFFFF);
--
--	tmp = lut->lut[code >> (16 - LUT_DEPTH)];
--	if (tmp.Length != 0) {
--		r->buff -= (int)(r->count - tmp.Length) >> 3;
--		r->count = (r->count - tmp.Length) & 0x07;
--		return tmp.Value;
--	}
--
--	Table = lut->table + (unsigned char)tmp.Value;
--	while (code < Table->Code) Table++;
--
--	r->buff -= (int)(r->count - Table->Length) >> 3;
--	r->count = (r->count - Table->Length) & 0x07;
--
--	return Table->Value;
--}
--
--static mpc_inline mpc_uint32_t mpc_bits_enum_dec(mpc_bits_reader * r, mpc_uint_t k, mpc_uint_t n)
--{
--	mpc_uint32_t bits = 0;
--	mpc_uint32_t code;
--	const mpc_uint32_t * C = Cnk[k-1];
--
--	code = mpc_bits_read(r, Cnk_len[k-1][n-1] - 1);
--
--	if (code >= Cnk_lost[k-1][n-1])
--		code = ((code << 1) | mpc_bits_read(r, 1)) - Cnk_lost[k-1][n-1];
--
--	do {
--		n--;
--		if (code >= C[n]) {
--			bits |= 1 << n;
--			code -= C[n];
--			C -= MAX_ENUM;
--			k--;
--		}
--	} while(k > 0);
--
--	return bits;
--}
-Index: deadbeef/plugins/musepack/mpc_decoder.c
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc_decoder.c	2010-12-08 16:27:44.452000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,681 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 mpc_decoder.c
--/// Core decoding routines and logic.
--
--#include <string.h>
--#include <mpc/mpcdec.h>
--#include <mpc/minimax.h>
--#include "decoder.h"
--#include "huffman.h"
--#include "internal.h"
--#include "mpcdec_math.h"
--#include "requant.h"
--#include "mpc_bits_reader.h"
--
--//SV7 tables
--extern const mpc_lut_data   mpc_HuffQ [7] [2];
--extern const mpc_lut_data   mpc_HuffHdr;
--extern const mpc_huffman    mpc_table_HuffSCFI [ 4];
--extern const mpc_lut_data   mpc_HuffDSCF;
--
--//SV8 tables
--extern const mpc_can_data mpc_can_Bands;
--extern const mpc_can_data mpc_can_SCFI[2];
--extern const mpc_can_data mpc_can_DSCF[2];
--extern const mpc_can_data mpc_can_Res [2];
--extern const mpc_can_data mpc_can_Q [8][2];
--extern const mpc_can_data mpc_can_Q1;
--extern const mpc_can_data mpc_can_Q9up;
--
--//------------------------------------------------------------------------------
--// types
--//------------------------------------------------------------------------------
--enum
--{
--    MEMSIZE   = MPC_DECODER_MEMSIZE, // overall buffer size
--    MEMSIZE2  = (MEMSIZE/2),         // size of one buffer
--    MEMMASK   = (MEMSIZE-1)
--};
--
--//------------------------------------------------------------------------------
--// forward declarations
--//------------------------------------------------------------------------------
--void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r);
--void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r,
--									mpc_bool_t is_key_frame);
--static void mpc_decoder_requantisierung(mpc_decoder *d);
--
--/**
-- * set the scf indexes for seeking use
-- * needed only for sv7 seeking
-- * @param d
-- */
--void mpc_decoder_reset_scf(mpc_decoder * d, int value)
--{
--	memset(d->SCF_Index_L, value, sizeof d->SCF_Index_L );
--	memset(d->SCF_Index_R, value, sizeof d->SCF_Index_R );
--}
--
--
--void mpc_decoder_setup(mpc_decoder *d)
--{
--	memset(d, 0, sizeof *d);
--
--	d->__r1 = 1;
--	d->__r2 = 1;
--
--	mpc_decoder_init_quant(d, 1.0f);
--}
--
--void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
--{
--	d->stream_version     = si->stream_version;
--	d->ms                 = si->ms;
--	d->max_band           = si->max_band;
--	d->channels           = si->channels;
--	d->samples_to_skip    = MPC_DECODER_SYNTH_DELAY + si->beg_silence;
--
--	if (si->stream_version == 7 && si->is_true_gapless)
--		d->samples = ((si->samples + MPC_FRAME_LENGTH - 1) / MPC_FRAME_LENGTH) * MPC_FRAME_LENGTH;
--	else
--		d->samples = si->samples;
--}
--
--mpc_decoder * mpc_decoder_init(mpc_streaminfo *si)
--{
--	mpc_decoder* p_tmp = malloc(sizeof(mpc_decoder));
--
--	if (p_tmp != 0) {
--		mpc_decoder_setup(p_tmp);
--		mpc_decoder_set_streaminfo(p_tmp, si);
--		huff_init_lut(LUT_DEPTH); // FIXME : this needs to be called only once when the library is loaded
--	}
--
--	return p_tmp;
--}
--
--void mpc_decoder_exit(mpc_decoder *d)
--{
--	free(d);
--}
--
--void mpc_decoder_decode_frame(mpc_decoder * d,
--							  mpc_bits_reader * r,
--							  mpc_frame_info * i)
--{
--	mpc_bits_reader r_sav = *r;
--	mpc_int64_t samples_left;
--
--	samples_left = d->samples - d->decoded_samples + MPC_DECODER_SYNTH_DELAY;
--
--	if (samples_left <= 0 && d->samples != 0) {
--		i->samples = 0;
--		i->bits = -1;
--		return;
--	}
--
--	if (d->stream_version == 8)
--		mpc_decoder_read_bitstream_sv8(d, r, i->is_key_frame);
--	else
--		mpc_decoder_read_bitstream_sv7(d, r);
--
--	if (d->samples_to_skip < MPC_FRAME_LENGTH + MPC_DECODER_SYNTH_DELAY) {
--		mpc_decoder_requantisierung(d);
--		mpc_decoder_synthese_filter_float(d, i->buffer, d->channels);
--	}
--
--	d->decoded_samples += MPC_FRAME_LENGTH;
--
--    // reconstruct exact filelength
--	if (d->decoded_samples - d->samples < MPC_FRAME_LENGTH && d->stream_version == 7) {
--		int last_frame_samples = mpc_bits_read(r, 11);
--		if (d->decoded_samples == d->samples) {
--			if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH;
--			d->samples += last_frame_samples - MPC_FRAME_LENGTH;
--			samples_left += last_frame_samples - MPC_FRAME_LENGTH;
--		}
--	}
--
--	i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : (mpc_uint32_t) samples_left;
--	i->bits = (mpc_uint32_t) (((r->buff - r_sav.buff) << 3) + r_sav.count - r->count);
--
--	if (d->samples_to_skip) {
--		if (i->samples <= d->samples_to_skip) {
--			d->samples_to_skip -= i->samples;
--			i->samples = 0;
--		} else {
--			i->samples -= d->samples_to_skip;
--			memmove(i->buffer, i->buffer + d->samples_to_skip * d->channels,
--					i->samples * d->channels * sizeof (MPC_SAMPLE_FORMAT));
--			d->samples_to_skip = 0;
--		}
--	}
--}
--
--void
--mpc_decoder_requantisierung(mpc_decoder *d)
--{
--    mpc_int32_t     Band;
--    mpc_int32_t     n;
--    MPC_SAMPLE_FORMAT facL;
--    MPC_SAMPLE_FORMAT facR;
--    MPC_SAMPLE_FORMAT templ;
--    MPC_SAMPLE_FORMAT tempr;
--    MPC_SAMPLE_FORMAT* YL;
--    MPC_SAMPLE_FORMAT* YR;
--    mpc_int16_t*    L;
--    mpc_int16_t*    R;
--	const mpc_int32_t Last_Band = d->max_band;
--
--#ifdef MPC_FIXED_POINT
--#if MPC_FIXED_POINT_FRACTPART == 14
--#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \
--    MPC_MULTIPLY_EX(CcVal, d->SCF[SCF_idx], d->SCF_shift[SCF_idx])
--#else
--
--#error FIXME, Cc table is in 18.14 format
--
--#endif
--#else
--#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \
--    MPC_MULTIPLY(CcVal, d->SCF[SCF_idx])
--#endif
--    // requantization and scaling of subband-samples
--    for ( Band = 0; Band <= Last_Band; Band++ ) {   // setting pointers
--        YL = d->Y_L[0] + Band;
--        YR = d->Y_R[0] + Band;
--        L  = d->Q[Band].L;
--        R  = d->Q[Band].R;
--        /************************** MS-coded **************************/
--        if ( d->MS_Flag [Band] ) {
--            if ( d->Res_L [Band] ) {
--                if ( d->Res_R [Band] ) {    // M!=0, S!=0
--                    facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][0] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][0] & 0xFF);
--                    for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YL   = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++));
--                        *YR   = templ - tempr;
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][1] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][1] & 0xFF);
--                    for ( ; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YL   = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++));
--                        *YR   = templ - tempr;
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][2] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][2] & 0xFF);
--                    for ( ; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YL   = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++));
--                        *YR   = templ - tempr;
--                    }
--                } else {    // M!=0, S==0
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][0] & 0xFF);
--                    for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][1] & 0xFF);
--                    for ( ; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][2] & 0xFF);
--                    for ( ; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                    }
--                }
--            } else {
--                if (d->Res_R[Band])    // M==0, S!=0
--                {
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][0] & 0xFF);
--                    for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++)));
--                    }
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][1] & 0xFF);
--                    for ( ; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++)));
--                    }
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][2] & 0xFF);
--                    for ( ; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++)));
--                    }
--                } else {    // M==0, S==0
--                    for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YR = *YL = 0;
--                    }
--                }
--            }
--        }
--        /************************** LR-coded **************************/
--        else {
--            if ( d->Res_L [Band] ) {
--                if ( d->Res_R [Band] ) {    // L!=0, R!=0
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][0] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][0] & 0xFF);
--                    for (n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][1] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][1] & 0xFF);
--                    for (; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][2] & 0xFF);
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][2] & 0xFF);
--                    for (; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--                } else {     // L!=0, R==0
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][0] & 0xFF);
--                    for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = 0;
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][1] & 0xFF);
--                    for ( ; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = 0;
--                    }
--					facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][2] & 0xFF);
--                    for ( ; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++);
--                        *YR = 0;
--                    }
--                }
--            }
--            else {
--                if ( d->Res_R [Band] ) {    // L==0, R!=0
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][0] & 0xFF);
--                    for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) {
--                        *YL = 0;
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][1] & 0xFF);
--                    for ( ; n < 24; n++, YL += 32, YR += 32 ) {
--                        *YL = 0;
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--					facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][2] & 0xFF);
--                    for ( ; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YL = 0;
--                        *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++);
--                    }
--                } else {    // L==0, R==0
--                    for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) {
--                        *YR = *YL = 0;
--                    }
--                }
--            }
--        }
--    }
--}
--
--void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r)
--{
--    // these arrays hold decoding results for bundled quantizers (3- and 5-step)
--    static const mpc_int32_t idx30[] = { -1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1};
--    static const mpc_int32_t idx31[] = { -1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1};
--    static const mpc_int32_t idx32[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
--    static const mpc_int32_t idx50[] = { -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
--    static const mpc_int32_t idx51[] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
--
--    mpc_int32_t n, idx, Max_used_Band = 0;
--
--    /***************************** Header *****************************/
--
--    // first subband
--	d->Res_L[0] = mpc_bits_read(r, 4);
--	d->Res_R[0] = mpc_bits_read(r, 4);
--	if (!(d->Res_L[0] == 0 && d->Res_R[0] == 0)) {
--		if (d->ms)
--        	d->MS_Flag[0] = mpc_bits_read(r, 1);
--		Max_used_Band = 1;
--	}
--
--    // consecutive subbands
--	for ( n = 1; n <= d->max_band; n++ ) {
--		idx   = mpc_bits_huff_lut(r, & mpc_HuffHdr);
--		d->Res_L[n] = (idx!=4) ? d->Res_L[n - 1] + idx : (int) mpc_bits_read(r, 4);
--
--		idx   = mpc_bits_huff_lut(r, & mpc_HuffHdr);
--		d->Res_R[n] = (idx!=4) ? d->Res_R[n - 1] + idx : (int) mpc_bits_read(r, 4);
--
--		if (!(d->Res_L[n] == 0 && d->Res_R[n] == 0)) {
--			if (d->ms)
--            	d->MS_Flag[n] = mpc_bits_read(r, 1);
--			Max_used_Band = n + 1;
--		}
--    }
--
--    /****************************** SCFI ******************************/
--    for ( n = 0; n < Max_used_Band; n++ ) {
--		if (d->Res_L[n])
--			d->SCFI_L[n] = mpc_bits_huff_dec(r, mpc_table_HuffSCFI);
--		if (d->Res_R[n])
--			d->SCFI_R[n] = mpc_bits_huff_dec(r, mpc_table_HuffSCFI);
--    }
--
--    /**************************** SCF/DSCF ****************************/
--    for ( n = 0; n < Max_used_Band; n++ ) {
--		mpc_int32_t * SCF = d->SCF_Index_L[n];
--		mpc_uint32_t Res  = d->Res_L[n], SCFI = d->SCFI_L[n];
--		do {
--			if (Res) {
--				switch (SCFI) {
--					case 1:
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[0] = (idx!=8) ? SCF[2] + idx : (int) mpc_bits_read(r, 6);
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[1] = (idx!=8) ? SCF[0] + idx : (int) mpc_bits_read(r, 6);
--						SCF[2] = SCF[1];
--						break;
--					case 3:
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[0] = (idx!=8) ? SCF[2] + idx : (int) mpc_bits_read(r, 6);
--						SCF[1] = SCF[0];
--						SCF[2] = SCF[1];
--						break;
--					case 2:
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[0] = (idx!=8) ? SCF[2] + idx : (int) mpc_bits_read(r, 6);
--						SCF[1] = SCF[0];
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[2] = (idx!=8) ? SCF[1] + idx : (int) mpc_bits_read(r, 6);
--						break;
--					case 0:
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[0] = (idx!=8) ? SCF[2] + idx : (int) mpc_bits_read(r, 6);
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[1] = (idx!=8) ? SCF[0] + idx : (int) mpc_bits_read(r, 6);
--						idx  = mpc_bits_huff_lut(r, & mpc_HuffDSCF);
--						SCF[2] = (idx!=8) ? SCF[1] + idx : (int) mpc_bits_read(r, 6);
--						break;
--					default:
--						return;
--				}
--				if (SCF[0] > 1024)
--					SCF[0] = 0x8080;
--				if (SCF[1] > 1024)
--					SCF[1] = 0x8080;
--				if (SCF[2] > 1024)
--					SCF[2] = 0x8080;
--			}
--			Res = d->Res_R[n];
--			SCFI = d->SCFI_R[n];
--		} while ( SCF == d->SCF_Index_L[n] && (SCF = d->SCF_Index_R[n]));
--    }
--
--//     if (d->seeking == TRUE)
--//         return;
--
--    /***************************** Samples ****************************/
--    for ( n = 0; n < Max_used_Band; n++ ) {
--		mpc_int16_t *q = d->Q[n].L, Res = d->Res_L[n];
--		do {
--			mpc_int32_t k;
--			const mpc_lut_data *Table;
--			switch (Res) {
--				case  -2: case  -3: case  -4: case  -5: case  -6: case  -7: case  -8: case  -9:
--				case -10: case -11: case -12: case -13: case -14: case -15: case -16: case -17: case 0:
--					break;
--				case -1:
--					for (k=0; k<36; k++ ) {
--						mpc_uint32_t tmp = mpc_random_int(d);
--						q[k] = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >>  8) & 0xFF) + ((tmp >>  0) & 0xFF) - 510;
--					}
--					break;
--				case 1:
--					Table = & mpc_HuffQ[0][mpc_bits_read(r, 1)];
--					for ( k = 0; k < 36; k += 3) {
--						idx = mpc_bits_huff_lut(r, Table);
--						q[k] = idx30[idx];
--						q[k + 1] = idx31[idx];
--						q[k + 2] = idx32[idx];
--					}
--					break;
--				case 2:
--					Table = & mpc_HuffQ[1][mpc_bits_read(r, 1)];
--					for ( k = 0; k < 36; k += 2) {
--						idx = mpc_bits_huff_lut(r, Table);
--						q[k] = idx50[idx];
--						q[k + 1] = idx51[idx];
--					}
--					break;
--				case 3:
--				case 4:
--				case 5:
--				case 6:
--				case 7:
--					Table = & mpc_HuffQ[Res - 1][mpc_bits_read(r, 1)];
--					for ( k = 0; k < 36; k++ )
--						q[k] = mpc_bits_huff_lut(r, Table);
--					break;
--				case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
--					for ( k = 0; k < 36; k++ )
--						q[k] = (mpc_int32_t)mpc_bits_read(r, Res_bit[Res]) - Dc[Res];
--					break;
--				default:
--					return;
--			}
--
--			Res = d->Res_R[n];
--		} while (q == d->Q[n].L && (q = d->Q[n].R));
--    }
--}
--
--void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, mpc_bool_t is_key_frame)
--{
--    // these arrays hold decoding results for bundled quantizers (3- and 5-step)
--	static const mpc_int8_t idx50[125] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
--	static const mpc_int8_t idx51[125] = {-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
--	static const mpc_int8_t idx52[125] = {-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
--
--	mpc_int32_t n, Max_used_Band;
--	const mpc_can_data * Table, * Tables[2];
--
--	/***************************** Header *****************************/
--
--	if (is_key_frame == MPC_TRUE) {
--		Max_used_Band = mpc_bits_log_dec(r, d->max_band + 1);
--	} else {
--		Max_used_Band = d->last_max_band + mpc_bits_can_dec(r, & mpc_can_Bands);
--		if (Max_used_Band > 32) Max_used_Band -= 33;
--	}
--	d->last_max_band = Max_used_Band;
--
--	if (Max_used_Band) {
--		d->Res_L[Max_used_Band-1] = mpc_bits_can_dec(r, & mpc_can_Res[0]);
--		d->Res_R[Max_used_Band-1] = mpc_bits_can_dec(r, & mpc_can_Res[0]);
--		if (d->Res_L[Max_used_Band-1] > 15) d->Res_L[Max_used_Band-1] -= 17;
--		if (d->Res_R[Max_used_Band-1] > 15) d->Res_R[Max_used_Band-1] -= 17;
--		for ( n = Max_used_Band - 2; n >= 0; n--) {
--			d->Res_L[n] = mpc_bits_can_dec(r, & mpc_can_Res[d->Res_L[n + 1] > 2]) + d->Res_L[n + 1];
--			if (d->Res_L[n] > 15) d->Res_L[n] -= 17;
--			d->Res_R[n] = mpc_bits_can_dec(r, & mpc_can_Res[d->Res_R[n + 1] > 2]) + d->Res_R[n + 1];
--			if (d->Res_R[n] > 15) d->Res_R[n] -= 17;
--		}
--
--		if (d->ms) {
--			int cnt = 0, tot = 0;
--			mpc_uint32_t tmp = 0;
--			for( n = 0; n < Max_used_Band; n++)
--				if ( d->Res_L[n] != 0 || d->Res_R[n] != 0 )
--					tot++;
--			cnt = mpc_bits_log_dec(r, tot);
--			if (cnt != 0 && cnt != tot)
--				tmp = mpc_bits_enum_dec(r, mini(cnt, tot-cnt), tot);
--			if (cnt * 2 > tot) tmp = ~tmp;
--			for( n = Max_used_Band - 1; n >= 0; n--)
--				if ( d->Res_L[n] != 0 || d->Res_R[n] != 0 ) {
--					d->MS_Flag[n] = tmp & 1;
--					tmp >>= 1;
--				}
--		}
--	}
--
--	for( n = Max_used_Band; n <= d->max_band; n++)
--		d->Res_L[n] = d->Res_R[n] = 0;
--
--	/****************************** SCFI ******************************/
--	if (is_key_frame == MPC_TRUE){
--		for( n = 0; n < 32; n++)
--			d->DSCF_Flag_L[n] = d->DSCF_Flag_R[n] = 1; // new block -> force key frame
--	}
--
--	Tables[0] = & mpc_can_SCFI[0];
--	Tables[1] = & mpc_can_SCFI[1];
--	for ( n = 0; n < Max_used_Band; n++ ) {
--		int tmp = 0, cnt = -1;
--		if (d->Res_L[n]) cnt++;
--		if (d->Res_R[n]) cnt++;
--		if (cnt >= 0) {
--			tmp = mpc_bits_can_dec(r, Tables[cnt]);
--			if (d->Res_L[n]) d->SCFI_L[n] = tmp >> (2 * cnt);
--			if (d->Res_R[n]) d->SCFI_R[n] = tmp & 3;
--		}
--	}
--
--	/**************************** SCF/DSCF ****************************/
--
--	for ( n = 0; n < Max_used_Band; n++ ) {
--		mpc_int32_t * SCF = d->SCF_Index_L[n];
--		mpc_uint32_t Res = d->Res_L[n], SCFI = d->SCFI_L[n];
--		mpc_bool_t * DSCF_Flag = &d->DSCF_Flag_L[n];
--
--		do {
--			if ( Res ) {
--				int m;
--				if (*DSCF_Flag == 1) {
--					SCF[0] = (mpc_int32_t)mpc_bits_read(r, 7) - 6;
--					*DSCF_Flag = 0;
--				} else {
--					mpc_uint_t tmp = mpc_bits_can_dec(r, & mpc_can_DSCF[1]);
--					if (tmp == 64)
--						tmp += mpc_bits_read(r, 6);
--					SCF[0] = ((SCF[2] - 25 + tmp) & 127) - 6;
--				}
--				for( m = 0; m < 2; m++){
--					if (((SCFI << m) & 2) == 0) {
--						mpc_uint_t tmp = mpc_bits_can_dec(r, & mpc_can_DSCF[0]);
--						if (tmp == 31)
--							tmp = 64 + mpc_bits_read(r, 6);
--						SCF[m + 1] = ((SCF[m] - 25 + tmp) & 127) - 6;
--					} else
--						SCF[m + 1] = SCF[m];
--				}
--			}
--			Res = d->Res_R[n];
--			SCFI = d->SCFI_R[n];
--			DSCF_Flag = &d->DSCF_Flag_R[n];
--		} while ( SCF == d->SCF_Index_L[n] && (SCF = d->SCF_Index_R[n]));
--	}
--
--	/***************************** Samples ****************************/
--	for ( n = 0; n < Max_used_Band; n++ ) {
--		mpc_int16_t *q = d->Q[n].L, Res = d->Res_L[n];
--		static const unsigned int thres[] = {0, 0, 3, 0, 0, 1, 3, 4, 8};
--		static const mpc_int8_t HuffQ2_var[5*5*5] =
--		{6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6};
--
--		do {
--			mpc_int32_t k = 0, idx = 1;
--			if (Res != 0) {
--				if (Res == 2) {
--					Tables[0] = & mpc_can_Q [0][0];
--					Tables[1] = & mpc_can_Q [0][1];
--					idx = 2 * thres[Res];
--					for ( ; k < 36; k += 3) {
--						int tmp = mpc_bits_can_dec(r, Tables[idx > thres[Res]]);
--						q[k] = idx50[tmp];
--						q[k + 1] = idx51[tmp];
--						q[k + 2] = idx52[tmp];
--						idx = (idx >> 1) + HuffQ2_var[tmp];
--					}
--				} else if (Res == 1) {
--					Table = & mpc_can_Q1;
--					for( ; k < 36; ){
--						int kmax = k + 18;
--						mpc_uint_t cnt = mpc_bits_can_dec(r, Table);
--						idx = 0;
--						if (cnt > 0 && cnt < 18)
--							idx = mpc_bits_enum_dec(r, cnt <= 9 ? cnt : 18 - cnt, 18);
--						if (cnt > 9) idx = ~idx;
--						for ( ; k < kmax; k++) {
--							q[k] = 0;
--							if ( idx & (1 << 17) )
--								q[k] = (mpc_bits_read(r, 1) << 1) - 1;
--							idx <<= 1;
--						}
--					}
--				} else if (Res == -1) {
--					for ( ; k<36; k++ ) {
--						mpc_uint32_t tmp = mpc_random_int(d);
--						q[k] = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >>  8) & 0xFF) + ((tmp >>  0) & 0xFF) - 510;
--					}
--				} else if (Res <= 4) {
--					Table = & mpc_can_Q[1][Res - 3];
--					for ( ; k < 36; k += 2 ) {
--						union {
--							mpc_int8_t sym;
--							struct { mpc_int8_t s1:4, s2:4; };
--						} tmp;
--						tmp.sym = mpc_bits_can_dec(r, Table);
--						q[k] = tmp.s1;
--						q[k + 1] = tmp.s2;
--					}
--				} else if (Res <= 8) {
--					Tables[0] = & mpc_can_Q [Res - 3][0];
--					Tables[1] = & mpc_can_Q [Res - 3][1];
--					idx = 2 * thres[Res];
--					for ( ; k < 36; k++ ) {
--						q[k] = mpc_bits_can_dec(r, Tables[idx > thres[Res]]);
--						idx = (idx >> 1) + absi(q[k]);
--					}
--				} else {
--					for ( ; k < 36; k++ ) {
--						q[k] = (unsigned char) mpc_bits_can_dec(r, & mpc_can_Q9up);
--						if (Res != 9)
--							q[k] = (q[k] << (Res - 9)) | mpc_bits_read(r, Res - 9);
--						q[k] -= Dc[Res];
--					}
--				}
--			}
--
--			Res = d->Res_R[n];
--		} while (q == d->Q[n].L && (q = d->Q[n].R));
--	}
--}
--
-Index: deadbeef/plugins/musepack/mpc_demux.c
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc_demux.c	2010-12-08 16:27:44.139000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,661 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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.
--*/
--
--#include <math.h>
--#include <string.h>
--#include <mpc/streaminfo.h>
--#include <mpc/mpcdec.h>
--#include "internal.h"
--#include "decoder.h"
--#include "huffman.h"
--#include "mpc_bits_reader.h"
--
--/// maximum number of seek points in the table. The distance between points will
--/// be adapted so this value is never exceeded.
--#define MAX_SEEK_TABLE_SIZE	65536
--
--// streaminfo.c
--mpc_status streaminfo_read_header_sv8(mpc_streaminfo* si,
--									  const mpc_bits_reader * r_in,
--									  mpc_size_t block_size);
--mpc_status streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r_in);
--void  streaminfo_encoder_info(mpc_streaminfo* si, const mpc_bits_reader * r_in);
--void  streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in);
--
--// mpc_decoder.c
--void mpc_decoder_reset_scf(mpc_decoder * d, int value);
--
--enum {
--	MPC_BUFFER_SWAP = 1,
--	MPC_BUFFER_FULL = 2,
--};
--
--static void mpc_demux_clear_buff(mpc_demux * d)
--{
--	d->bytes_total = 0;
--	d->bits_reader.buff = d->buffer;
--	d->bits_reader.count = 8;
--	d->block_bits = 0;
--	d->block_frames = 0;
--}
--
--static mpc_uint32_t
--mpc_demux_fill(mpc_demux * d, mpc_uint32_t min_bytes, int flags)
--{
--	mpc_uint32_t unread_bytes = d->bytes_total + d->buffer - d->bits_reader.buff
--			- ((8 - d->bits_reader.count) >> 3);
--	int offset = 0;
--
--	if (min_bytes == 0 || min_bytes > DEMUX_BUFFER_SIZE ||
--		    (unread_bytes < min_bytes && flags & MPC_BUFFER_FULL))
--		min_bytes = DEMUX_BUFFER_SIZE;
--
--	if (unread_bytes < min_bytes) {
--		mpc_uint32_t bytes2read = min_bytes - unread_bytes;
--		mpc_uint32_t bytes_free = DEMUX_BUFFER_SIZE - d->bytes_total;
--
--		if (flags & MPC_BUFFER_SWAP) {
--			bytes2read &= -1 << 2;
--			offset = (unread_bytes + 3) & ( -1 << 2);
--			offset -= unread_bytes;
--		}
--
--		if (bytes2read > bytes_free) {
--			if (d->bits_reader.count == 0) {
--				d->bits_reader.count = 8;
--				d->bits_reader.buff++;
--			}
--			memmove(d->buffer + offset, d->bits_reader.buff, unread_bytes);
--			d->bits_reader.buff = d->buffer + offset;
--			d->bytes_total = unread_bytes + offset;
--		}
--		bytes2read = d->r->read(d->r, d->buffer + d->bytes_total, bytes2read);
--		if (flags & MPC_BUFFER_SWAP){
--			unsigned int i, * tmp = (unsigned int *) (d->buffer + d->bytes_total);
--			for(i = 0 ;i < (bytes2read >> 2); i++)
--				tmp[i] = mpc_swap32(tmp[i]);
--		}
--		d->bytes_total += bytes2read;
--		return bytes2read;
--	}
--
--	return (mpc_uint32_t) -1;
--}
--
--/**
-- * checks if a block key is valid
-- * @param key the two caracters key to check
-- * @return MPC_STATUS_INVALIDSV if the key is invalid, MPC_STATUS_OK else
-- */
--static mpc_inline mpc_status mpc_check_key(char * key)
--{
--	if (key[0] < 65 || key[0] > 90 || key[1] < 65 || key[1] > 90)
--		return MPC_STATUS_INVALIDSV;
--	return MPC_STATUS_OK;
--}
--
--/**
-- * seek to a bit position in the stream
-- * @param d demuxer context
-- * @param fpos position in the stream in bits from the beginning of mpc datas
-- * @param min_bytes number of bytes to load after seeking
-- */
--static void
--mpc_demux_seek(mpc_demux * d, mpc_seek_t fpos, mpc_uint32_t min_bytes) {
--	mpc_seek_t next_pos;
--	mpc_int_t bit_offset;
--
--	// FIXME : do not flush the buffer if fpos is in the current buffer
--
--	next_pos = fpos >> 3;
--	if (d->si.stream_version == 7)
--		next_pos = ((next_pos - d->si.header_position) & (-1 << 2)) + d->si.header_position;
--	bit_offset = (int) (fpos - (next_pos << 3));
--
--	d->r->seek(d->r, (mpc_int32_t) next_pos);
--	mpc_demux_clear_buff(d);
--	if (d->si.stream_version == 7)
--		mpc_demux_fill(d, (min_bytes + ((bit_offset + 7) >> 3) + 3) & (~3), MPC_BUFFER_SWAP);
--	else
--		mpc_demux_fill(d, min_bytes + ((bit_offset + 7) >> 3), 0);
--	d->bits_reader.buff += bit_offset >> 3;
--	d->bits_reader.count = 8 - (bit_offset & 7);
--}
--
--/**
-- * return the current position in the stream (in bits) from the beginning
-- * of the file
-- * @param d demuxer context
-- * @return current stream position in bits
-- */
--mpc_seek_t mpc_demux_pos(mpc_demux * d)
--{
--	return (((mpc_seek_t)(d->r->tell(d->r)) - d->bytes_total +
--	         d->bits_reader.buff - d->buffer) << 3) + 8 - d->bits_reader.count;
--}
--
--/**
-- * Searches for a ID3v2-tag and reads the length (in bytes) of it.
-- *
-- * @param d demuxer context
-- * @return size of tag, in bytes
-- * @return MPC_STATUS_FILE on errors of any kind
-- */
--static mpc_int32_t mpc_demux_skip_id3v2(mpc_demux * d)
--{
--	mpc_uint8_t  tmp [4];
--	mpc_bool_t footerPresent;     // ID3v2.4-flag
--	mpc_int32_t size;
--
--    // we must be at the beginning of the stream
--	mpc_demux_fill(d, 3, 0);
--
--    // check id3-tag
--	if ( 0 != memcmp( d->bits_reader.buff, "ID3", 3 ) )
--		return 0;
--
--	mpc_demux_fill(d, 10, 0);
--
--	mpc_bits_read(&d->bits_reader, 24); // read ID3
--	mpc_bits_read(&d->bits_reader, 16); // read tag version
--
--	tmp[0] = mpc_bits_read(&d->bits_reader, 8); // read flags
--	footerPresent = tmp[0] & 0x10;
--	if ( tmp[0] & 0x0F )
--		return MPC_STATUS_FILE; // not (yet???) allowed
--
--	tmp[0] = mpc_bits_read(&d->bits_reader, 8); // read size
--	tmp[1] = mpc_bits_read(&d->bits_reader, 8); // read size
--	tmp[2] = mpc_bits_read(&d->bits_reader, 8); // read size
--	tmp[3] = mpc_bits_read(&d->bits_reader, 8); // read size
--
--	if ( (tmp[0] | tmp[1] | tmp[2] | tmp[3]) & 0x80 )
--		return MPC_STATUS_FILE; // not allowed
--
--    // read headerSize (syncsave: 4 * $0xxxxxxx = 28 significant bits)
--	size = tmp[0] << 21;
--	size |= tmp[1] << 14;
--	size |= tmp[2] << 7;
--	size |= tmp[3];
--
--	if ( footerPresent )
--		size += 10;
--
--	mpc_demux_fill(d, size, 0);
--	d->bits_reader.buff += size;
--
--	return size + 10;
--}
--
--static mpc_status mpc_demux_seek_init(mpc_demux * d)
--{
--	size_t seek_table_size;
--	if (d->seek_table != 0)
--		return MPC_STATUS_OK;
--
--	d->seek_pwr = 6;
--	if (d->si.block_pwr > d->seek_pwr)
--		d->seek_pwr = d->si.block_pwr;
--	seek_table_size = (2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr));
--	while (seek_table_size > MAX_SEEK_TABLE_SIZE) {
--		d->seek_pwr++;
--		seek_table_size = (2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr));
--	}
--	d->seek_table = malloc((size_t)(seek_table_size * sizeof(mpc_seek_t)));
--	if (d->seek_table == 0)
--		return MPC_STATUS_FILE;
--	d->seek_table[0] = (mpc_seek_t)mpc_demux_pos(d);
--	d->seek_table_size = 1;
--
--	return MPC_STATUS_OK;
--}
--
--static void mpc_demux_ST(mpc_demux * d)
--{
--	mpc_uint64_t tmp;
--	mpc_seek_t * table, last[2];
--	mpc_bits_reader r = d->bits_reader;
--	mpc_uint_t i, diff_pwr = 0, mask;
--	mpc_uint32_t file_table_size;
--
--	if (d->seek_table != 0)
--		return;
--
--	mpc_bits_get_size(&r, &tmp);
--	file_table_size = (mpc_seek_t) tmp;
--	d->seek_pwr = d->si.block_pwr + mpc_bits_read(&r, 4);
--
--	tmp = 2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr);
--	while (tmp > MAX_SEEK_TABLE_SIZE) {
--		d->seek_pwr++;
--		diff_pwr++;
--		tmp = 2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr);
--	}
--	if ((file_table_size >> diff_pwr) > tmp)
--		file_table_size = tmp << diff_pwr;
--	d->seek_table = malloc((size_t) (tmp * sizeof(mpc_seek_t)));
--	d->seek_table_size = (file_table_size + ((1 << diff_pwr) - 1)) >> diff_pwr;
--
--	table = d->seek_table;
--	mpc_bits_get_size(&r, &tmp);
--	table[0] = last[0] = (mpc_seek_t) (tmp + d->si.header_position) * 8;
--
--	if (d->seek_table_size == 1)
--		return;
--
--	mpc_bits_get_size(&r, &tmp);
--	last[1] = (mpc_seek_t) (tmp + d->si.header_position) * 8;
--	if (diff_pwr == 0) table[1] = last[1];
--
--	mask = (1 << diff_pwr) - 1;
--	for (i = 2; i < file_table_size; i++) {
--		int code = mpc_bits_golomb_dec(&r, 12);
--		if (code & 1)
--			code = -(code & (-1 << 1));
--		code <<= 2;
--		last[i & 1] = code + 2 * last[(i-1) & 1] - last[i & 1];
--		if ((i & mask) == 0)
--			table[i >> diff_pwr] = last[i & 1];
--	}
--}
--
--static void mpc_demux_SP(mpc_demux * d, int size, int block_size)
--{
--	mpc_seek_t cur;
--	mpc_uint64_t ptr;
--	mpc_block b;
--	int st_head_size;
--
--	cur = mpc_demux_pos(d);
--	mpc_bits_get_size(&d->bits_reader, &ptr);
--	mpc_demux_seek(d, (ptr - size) * 8 + cur, 11);
--	st_head_size = mpc_bits_get_block(&d->bits_reader, &b);
--	if (memcmp(b.key, "ST", 2) == 0) {
--		d->chap_pos = (ptr - size + b.size + st_head_size) * 8 + cur;
--		d->chap_nb = -1;
--		mpc_demux_fill(d, (mpc_uint32_t) b.size, 0);
--		mpc_demux_ST(d);
--	}
--	mpc_demux_seek(d, cur, 11 + block_size);
--}
--
--static void mpc_demux_chap_find(mpc_demux * d)
--{
--	mpc_block b;
--	int tag_size = 0, chap_size = 0, size, i = 0;
--
--	d->chap_nb = 0;
--
--	if (d->si.stream_version < 8)
--		return;
--
--	if (d->chap_pos == 0) {
--		mpc_uint64_t cur_pos = (d->si.header_position + 4) * 8;
--		mpc_demux_seek(d, cur_pos, 11); // seek to the beginning of the stream
--		size = mpc_bits_get_block(&d->bits_reader, &b);
--		while (memcmp(b.key, "SE", 2) != 0) {
--			if (mpc_check_key(b.key) != MPC_STATUS_OK)
--				return;
--			if (memcmp(b.key, "CT", 2) == 0) {
--				if (d->chap_pos == 0) d->chap_pos = cur_pos;
--			} else
--				d->chap_pos = 0;
--			cur_pos += (size + b.size) * 8;
--			mpc_demux_seek(d, cur_pos, 11);
--			size = mpc_bits_get_block(&d->bits_reader, &b);
--		}
--		if (d->chap_pos == 0)
--			d->chap_pos = cur_pos;
--	}
--
--	mpc_demux_seek(d, d->chap_pos, 20);
--	size = mpc_bits_get_block(&d->bits_reader, &b);
--	while (memcmp(b.key, "CT", 2) == 0) {
--		mpc_uint64_t chap_sample;
--		d->chap_nb++;
--		chap_size += size;
--		size = mpc_bits_get_size(&d->bits_reader, &chap_sample) + 4;
--		chap_size += size;
--		tag_size += b.size - size;
--		mpc_demux_seek(d, d->chap_pos + (chap_size + tag_size) * 8, 20);
--		size = mpc_bits_get_block(&d->bits_reader, &b);
--	}
--
--	if (d->chap_nb > 0) {
--		char * ptag;
--		d->chap = malloc(sizeof(mpc_chap_info) * d->chap_nb + tag_size);
--		ptag = (char*)(d->chap + d->chap_nb);
--
--		mpc_demux_seek(d, d->chap_pos, 11);
--		size = mpc_bits_get_block(&d->bits_reader, &b);
--		while (memcmp(b.key, "CT", 2) == 0) {
--			mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0);
--			size = mpc_bits_get_size(&d->bits_reader, &d->chap[i].sample) + 4;
--			d->chap[i].gain = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16);
--			d->chap[i].peak = (mpc_uint16_t) mpc_bits_read(&d->bits_reader, 16);
--			memcpy(ptag, d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3), b.size - size);
--			d->bits_reader.buff += b.size - size;
--			d->chap[i].tag_size = b.size - size;
--			d->chap[i].tag = ptag;
--			ptag += b.size - size;
--			i++;
--			size = mpc_bits_get_block(&d->bits_reader, &b);
--		}
--	}
--
--	d->bits_reader.buff -= size;
--}
--
--/**
-- * Gets the number of chapters in the stream
-- * @param d pointer to a musepack demuxer
-- * @return the number of chapters found in the stream
-- */
--mpc_int_t mpc_demux_chap_nb(mpc_demux * d)
--{
--	if (d->chap_nb == -1)
--		mpc_demux_chap_find(d);
--	return d->chap_nb;
--}
--
--/**
-- * Gets datas associated to a given chapter
-- * The chapter tag is an APEv2 tag without the preamble
-- * @param d pointer to a musepack demuxer
-- * @param chap_nb chapter number you want datas (from 0 to mpc_demux_chap_nb(d) - 1)
-- * @return the chapter information structure
-- */
--mpc_chap_info const * mpc_demux_chap(mpc_demux * d, int chap_nb)
--{
--	if (d->chap_nb == -1)
--		mpc_demux_chap_find(d);
--	if (chap_nb >= d->chap_nb || chap_nb < 0)
--		return 0;
--	return &d->chap[chap_nb];
--}
--
--static mpc_status mpc_demux_header(mpc_demux * d)
--{
--	char magic[4];
--
--	d->si.pns = 0xFF;
--	d->si.profile_name = "n.a.";
--
--    // get header position
--	d->si.header_position = mpc_demux_skip_id3v2(d);
--	if(d->si.header_position < 0) return MPC_STATUS_FILE;
--
--	d->si.tag_offset = d->si.total_file_length = d->r->get_size(d->r);
--
--	mpc_demux_fill(d, 4, 0);
--	magic[0] = mpc_bits_read(&d->bits_reader, 8);
--	magic[1] = mpc_bits_read(&d->bits_reader, 8);
--	magic[2] = mpc_bits_read(&d->bits_reader, 8);
--	magic[3] = mpc_bits_read(&d->bits_reader, 8);
--
--	if (memcmp(magic, "MP+", 3) == 0) {
--		d->si.stream_version = magic[3] & 15;
--		d->si.pns = magic[3] >> 4;
--		if (d->si.stream_version == 7) {
--			mpc_status ret;
--			mpc_demux_fill(d, 6 * 4, MPC_BUFFER_SWAP); // header block size + endian convertion
--			ret = streaminfo_read_header_sv7(&d->si, &d->bits_reader);
--			if (ret != MPC_STATUS_OK) return ret;
--		} else {
--			return MPC_STATUS_INVALIDSV;
--		}
--	} else if (memcmp(magic, "MPCK", 4) == 0) {
--		mpc_block b;
--		int size;
--		mpc_demux_fill(d, 11, 0); // max header block size
--		size = mpc_bits_get_block(&d->bits_reader, &b);
--		while( memcmp(b.key, "AP", 2) != 0 ){ // scan all blocks until audio
--			if (mpc_check_key(b.key) != MPC_STATUS_OK)
--				return MPC_STATUS_INVALIDSV;
--			if (b.size > (mpc_uint64_t) DEMUX_BUFFER_SIZE - 11)
--				return MPC_STATUS_INVALIDSV;
--			mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0);
--			if (memcmp(b.key, "SH", 2) == 0){
--				int ret = streaminfo_read_header_sv8(&d->si, &d->bits_reader, (mpc_uint32_t) b.size);
--				if (ret != MPC_STATUS_OK) return ret;
--			} else if (memcmp(b.key, "RG", 2) == 0)
--				streaminfo_gain(&d->si, &d->bits_reader);
--			else if (memcmp(b.key, "EI", 2) == 0)
--				streaminfo_encoder_info(&d->si, &d->bits_reader);
--			else if (memcmp(b.key, "SO", 2) == 0)
--				mpc_demux_SP(d, size, (mpc_uint32_t) b.size);
--			else if (memcmp(b.key, "ST", 2) == 0)
--				mpc_demux_ST(d);
--			d->bits_reader.buff += b.size;
--			size = mpc_bits_get_block(&d->bits_reader, &b);
--		}
--		d->bits_reader.buff -= size;
--		if (d->si.stream_version == 0) // si not initialized !!!
--			return MPC_STATUS_INVALIDSV;
--	} else
--		return MPC_STATUS_INVALIDSV;
--
--	return MPC_STATUS_OK;
--}
--
--mpc_demux * mpc_demux_init(mpc_reader * p_reader)
--{
--	mpc_demux* p_tmp = malloc(sizeof(mpc_demux));
--
--	if (p_tmp != 0) {
--		memset(p_tmp, 0, sizeof(mpc_demux));
--		p_tmp->r = p_reader;
--		p_tmp->chap_nb = -1;
--		mpc_demux_clear_buff(p_tmp);
--		if (mpc_demux_header(p_tmp) == MPC_STATUS_OK &&
--				  mpc_demux_seek_init(p_tmp) == MPC_STATUS_OK) {
--			p_tmp->d = mpc_decoder_init(&p_tmp->si);
--		} else {
--			if (p_tmp->seek_table)
--				free(p_tmp->seek_table);
--			free(p_tmp);
--			p_tmp = 0;
--		}
--	}
--
--	return p_tmp;
--}
--
--void mpc_demux_exit(mpc_demux * d)
--{
--	mpc_decoder_exit(d->d);
--	free(d->seek_table);
--	free(d->chap);
--	free(d);
--}
--
--void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i)
--{
--	memcpy(i, &d->si, sizeof d->si);
--}
--
--mpc_status mpc_demux_decode(mpc_demux * d, mpc_frame_info * i)
--{
--	mpc_bits_reader r;
--	if (d->si.stream_version >= 8) {
--		i->is_key_frame = MPC_FALSE;
--
--		if (d->block_frames == 0) {
--			mpc_block b = {{0,0},0};
--			d->bits_reader.count &= -8;
--			if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
--				d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
--				d->seek_table_size ++;
--			}
--			mpc_demux_fill(d, 11, 0); // max header block size
--			mpc_bits_get_block(&d->bits_reader, &b);
--			while( memcmp(b.key, "AP", 2) != 0 ) { // scan all blocks until audio
--				if (mpc_check_key(b.key) != MPC_STATUS_OK)
--					goto error;
--				if (memcmp(b.key, "SE", 2) == 0) { // end block
--					i->bits = -1;
--					return MPC_STATUS_OK;
--				}
--				if (mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0) == 0)
--					goto error;
--				d->bits_reader.buff += b.size;
--				mpc_bits_get_block(&d->bits_reader, &b);
--			}
--			d->block_bits = (mpc_uint32_t) b.size * 8;
--			d->block_frames = 1 << d->si.block_pwr;
--			i->is_key_frame = MPC_TRUE;
--		}
--		if (d->buffer + d->bytes_total - d->bits_reader.buff <= MAX_FRAME_SIZE)
--			mpc_demux_fill(d, (d->block_bits >> 3) + 1, 0);
--		r = d->bits_reader;
--		mpc_decoder_decode_frame(d->d, &d->bits_reader, i);
--		d->block_bits -= ((d->bits_reader.buff - r.buff) << 3) + r.count - d->bits_reader.count;
--		d->block_frames--;
--		if (d->block_bits < 0 || (d->block_frames == 0 && d->block_bits > 7))
--			goto error;
--	} else {
--		if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
--			d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
--			d->seek_table_size ++;
--		}
--		mpc_demux_fill(d, MAX_FRAME_SIZE, MPC_BUFFER_FULL | MPC_BUFFER_SWAP);
--		d->block_bits = (mpc_int_t) mpc_bits_read(&d->bits_reader, 20); // read frame size
--		if (MPC_FRAME_LENGTH > d->d->samples - d->d->decoded_samples - 1) d->block_bits += 11; // we will read last frame size
--		r = d->bits_reader;
--		mpc_decoder_decode_frame(d->d, &d->bits_reader, i);
--		if (i->bits != -1 && d->block_bits != ((d->bits_reader.buff - r.buff) << 3) + r.count - d->bits_reader.count)
--			goto error;
--	}
--	if (i->bits != -1 && d->buffer + d->bytes_total < d->bits_reader.buff + ((8 - d->bits_reader.count) >> 3))
--		goto error;
--
--	return MPC_STATUS_OK;
--error:
--		i->bits = -1; // we pretend it's end of file
--		return MPC_STATUS_INVALIDSV;
--}
--
--mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds)
--{
--	return mpc_demux_seek_sample(d, (mpc_int64_t)(seconds * (double)d->si.sample_freq + 0.5));
--}
--
--mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample)
--{
--	mpc_uint32_t fwd, samples_to_skip, i;
--	mpc_uint32_t block_samples = MPC_FRAME_LENGTH << d->si.block_pwr;
--	mpc_seek_t fpos;
--
--	destsample += d->si.beg_silence;
--	if (destsample > d->si.samples) destsample = d->si.samples;
--	fwd = (mpc_uint32_t) (destsample / block_samples);
--	samples_to_skip = MPC_DECODER_SYNTH_DELAY +
--			(mpc_uint32_t) (destsample % block_samples);
--	if (d->si.stream_version == 7) {
--		if (fwd > 32) {
--			fwd -= 32;
--			samples_to_skip += MPC_FRAME_LENGTH * 32;
--		} else {
--			samples_to_skip += MPC_FRAME_LENGTH * fwd;
--			fwd = 0;
--		}
--	}
--
--	i = fwd >> (d->seek_pwr - d->si.block_pwr);
--	if (i >= d->seek_table_size)
--		i = d->seek_table_size - 1;
--	fpos = d->seek_table[i];
--	i <<= d->seek_pwr - d->si.block_pwr;
--	d->d->decoded_samples = i * block_samples;
--
--	if (d->si.stream_version >= 8) {
--		mpc_block b;
--		int size;
--		mpc_demux_seek(d, fpos, 11);
--		size = mpc_bits_get_block(&d->bits_reader, &b);
--		while(i < fwd) {
--			if (memcmp(b.key, "AP", 2) == 0) {
--				if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
--					d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d) - 8 * size;
--					d->seek_table_size ++;
--				}
--				d->d->decoded_samples += block_samples;
--				i++;
--			}
--			fpos += ((mpc_uint32_t)b.size + size) * 8;
--			mpc_demux_seek(d, fpos, 11);
--			size = mpc_bits_get_block(&d->bits_reader, &b);
--		}
--		d->bits_reader.buff -= size;
--	} else {
--		mpc_decoder_reset_scf(d->d, fwd != 0);
--		mpc_demux_seek(d, fpos, 4);
--		for( ; i < fwd; i++){
--			if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
--				d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
--				d->seek_table_size ++;
--			}
--			d->d->decoded_samples += block_samples;
--			fpos += mpc_bits_read(&d->bits_reader, 20) + 20;
--			mpc_demux_seek(d, fpos, 4);
--		}
--	}
--	d->d->samples_to_skip = samples_to_skip;
--	return MPC_STATUS_OK;
--}
--
--void mpc_set_replay_level(mpc_demux * d, float level, mpc_bool_t use_gain,
--						  mpc_bool_t use_title, mpc_bool_t clip_prevention)
--{
--	float peak = use_title ? d->si.peak_title : d->si.peak_album;
--	float gain = use_title ? d->si.gain_title : d->si.gain_album;
--
--	if(!use_gain && !clip_prevention)
--		return;
--
--	if(!peak)
--		peak = 1.;
--	else
--		peak = (1 << 15) / pow(10, peak / (20 * 256));
--
--	if(!gain)
--		gain = 1.;
--	else
--		gain = pow(10, (level - gain / 256) / 20);
--
--	if(clip_prevention && (peak < gain || !use_gain))
--		gain = peak;
--
--	mpc_decoder_scale_output(d->d, gain);
--}
-Index: deadbeef/plugins/musepack/mpc_reader.c
-===================================================================
---- deadbeef.orig/plugins/musepack/mpc_reader.c	2010-12-08 16:27:44.205000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,144 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 mpc_reader.c
--/// Contains implementations for simple file-based mpc_reader
--#include <mpc/reader.h>
--#include "internal.h"
--#include <stdio.h>
--
--#define STDIO_MAGIC 0xF34B963C ///< Just a random safe-check value...
--typedef struct mpc_reader_stdio_t {
--    FILE       *p_file;
--    int         file_size;
--    mpc_bool_t  is_seekable;
--    mpc_int32_t magic;
--} mpc_reader_stdio;
--
--/// mpc_reader callback implementations
--static mpc_int32_t
--read_stdio(mpc_reader *p_reader, void *ptr, mpc_int32_t size)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return MPC_STATUS_FILE;
--    return (mpc_int32_t) fread(ptr, 1, size, p_stdio->p_file);
--}
--
--static mpc_bool_t
--seek_stdio(mpc_reader *p_reader, mpc_int32_t offset)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return MPC_FALSE;
--    return p_stdio->is_seekable ? fseek(p_stdio->p_file, offset, SEEK_SET) == 0 : MPC_FALSE;
--}
--
--static mpc_int32_t
--tell_stdio(mpc_reader *p_reader)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return MPC_STATUS_FILE;
--    return ftell(p_stdio->p_file);
--}
--
--static mpc_int32_t
--get_size_stdio(mpc_reader *p_reader)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return MPC_STATUS_FILE;
--    return p_stdio->file_size;
--}
--
--static mpc_bool_t
--canseek_stdio(mpc_reader *p_reader)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return MPC_FALSE;
--    return p_stdio->is_seekable;
--}
--
--mpc_status
--mpc_reader_init_stdio_stream(mpc_reader * p_reader, FILE * p_file)
--{
--    mpc_reader tmp_reader; mpc_reader_stdio *p_stdio; int err;
--
--    p_stdio = NULL;
--    memset(&tmp_reader, 0, sizeof tmp_reader);
--    p_stdio = malloc(sizeof *p_stdio);
--    if(!p_stdio) return MPC_STATUS_FILE;
--    memset(p_stdio, 0, sizeof *p_stdio);
--
--    p_stdio->magic  = STDIO_MAGIC;
--    p_stdio->p_file = p_file;
--    p_stdio->is_seekable = MPC_TRUE;
--    err = fseek(p_stdio->p_file, 0, SEEK_END);
--    if(err < 0) goto clean;
--    err = ftell(p_stdio->p_file);
--    if(err < 0) goto clean;
--    p_stdio->file_size = err;
--    err = fseek(p_stdio->p_file, 0, SEEK_SET);
--    if(err < 0) goto clean;
--
--    tmp_reader.data     = p_stdio;
--    tmp_reader.canseek  = canseek_stdio;
--    tmp_reader.get_size = get_size_stdio;
--    tmp_reader.read     = read_stdio;
--    tmp_reader.seek     = seek_stdio;
--    tmp_reader.tell     = tell_stdio;
--
--    *p_reader = tmp_reader;
--    return MPC_STATUS_OK;
--clean:
--    if(p_stdio && p_stdio->p_file)
--        fclose(p_stdio->p_file);
--    free(p_stdio);
--    return MPC_STATUS_FILE;
--}
--
--mpc_status
--mpc_reader_init_stdio(mpc_reader *p_reader, const char *filename)
--{
--	FILE * stream = fopen(filename, "rb");
--	if (stream == NULL) return MPC_STATUS_FILE;
--	return mpc_reader_init_stdio_stream(p_reader,stream);
--}
--
--void
--mpc_reader_exit_stdio(mpc_reader *p_reader)
--{
--    mpc_reader_stdio *p_stdio = (mpc_reader_stdio*) p_reader->data;
--    if(p_stdio->magic != STDIO_MAGIC) return;
--    fclose(p_stdio->p_file);
--    free(p_stdio);
--    p_reader->data = NULL;
--}
--
-Index: deadbeef/plugins/musepack/mpcdec_math.h
-===================================================================
---- deadbeef.orig/plugins/musepack/mpcdec_math.h	2010-12-08 16:27:44.360000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,135 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 math.h
--/// Libmpcdec internal math routines.
--#ifndef _MPCDEC_MATH_H_
--#define _MPCDEC_MATH_H_
--#ifdef WIN32
--#pragma once
--#endif
--
--#include <mpc/mpc_types.h>
--
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifdef MPC_FIXED_POINT
--
--#ifdef _WIN32_WCE
--#include <cmnintrin.h>
--#define MPC_HAVE_MULHIGH
--#endif
--
--//in fixedpoint mode, results in decode output buffer are in -MPC_FIXED_POINT_SCALE ... MPC_FIXED_POINT_SCALE range
--
--typedef mpc_int64_t MPC_SAMPLE_FORMAT_MULTIPLY;
--
--#define MAKE_MPC_SAMPLE(X) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((mpc_int64_t)1)<<MPC_FIXED_POINT_FRACTPART))
--#define MAKE_MPC_SAMPLE_EX(X,Y) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((mpc_int64_t)1)<<(Y)))
--
--#define MPC_MULTIPLY_NOTRUNCATE(X,Y) \
--    (((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> MPC_FIXED_POINT_FRACTPART)
--
--#define MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z) \
--    (((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> (Z))
--
--#ifdef _DEBUG
--static mpc_inline MPC_SAMPLE_FORMAT MPC_MULTIPLY(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2)
--{
--    MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_NOTRUNCATE(item1,item2);
--    assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp);
--    return (MPC_SAMPLE_FORMAT)temp;
--}
--
--static mpc_inline MPC_SAMPLE_FORMAT MPC_MULTIPLY_EX(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2,unsigned shift)
--{
--    MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_EX_NOTRUNCATE(item1,item2,shift);
--    assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp);
--    return (MPC_SAMPLE_FORMAT)temp;
--}
--
--#else
--
--#define MPC_MULTIPLY(X,Y) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_NOTRUNCATE(X,Y))
--#define MPC_MULTIPLY_EX(X,Y,Z) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z))
--
--#endif
--
--#ifdef MPC_HAVE_MULHIGH
--#define MPC_MULTIPLY_FRACT(X,Y) _MulHigh(X,Y)
--#else
--#define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32)
--#endif
--
--#define MPC_MAKE_FRACT_CONST(X) (MPC_SAMPLE_FORMAT)((X) * (double)(((mpc_int64_t)1)<<32) )
--#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y))
--#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) ( MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) )) << (Z) )
--#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) ))
--
--#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y))
--#define MPC_SCALE_CONST(X,Y,Z) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z))
--#define MPC_SCALE_CONST_SHL(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)-(S))
--#define MPC_SCALE_CONST_SHR(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)+(S))
--#define MPC_SHR(X,Y) ((X)>>(Y))
--#define MPC_SHL(X,Y) ((X)<<(Y))
--
--#else
--
--//in floating-point mode, decoded samples are in -1...1 range
--
--#define MAKE_MPC_SAMPLE(X) ((MPC_SAMPLE_FORMAT)(X))
--#define MAKE_MPC_SAMPLE_EX(X,Y) ((MPC_SAMPLE_FORMAT)(X))
--
--#define MPC_MULTIPLY_FRACT(X,Y) ((X)*(Y))
--#define MPC_MAKE_FRACT_CONST(X) (X)
--#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y))
--#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y ))
--#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y ))
--
--#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y))
--#define MPC_MULTIPLY(X,Y) ((X)*(Y))
--#define MPC_MULTIPLY_EX(X,Y,Z) ((X)*(Y))
--#define MPC_SCALE_CONST(X,Y,Z) ((X)*(Y))
--#define MPC_SCALE_CONST_SHL(X,Y,Z,S) ((X)*(Y))
--#define MPC_SCALE_CONST_SHR(X,Y,Z,S) ((X)*(Y))
--#define MPC_SHR(X,Y) (X)
--#define MPC_SHL(X,Y) (X)
--
--#endif
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/musepack.c
-===================================================================
---- deadbeef.orig/plugins/musepack/musepack.c	2010-12-08 16:27:43.939000059 +0100
-+++ deadbeef/plugins/musepack/musepack.c	2010-12-08 16:29:25.449000060 +0100
-@@ -21,7 +21,7 @@
- #include <limits.h>
- #include <unistd.h>
- #include <math.h>
--#include "mpc/mpcdec.h"
-+#include <mpc/mpcdec.h>
- #ifdef HAVE_CONFIG_H
- #  include <config.h>
- #endif
-Index: deadbeef/plugins/musepack/requant.c
-===================================================================
---- deadbeef.orig/plugins/musepack/requant.c	2010-12-08 16:27:44.171000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,124 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 requant.c
--/// Requantization function implementations.
--/// \todo document me
--#include <mpc/mpcdec.h>
--
--#include "requant.h"
--#include "mpcdec_math.h"
--#include "decoder.h"
--
--/* C O N S T A N T S */
--// Bits per sample for chosen quantizer
--const mpc_uint8_t  Res_bit [18] = {
--    0,  0,  0,  0,  0,  0,  0,  0,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16
--};
--
--// Requantization coefficients
--// 65536/step bzw. 65536/(2*D+1)
--
--#define _(X) MAKE_MPC_SAMPLE_EX(X,14)
--
--const MPC_SAMPLE_FORMAT  __Cc [1 + 18] = {
--    _(111.285962475327f),   // 32768/2/255*sqrt(3)
--    _(65536.000000000000f), _(21845.333333333332f), _(13107.200000000001f), _(9362.285714285713f),
--    _(7281.777777777777f),  _(4369.066666666666f),  _(2114.064516129032f),  _(1040.253968253968f),
--    _(516.031496062992f),   _(257.003921568627f),   _(128.250489236790f),   _(64.062561094819f),
--    _(32.015632633121f),    _(16.003907203907f),    _(8.000976681723f),     _(4.000244155527f),
--    _(2.000061037018f),     _(1.000015259021f)
--};
--
--#undef _
--
--// Requantization offset
--// 2*D+1 = steps of quantizer
--const mpc_int16_t  __Dc [1 + 18] = {
--      2,
--      0,     1,     2,     3,     4,     7,    15,    31,    63,
--    127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
--};
--
--#ifdef MPC_FIXED_POINT
--static mpc_uint32_t find_shift(double fval)
--{
--    mpc_int64_t  val = (mpc_int64_t) fval;
--    mpc_uint32_t ptr = 0;
--    if(val<0)
--        val = -val;
--    while(val)
--    {
--        val >>= 1;
--        ptr++;
--    }
--    return ptr > 31 ? 0 : 31 - ptr;
--}
--#endif
--
--/* F U N C T I O N S */
--
--#define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,d->SCF_shift[N] = (mpc_uint8_t) find_shift(X));
--
--void
--mpc_decoder_scale_output(mpc_decoder *d, double factor)
--{
--    mpc_int32_t n; double f1, f2;
--
--#ifndef MPC_FIXED_POINT
--    factor *= 1.0 / (double) (1<<(MPC_FIXED_POINT_SHIFT-1));
--#else
--    factor *= 1.0 / (double) (1<<(16-MPC_FIXED_POINT_SHIFT));
--#endif
--    f1 = f2 = factor;
--
--    // handles +1.58...-98.41 dB, where's scf[n] / scf[n-1] = 1.20050805774840750476
--
--    SET_SCF(1,factor);
--
--    f1 *=   0.83298066476582673961;
--    f2 *= 1/0.83298066476582673961;
--
--    for ( n = 1; n <= 128; n++ ) {
--        SET_SCF((mpc_uint8_t)(1+n),f1);
--        SET_SCF((mpc_uint8_t)(1-n),f2);
--        f1 *=   0.83298066476582673961;
--        f2 *= 1/0.83298066476582673961;
--    }
--}
--
--void
--mpc_decoder_init_quant(mpc_decoder *d, double scale_factor)
--{
--    mpc_decoder_scale_output(d, scale_factor);
--}
-Index: deadbeef/plugins/musepack/requant.h
-===================================================================
---- deadbeef.orig/plugins/musepack/requant.h	2010-12-08 16:27:44.422000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,61 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 requant.h
--/// Requantization function definitions.
--#ifndef _MPCDEC_REQUANT_H_
--#define _MPCDEC_REQUANT_H_
--#ifdef WIN32
--#pragma once
--#endif
--
--#include <mpc/mpc_types.h>
--
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--
--/* C O N S T A N T S */
--const mpc_uint8_t      Res_bit [18];     ///< Bits per sample for chosen quantizer
--const MPC_SAMPLE_FORMAT __Cc    [1 + 18]; ///< Requantization coefficients
--const mpc_int16_t       __Dc    [1 + 18]; ///< Requantization offset
--
--#define Cc (__Cc + 1)
--#define Dc (__Dc + 1)
--
--
--#ifdef __cplusplus
--}
--#endif
--#endif
-Index: deadbeef/plugins/musepack/streaminfo.c
-===================================================================
---- deadbeef.orig/plugins/musepack/streaminfo.c	2010-12-08 16:27:44.031000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,244 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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.c
--/// Implementation of streaminfo reading functions.
--
--#include <math.h>
--#include <mpc/mpcdec.h>
--#include <mpc/streaminfo.h>
--#include <stdio.h>
--#include "internal.h"
--#include "huffman.h"
--#include "mpc_bits_reader.h"
--
--unsigned long crc32(unsigned char *buf, int len);
--
--static const char na[] = "n.a.";
--static char const * const versionNames[] = {
--    na, "'Unstable/Experimental'", na, na, na, "'quality 0'", "'quality 1'",
--    "'Telephone'", "'Thumb'", "'Radio'", "'Standard'", "'Extreme'", "'Insane'",
--    "'BrainDead'", "'quality 9'", "'quality 10'"
--};
--static const mpc_int32_t samplefreqs[8] = { 44100, 48000, 37800, 32000 };
--
--static const char *
--mpc_get_version_string(float profile) // profile is 0...15, where 7...13 is used
--{
--	return profile >= sizeof versionNames / sizeof *versionNames ? na : versionNames[(int)profile];
--}
--
--static void
--mpc_get_encoder_string(mpc_streaminfo* si)
--{
--	int ver = si->encoder_version;
--	if (si->stream_version >= 8)
--		ver = (si->encoder_version >> 24) * 100 + ((si->encoder_version >> 16) & 0xFF);
--	if (ver <= 116) {
--		if (ver == 0) {
--			sprintf(si->encoder, "Buschmann 1.7.0...9, Klemm 0.90...1.05");
--		} else {
--			switch (ver % 10) {
--				case 0:
--					sprintf(si->encoder, "Release %u.%u", ver / 100,
--							ver / 10 % 10);
--					break;
--				case 2: case 4: case 6: case 8:
--					sprintf(si->encoder, "Beta %u.%02u", ver / 100,
--							ver % 100);
--					break;
--				default:
--					sprintf(si->encoder, "--Alpha-- %u.%02u",
--							ver / 100, ver % 100);
--					break;
--			}
--		}
--	} else {
--		int major = si->encoder_version >> 24;
--		int minor = (si->encoder_version >> 16) & 0xFF;
--		int build = (si->encoder_version >> 8) & 0xFF;
--		char * tmp = "--Stable--";
--
--		if (minor & 1)
--			tmp = "--Unstable--";
--
--		sprintf(si->encoder, "%s %u.%u.%u", tmp, major, minor, build);
--	}
--}
--
--static mpc_status check_streaminfo(mpc_streaminfo * si)
--{
--	if (si->max_band == 0 || si->max_band >= 32
--	    || si->channels > 2)
--		return MPC_STATUS_FILE;
--	return MPC_STATUS_OK;
--}
--
--/// Reads streaminfo from SV7 header.
--mpc_status
--streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r)
--{
--    mpc_uint16_t Estimatedpeak_title = 0;
--	mpc_uint32_t frames, last_frame_samples;
--
--	si->bitrate            = 0;
--	frames                 = (mpc_bits_read(r, 16) << 16) | mpc_bits_read(r, 16);
--	mpc_bits_read(r, 1); // intensity stereo : should be 0
--	si->ms                 = mpc_bits_read(r, 1);
--	si->max_band           = mpc_bits_read(r, 6);
--	si->profile            = mpc_bits_read(r, 4);
--	si->profile_name       = mpc_get_version_string(si->profile);
--	mpc_bits_read(r, 2); // Link ?
--	si->sample_freq        = samplefreqs[mpc_bits_read(r, 2)];
--	Estimatedpeak_title    = (mpc_uint16_t) mpc_bits_read(r, 16);   // read the ReplayGain data
--	si->gain_title         = (mpc_uint16_t) mpc_bits_read(r, 16);
--	si->peak_title         = (mpc_uint16_t) mpc_bits_read(r, 16);
--	si->gain_album         = (mpc_uint16_t) mpc_bits_read(r, 16);
--	si->peak_album         = (mpc_uint16_t) mpc_bits_read(r, 16);
--	si->is_true_gapless    = mpc_bits_read(r, 1); // true gapless: used?
--	last_frame_samples     = mpc_bits_read(r, 11); // true gapless: valid samples for last frame
--	si->fast_seek          = mpc_bits_read(r, 1); // fast seeking
--	mpc_bits_read(r, 19); // unused
--	si->encoder_version    = mpc_bits_read(r, 8);
--    si->channels           = 2;
--	si->block_pwr          = 0;
--
--	// convert gain info
--	if (si->gain_title != 0) {
--		int tmp = (int)((MPC_OLD_GAIN_REF - (mpc_int16_t)si->gain_title / 100.) * 256. + .5);
--		if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
--		si->gain_title = (mpc_int16_t) tmp;
--	}
--
--	if (si->gain_album != 0) {
--		int tmp = (int)((MPC_OLD_GAIN_REF - (mpc_int16_t)si->gain_album / 100.) * 256. + .5);
--		if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
--		si->gain_album = (mpc_int16_t) tmp;
--	}
--
--	if (si->peak_title != 0)
-- 		si->peak_title = (mpc_uint16_t) (log10(si->peak_title) * 20 * 256 + .5);
--
--	if (si->peak_album != 0)
--		si->peak_album = (mpc_uint16_t) (log10(si->peak_album) * 20 * 256 + .5);
--
--	mpc_get_encoder_string(si);
--
--	if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH;
--	si->samples = (mpc_int64_t) frames * MPC_FRAME_LENGTH;
--	if (si->is_true_gapless)
--		si->samples -= (MPC_FRAME_LENGTH - last_frame_samples);
--	else
--		si->samples -= MPC_DECODER_SYNTH_DELAY;
--
--	si->average_bitrate = (si->tag_offset  - si->header_position) * 8.0
--			*  si->sample_freq / si->samples;
--
--	return check_streaminfo(si);
--}
--
--/// Reads replay gain datas
--void  streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in)
--{
--	mpc_bits_reader r = *r_in;
--
--	int version = mpc_bits_read(&r, 8); // gain version
--	if (version != 1) // we only know ver 1
--		return;
--	si->gain_title         = (mpc_uint16_t) mpc_bits_read(&r, 16);
--	si->peak_title         = (mpc_uint16_t) mpc_bits_read(&r, 16);
--	si->gain_album         = (mpc_uint16_t) mpc_bits_read(&r, 16);
--	si->peak_album         = (mpc_uint16_t) mpc_bits_read(&r, 16);
--}
--
--/// Reads streaminfo from SV8 header.
--mpc_status
--streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in,
--						   mpc_size_t block_size)
--{
--	mpc_uint32_t CRC;
--	mpc_bits_reader r = *r_in;
--
--	CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16);
--	if (CRC != crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
--		return MPC_STATUS_FILE;
--
--	si->stream_version = mpc_bits_read(&r, 8);
--	if (si->stream_version != 8)
--		return MPC_STATUS_INVALIDSV;
--
--	mpc_bits_get_size(&r, &si->samples);
--	mpc_bits_get_size(&r, &si->beg_silence);
--
--	si->is_true_gapless = 1;
--	si->sample_freq = samplefreqs[mpc_bits_read(&r, 3)];
--	si->max_band = mpc_bits_read(&r, 5) + 1;
--	si->channels = mpc_bits_read(&r, 4) + 1;
--	si->ms = mpc_bits_read(&r, 1);
--	si->block_pwr = mpc_bits_read(&r, 3) * 2;
--
--	si->bitrate = 0;
--
--	if ((si->samples - si->beg_silence) != 0)
--		si->average_bitrate = (si->tag_offset - si->header_position) * 8.0
--				*  si->sample_freq / (si->samples - si->beg_silence);
--
--	return check_streaminfo(si);
--}
--
--/// Reads encoder informations
--void  streaminfo_encoder_info(mpc_streaminfo* si, const mpc_bits_reader * r_in)
--{
--	mpc_bits_reader r = *r_in;
--
--	si->profile            = mpc_bits_read(&r, 7) / 8.;
--	si->profile_name       = mpc_get_version_string(si->profile);
--	si->pns                = mpc_bits_read(&r, 1);
--	si->encoder_version = mpc_bits_read(&r, 8) << 24; // major
--	si->encoder_version |= mpc_bits_read(&r, 8) << 16; // minor
--	si->encoder_version |= mpc_bits_read(&r, 8) << 8; // build
--
--
--	mpc_get_encoder_string(si);
--}
--
--double
--mpc_streaminfo_get_length(mpc_streaminfo * si)
--{
--	return (double) (si->samples - si->beg_silence) / si->sample_freq;
--}
--
--mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si)
--{
--	return si->samples - si->beg_silence;
--}
-Index: deadbeef/plugins/musepack/synth_filter.c
-===================================================================
---- deadbeef.orig/plugins/musepack/synth_filter.c	2010-12-08 16:27:43.986000059 +0100
-+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
-@@ -1,430 +0,0 @@
--/*
--  Copyright (c) 2005-2009, 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 synth_filter.c
--/// Synthesis functions.
--/// \todo document me
--#include <string.h>
--#include <mpc/mpcdec.h>
--#include "decoder.h"
--#include "mpcdec_math.h"
--
--/* C O N S T A N T S */
--#define MPC_FIXED_POINT_SYNTH_FIX 2
--
--#undef _
--#ifdef MPC_FIXED_POINT
--#define _(value)  MPC_MAKE_FRACT_CONST((double)value/(double)(0x40000))
--#else
--#define _(value)  MAKE_MPC_SAMPLE((double)value/(double)(0x10000))
--#endif
--
--
--static const MPC_SAMPLE_FORMAT  Di_opt [32] [16] = {
--    { _(  0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _(  6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) },
--    { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _(  5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) },
--    { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _(  5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) },
--    { _( -1), _( -38), _( 225), _( -645), _( 1893), _(-6237), _(  4561), _(-43006), _(74630), _(31947), _(8092), _( 4063), _(2087), _( 294), _(196), _(21) },
--    { _( -1), _( -41), _( 227), _( -711), _( 1822), _(-6589), _(  3776), _(-44821), _(74313), _(30112), _(8492), _( 3705), _(2085), _( 244), _(190), _(19) },
--    { _( -1), _( -45), _( 228), _( -779), _( 1739), _(-6935), _(  2935), _(-46617), _(73908), _(28289), _(8840), _( 3351), _(2075), _( 197), _(183), _(17) },
--    { _( -1), _( -49), _( 228), _( -848), _( 1644), _(-7271), _(  2037), _(-48390), _(73415), _(26482), _(9139), _( 3004), _(2057), _( 153), _(176), _(16) },
--    { _( -2), _( -53), _( 227), _( -919), _( 1535), _(-7597), _(  1082), _(-50137), _(72835), _(24694), _(9389), _( 2663), _(2032), _( 111), _(169), _(14) },
--    { _( -2), _( -58), _( 224), _( -991), _( 1414), _(-7910), _(    70), _(-51853), _(72169), _(22929), _(9592), _( 2330), _(2001), _(  72), _(161), _(13) },
--    { _( -2), _( -63), _( 221), _(-1064), _( 1280), _(-8209), _(  -998), _(-53534), _(71420), _(21189), _(9750), _( 2006), _(1962), _(  36), _(154), _(11) },
--    { _( -2), _( -68), _( 215), _(-1137), _( 1131), _(-8491), _( -2122), _(-55178), _(70590), _(19478), _(9863), _( 1692), _(1919), _(   2), _(147), _(10) },
--    { _( -3), _( -73), _( 208), _(-1210), _(  970), _(-8755), _( -3300), _(-56778), _(69679), _(17799), _(9935), _( 1388), _(1870), _( -29), _(139), _( 9) },
--    { _( -3), _( -79), _( 200), _(-1283), _(  794), _(-8998), _( -4533), _(-58333), _(68692), _(16155), _(9966), _( 1095), _(1817), _( -57), _(132), _( 8) },
--    { _( -4), _( -85), _( 189), _(-1356), _(  605), _(-9219), _( -5818), _(-59838), _(67629), _(14548), _(9959), _(  814), _(1759), _( -83), _(125), _( 7) },
--    { _( -4), _( -91), _( 177), _(-1428), _(  402), _(-9416), _( -7154), _(-61289), _(66494), _(12980), _(9916), _(  545), _(1698), _(-106), _(117), _( 7) },
--    { _( -5), _( -97), _( 163), _(-1498), _(  185), _(-9585), _( -8540), _(-62684), _(65290), _(11455), _(9838), _(  288), _(1634), _(-127), _(111), _( 6) },
--    { _( -5), _(-104), _( 146), _(-1567), _(  -45), _(-9727), _( -9975), _(-64019), _(64019), _( 9975), _(9727), _(   45), _(1567), _(-146), _(104), _( 5) },
--    { _( -6), _(-111), _( 127), _(-1634), _( -288), _(-9838), _(-11455), _(-65290), _(62684), _( 8540), _(9585), _( -185), _(1498), _(-163), _( 97), _( 5) },
--    { _( -7), _(-117), _( 106), _(-1698), _( -545), _(-9916), _(-12980), _(-66494), _(61289), _( 7154), _(9416), _( -402), _(1428), _(-177), _( 91), _( 4) },
--    { _( -7), _(-125), _(  83), _(-1759), _( -814), _(-9959), _(-14548), _(-67629), _(59838), _( 5818), _(9219), _( -605), _(1356), _(-189), _( 85), _( 4) },
--    { _( -8), _(-132), _(  57), _(-1817), _(-1095), _(-9966), _(-16155), _(-68692), _(58333), _( 4533), _(8998), _( -794), _(1283), _(-200), _( 79), _( 3) },
--    { _( -9), _(-139), _(  29), _(-1870), _(-1388), _(-9935), _(-17799), _(-69679), _(56778), _( 3300), _(8755), _( -970), _(1210), _(-208), _( 73), _( 3) },
--    { _(-10), _(-147), _(  -2), _(-1919), _(-1692), _(-9863), _(-19478), _(-70590), _(55178), _( 2122), _(8491), _(-1131), _(1137), _(-215), _( 68), _( 2) },
--    { _(-11), _(-154), _( -36), _(-1962), _(-2006), _(-9750), _(-21189), _(-71420), _(53534), _(  998), _(8209), _(-1280), _(1064), _(-221), _( 63), _( 2) },
--    { _(-13), _(-161), _( -72), _(-2001), _(-2330), _(-9592), _(-22929), _(-72169), _(51853), _(  -70), _(7910), _(-1414), _( 991), _(-224), _( 58), _( 2) },
--    { _(-14), _(-169), _(-111), _(-2032), _(-2663), _(-9389), _(-24694), _(-72835), _(50137), _(-1082), _(7597), _(-1535), _( 919), _(-227), _( 53), _( 2) },
--    { _(-16), _(-176), _(-153), _(-2057), _(-3004), _(-9139), _(-26482), _(-73415), _(48390), _(-2037), _(7271), _(-1644), _( 848), _(-228), _( 49), _( 1) },
--    { _(-17), _(-183), _(-197), _(-2075), _(-3351), _(-8840), _(-28289), _(-73908), _(46617), _(-2935), _(6935), _(-1739), _( 779), _(-228), _( 45), _( 1) },
--    { _(-19), _(-190), _(-244), _(-2085), _(-3705), _(-8492), _(-30112), _(-74313), _(44821), _(-3776), _(6589), _(-1822), _( 711), _(-227), _( 41), _( 1) },
--    { _(-21), _(-196), _(-294), _(-2087), _(-4063), _(-8092), _(-31947), _(-74630), _(43006), _(-4561), _(6237), _(-1893), _( 645), _(-225), _( 38), _( 1) },
--    { _(-24), _(-202), _(-347), _(-2080), _(-4425), _(-7640), _(-33791), _(-74856), _(41176), _(-5288), _(5879), _(-1952), _( 581), _(-222), _( 35), _( 1) },
--    { _(-26), _(-208), _(-401), _(-2063), _(-4788), _(-7134), _(-35640), _(-74992), _(39336), _(-5959), _(5517), _(-2000), _( 519), _(-218), _( 31), _( 1) }
--};
--
--#undef  _
--
--static void
--mpc_compute_new_V(const MPC_SAMPLE_FORMAT* p_sample, MPC_SAMPLE_FORMAT* pV)
--{
--    // Calculating new V-buffer values for left channel
--    // calculate new V-values (ISO-11172-3, p. 39)
--    // based upon fast-MDCT algorithm by Byeong Gi Lee
--    MPC_SAMPLE_FORMAT A00, A01, A02, A03, A04, A05, A06, A07, A08, A09, A10, A11, A12, A13, A14, A15;
--    MPC_SAMPLE_FORMAT B00, B01, B02, B03, B04, B05, B06, B07, B08, B09, B10, B11, B12, B13, B14, B15;
--    MPC_SAMPLE_FORMAT tmp;
--
--    A00 = p_sample[ 0] + p_sample[31];
--    A01 = p_sample[ 1] + p_sample[30];
--    A02 = p_sample[ 2] + p_sample[29];
--    A03 = p_sample[ 3] + p_sample[28];
--    A04 = p_sample[ 4] + p_sample[27];
--    A05 = p_sample[ 5] + p_sample[26];
--    A06 = p_sample[ 6] + p_sample[25];
--    A07 = p_sample[ 7] + p_sample[24];
--    A08 = p_sample[ 8] + p_sample[23];
--    A09 = p_sample[ 9] + p_sample[22];
--    A10 = p_sample[10] + p_sample[21];
--    A11 = p_sample[11] + p_sample[20];
--    A12 = p_sample[12] + p_sample[19];
--    A13 = p_sample[13] + p_sample[18];
--    A14 = p_sample[14] + p_sample[17];
--    A15 = p_sample[15] + p_sample[16];
--
--    B00 = A00 + A15;
--    B01 = A01 + A14;
--    B02 = A02 + A13;
--    B03 = A03 + A12;
--    B04 = A04 + A11;
--    B05 = A05 + A10;
--    B06 = A06 + A09;
--    B07 = A07 + A08;;
--    B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31);
--    B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31);
--    B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31);
--    B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31);
--    B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31);
--    B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30);
--    B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30);
--    B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28);
--
--    A00 =  B00 + B07;
--    A01 =  B01 + B06;
--    A02 =  B02 + B05;
--    A03 =  B03 + B04;
--    A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31);
--    A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31);
--    A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31);
--    A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29);
--    A08 =  B08 + B15;
--    A09 =  B09 + B14;
--    A10 =  B10 + B13;
--    A11 =  B11 + B12;
--    A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31);
--    A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31);
--    A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31);
--    A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29);
--
--    B00 =  A00 + A03;
--    B01 =  A01 + A02;
--    B02 = MPC_MULTIPLY_FRACT_CONST_FIX((A00 - A03) , 0.5411961079f , 1);
--    B03 = MPC_MULTIPLY_FRACT_CONST_FIX((A01 - A02) , 1.3065630198f , 2);
--    B04 =  A04 + A07;
--    B05 =  A05 + A06;
--    B06 = MPC_MULTIPLY_FRACT_CONST_FIX((A04 - A07) , 0.5411961079f , 1);
--    B07 = MPC_MULTIPLY_FRACT_CONST_FIX((A05 - A06) , 1.3065630198f , 2);
--    B08 =  A08 + A11;
--    B09 =  A09 + A10;
--    B10 = MPC_MULTIPLY_FRACT_CONST_FIX((A08 - A11) , 0.5411961079f , 1);
--    B11 = MPC_MULTIPLY_FRACT_CONST_FIX((A09 - A10) , 1.3065630198f , 2);
--    B12 =  A12 + A15;
--    B13 =  A13 + A14;
--    B14 = MPC_MULTIPLY_FRACT_CONST_FIX((A12 - A15) , 0.5411961079f , 1);
--    B15 = MPC_MULTIPLY_FRACT_CONST_FIX((A13 - A14) , 1.3065630198f , 2);
--
--    A00 =  B00 + B01;
--    A01 = MPC_MULTIPLY_FRACT_CONST_FIX((B00 - B01) , 0.7071067691f , 1);
--    A02 =  B02 + B03;
--    A03 = MPC_MULTIPLY_FRACT_CONST_FIX((B02 - B03) , 0.7071067691f , 1);
--    A04 =  B04 + B05;
--    A05 = MPC_MULTIPLY_FRACT_CONST_FIX((B04 - B05) , 0.7071067691f , 1);
--    A06 =  B06 + B07;
--    A07 = MPC_MULTIPLY_FRACT_CONST_FIX((B06 - B07) , 0.7071067691f , 1);
--    A08 =  B08 + B09;
--    A09 = MPC_MULTIPLY_FRACT_CONST_FIX((B08 - B09) , 0.7071067691f , 1);
--    A10 =  B10 + B11;
--    A11 = MPC_MULTIPLY_FRACT_CONST_FIX((B10 - B11) , 0.7071067691f , 1);
--    A12 =  B12 + B13;
--    A13 = MPC_MULTIPLY_FRACT_CONST_FIX((B12 - B13) , 0.7071067691f , 1);
--    A14 =  B14 + B15;
--    A15 = MPC_MULTIPLY_FRACT_CONST_FIX((B14 - B15) , 0.7071067691f , 1);
--
--    pV[48] = -A00;
--    pV[ 0] =  A01;
--    pV[40] = -A02 - (pV[ 8] = A03);
--    pV[36] = -((pV[ 4] = A05 + (pV[12] = A07)) + A06);
--    pV[44] = - A04 - A06 - A07;
--    pV[ 6] = (pV[10] = A11 + (pV[14] = A15)) + A13;
--    pV[38] = (pV[34] = -(pV[ 2] = A09 + A13 + A15) - A14) + A09 - A10 - A11;
--    pV[46] = (tmp = -(A12 + A14 + A15)) - A08;
--    pV[42] = tmp - A10 - A11;
--
--    A00 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 0] - p_sample[31]) , 0.5006030202f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A01 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 1] - p_sample[30]) , 0.5054709315f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A02 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 2] - p_sample[29]) , 0.5154473186f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A03 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 3] - p_sample[28]) , 0.5310425758f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A04 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 4] - p_sample[27]) , 0.5531039238f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A05 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 5] - p_sample[26]) , 0.5829349756f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A06 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 6] - p_sample[25]) , 0.6225041151f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A07 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 7] - p_sample[24]) , 0.6748083234f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A08 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 8] - p_sample[23]) , 0.7445362806f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A09 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[ 9] - p_sample[22]) , 0.8393496275f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A10 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[10] - p_sample[21]) , 0.9725682139f ,     MPC_FIXED_POINT_SYNTH_FIX);
--#if MPC_FIXED_POINT_SYNTH_FIX>=2
--    A11 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[11] - p_sample[20]) , 1.1694399118f ,     MPC_FIXED_POINT_SYNTH_FIX);
--    A12 = MPC_MULTIPLY_FRACT_CONST_SHR((p_sample[12] - p_sample[19]) , 1.4841645956f ,     MPC_FIXED_POINT_SYNTH_FIX);
--#else
--    A11 = MPC_SCALE_CONST_SHR         ((p_sample[11] - p_sample[20]) , 1.1694399118f , 30, MPC_FIXED_POINT_SYNTH_FIX);
--    A12 = MPC_SCALE_CONST_SHR         ((p_sample[12] - p_sample[19]) , 1.4841645956f , 30, MPC_FIXED_POINT_SYNTH_FIX);
--#endif
--    A13 = MPC_SCALE_CONST_SHR         ((p_sample[13] - p_sample[18]) , 2.0577809811f , 29, MPC_FIXED_POINT_SYNTH_FIX);
--    A14 = MPC_SCALE_CONST_SHR         ((p_sample[14] - p_sample[17]) , 3.4076085091f , 29, MPC_FIXED_POINT_SYNTH_FIX);
--    A15 = MPC_SCALE_CONST_SHR         ((p_sample[15] - p_sample[16]) , 10.1900081635f, 27 ,MPC_FIXED_POINT_SYNTH_FIX);
--
--    B00 =  A00 + A15;
--    B01 =  A01 + A14;
--    B02 =  A02 + A13;
--    B03 =  A03 + A12;
--    B04 =  A04 + A11;
--    B05 =  A05 + A10;
--    B06 =  A06 + A09;
--    B07 =  A07 + A08;
--    B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31);
--    B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31);
--    B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31);
--    B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31);
--    B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31);
--    B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30);
--    B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30);
--    B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28);
--
--    A00 =  B00 + B07;
--    A01 =  B01 + B06;
--    A02 =  B02 + B05;
--    A03 =  B03 + B04;
--    A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31);
--    A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31);
--    A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31);
--    A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29);
--    A08 =  B08 + B15;
--    A09 =  B09 + B14;
--    A10 =  B10 + B13;
--    A11 =  B11 + B12;
--    A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31);
--    A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31);
--    A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31);
--    A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29);
--
--    B00 =  A00 + A03;
--    B01 =  A01 + A02;
--    B02 = MPC_SCALE_CONST((A00 - A03) , 0.5411961079f , 31);
--    B03 = MPC_SCALE_CONST((A01 - A02) , 1.3065630198f , 30);
--    B04 =  A04 + A07;
--    B05 =  A05 + A06;
--    B06 = MPC_SCALE_CONST((A04 - A07) , 0.5411961079f , 31);
--    B07 = MPC_SCALE_CONST((A05 - A06) , 1.3065630198f , 30);
--    B08 =  A08 + A11;
--    B09 =  A09 + A10;
--    B10 = MPC_SCALE_CONST((A08 - A11) , 0.5411961079f , 31);
--    B11 = MPC_SCALE_CONST((A09 - A10) , 1.3065630198f , 30);
--    B12 =  A12 + A15;
--    B13 =  A13 + A14;
--    B14 = MPC_SCALE_CONST((A12 - A15) , 0.5411961079f , 31);
--    B15 = MPC_SCALE_CONST((A13 - A14) , 1.3065630198f , 30);
--
--    A00 = MPC_SHL(B00 + B01, MPC_FIXED_POINT_SYNTH_FIX);
--    A01 = MPC_SCALE_CONST_SHL((B00 - B01) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A02 = MPC_SHL(B02 + B03, MPC_FIXED_POINT_SYNTH_FIX);
--    A03 = MPC_SCALE_CONST_SHL((B02 - B03) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A04 = MPC_SHL(B04 + B05, MPC_FIXED_POINT_SYNTH_FIX);
--    A05 = MPC_SCALE_CONST_SHL((B04 - B05) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A06 = MPC_SHL(B06 + B07, MPC_FIXED_POINT_SYNTH_FIX);
--    A07 = MPC_SCALE_CONST_SHL((B06 - B07) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A08 = MPC_SHL(B08 + B09, MPC_FIXED_POINT_SYNTH_FIX);
--    A09 = MPC_SCALE_CONST_SHL((B08 - B09) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A10 = MPC_SHL(B10 + B11, MPC_FIXED_POINT_SYNTH_FIX);
--    A11 = MPC_SCALE_CONST_SHL((B10 - B11) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A12 = MPC_SHL(B12 + B13, MPC_FIXED_POINT_SYNTH_FIX);
--    A13 = MPC_SCALE_CONST_SHL((B12 - B13) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--    A14 = MPC_SHL(B14 + B15, MPC_FIXED_POINT_SYNTH_FIX);
--    A15 = MPC_SCALE_CONST_SHL((B14 - B15) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX);
--
--    // mehrfach verwendete Ausdrcke: A04+A06+A07, A09+A13+A15
--    pV[ 5] = (pV[11] = (pV[13] = A07 + (pV[15] = A15)) + A11) + A05 + A13;
--    pV[ 7] = (pV[ 9] = A03 + A11 + A15) + A13;
--    pV[33] = -(pV[ 1] = A01 + A09 + A13 + A15) - A14;
--    pV[35] = -(pV[ 3] = A05 + A07 + A09 + A13 + A15) - A06 - A14;
--    pV[37] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07;
--    pV[39] = tmp - A02 - A03;                      // abh�gig vom Befehl drber
--    pV[41] = (tmp += A13 - A12) - A02 - A03;       // abh�gig vom Befehl 2 drber
--    pV[43] = tmp - A04 - A06 - A07;                // abh�gig von Befehlen 1 und 3 drber
--    pV[47] = (tmp = -(A08 + A12 + A14 + A15)) - A00;
--    pV[45] = tmp - A04 - A06 - A07;                // abh�gig vom Befehl drber
--
--    pV[32] = -pV[ 0];
--    pV[31] = -pV[ 1];
--    pV[30] = -pV[ 2];
--    pV[29] = -pV[ 3];
--    pV[28] = -pV[ 4];
--    pV[27] = -pV[ 5];
--    pV[26] = -pV[ 6];
--    pV[25] = -pV[ 7];
--    pV[24] = -pV[ 8];
--    pV[23] = -pV[ 9];
--    pV[22] = -pV[10];
--    pV[21] = -pV[11];
--    pV[20] = -pV[12];
--    pV[19] = -pV[13];
--    pV[18] = -pV[14];
--    pV[17] = -pV[15];
--
--    pV[63] =  pV[33];
--    pV[62] =  pV[34];
--    pV[61] =  pV[35];
--    pV[60] =  pV[36];
--    pV[59] =  pV[37];
--    pV[58] =  pV[38];
--    pV[57] =  pV[39];
--    pV[56] =  pV[40];
--    pV[55] =  pV[41];
--    pV[54] =  pV[42];
--    pV[53] =  pV[43];
--    pV[52] =  pV[44];
--    pV[51] =  pV[45];
--    pV[50] =  pV[46];
--    pV[49] =  pV[47];
--}
--
--static void
--mpc_synthese_filter_float_internal(MPC_SAMPLE_FORMAT* p_out, MPC_SAMPLE_FORMAT* pV, const MPC_SAMPLE_FORMAT* pY, mpc_int_t channels)
--{
--    mpc_uint32_t n;
--    for ( n = 0; n < 36; n++, pY += 32 )
--    {
--        MPC_SAMPLE_FORMAT*       pData = p_out;
--        const MPC_SAMPLE_FORMAT* pD    = (const MPC_SAMPLE_FORMAT*) &Di_opt;
--        mpc_int32_t k;
--        pV -= 64;
--        mpc_compute_new_V( pY, pV );
--        for ( k = 0; k < 32; k++, pD += 16, pV++ )
--        {
--            *pData = MPC_SHL(
--                     MPC_MULTIPLY_FRACT(pV[  0], pD[ 0]) + MPC_MULTIPLY_FRACT(pV[ 96], pD[ 1]) + MPC_MULTIPLY_FRACT(pV[128], pD[ 2]) + MPC_MULTIPLY_FRACT(pV[224], pD[ 3])
--                   + MPC_MULTIPLY_FRACT(pV[256], pD[ 4]) + MPC_MULTIPLY_FRACT(pV[352], pD[ 5]) + MPC_MULTIPLY_FRACT(pV[384], pD[ 6]) + MPC_MULTIPLY_FRACT(pV[480], pD[ 7])
--                   + MPC_MULTIPLY_FRACT(pV[512], pD[ 8]) + MPC_MULTIPLY_FRACT(pV[608], pD[ 9]) + MPC_MULTIPLY_FRACT(pV[640], pD[10]) + MPC_MULTIPLY_FRACT(pV[736], pD[11])
--                   + MPC_MULTIPLY_FRACT(pV[768], pD[12]) + MPC_MULTIPLY_FRACT(pV[864], pD[13]) + MPC_MULTIPLY_FRACT(pV[896], pD[14]) + MPC_MULTIPLY_FRACT(pV[992], pD[15])
--                   , 2);
--            pData += channels;
--        }
--        pV    -= 32; //bleh
--        p_out += 32 * channels;
--    }
--}
--
--void
--mpc_decoder_synthese_filter_float(mpc_decoder* p_dec, MPC_SAMPLE_FORMAT* p_out, mpc_int_t channels)
--{
--    /********* left channel ********/
--    memmove(&p_dec->V_L[MPC_V_MEM], p_dec->V_L, 960 * sizeof *p_dec->V_L);
--	mpc_synthese_filter_float_internal(p_out, &p_dec->V_L[MPC_V_MEM], p_dec->Y_L[0], channels);
--
--    /******** right channel ********/
--	if (channels > 1) {
--		memmove(&p_dec->V_R[MPC_V_MEM], p_dec->V_R, 960 * sizeof *p_dec->V_R);
--		mpc_synthese_filter_float_internal(p_out + 1, &p_dec->V_R[MPC_V_MEM], p_dec->Y_R[0], channels);
--	}
--}
--
--/*******************************************/
--/*                                         */
--/*            dithered synthesis           */
--/*                                         */
--/*******************************************/
--
--static const mpc_uint8_t Parity [256] = {  // parity
--    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
--    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
--    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
--    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
--    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
--    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
--    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
--    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
--};
--
--/*
-- *  This is a simple random number generator with good quality for audio purposes.
-- *  It consists of two polycounters with opposite rotation direction and different
-- *  periods. The periods are coprime, so the total period is the product of both.
-- *
-- *     -------------------------------------------------------------------------------------------------
-- * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
-- * |   -------------------------------------------------------------------------------------------------
-- * |                                                                          |  |  |  |     |        |
-- * |                                                                          +--+--+--+-XOR-+--------+
-- * |                                                                                      |
-- * +--------------------------------------------------------------------------------------+
-- *
-- *     -------------------------------------------------------------------------------------------------
-- *     |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
-- *     -------------------------------------------------------------------------------------------------   |
-- *       |  |           |  |                                                                               |
-- *       +--+----XOR----+--+                                                                               |
-- *                |                                                                                        |
-- *                +----------------------------------------------------------------------------------------+
-- *
-- *
-- *  The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
-- *  which gives a period of 18.410.713.077.675.721.215. The result is the
-- *  XORed values of both generators.
-- */
--mpc_uint32_t
--mpc_random_int(mpc_decoder* p_dec)
--{
--#if 1
--    mpc_uint32_t  t1, t2, t3, t4;
--
--    t3   = t1 = p_dec->__r1; t4   = t2 = p_dec->__r2; // Parity calculation is done via table lookup, this is also available
--    t1  &= 0xF5;             t2 >>= 25;               // on CPUs without parity, can be implemented in C and avoid unpredictable
--    t1   = Parity[t1];       t2  &= 0x63;             // jumps and slow rotate through the carry flag operations.
--    t1 <<= 31;               t2   = Parity[t2];
--
--    return (p_dec->__r1 = (t3 >> 1) | t1 ) ^ (p_dec->__r2 = (t4 + t4) | t2 );
--#else
--    return (p_dec->__r1 = (p_dec->__r1 >> 1) | ((mpc_uint32_t) Parity[ p_dec->__r1 & 0xF5] << 31))
--         ^ (p_dec->__r2 = (p_dec->__r2 << 1) |  (mpc_uint32_t) Parity[(p_dec->__r2 >> 25) & 0x63]);
--#endif
--}
diff --git a/debian/patches/0005-use-system-libmms.patch b/debian/patches/0005-use-system-libmms.patch
new file mode 100644
index 0000000..7d1c87e
--- /dev/null
+++ b/debian/patches/0005-use-system-libmms.patch
@@ -0,0 +1,129 @@
+From: Alessandro Ghedini <al3xbio at gmail.com>
+Date: Tue, 7 Dec 2010 18:41:35 +0100
+Subject: [PATCH] use system libmms
+
+Make the build system use the system libmms instead of the bundled one
+---
+ plugins/mms/Makefile.am |   16 +-----------
+ plugins/mms/Makefile.in |   57 +++-------------------------------------------
+ 2 files changed, 6 insertions(+), 67 deletions(-)
+
+diff --git a/plugins/mms/Makefile.am b/plugins/mms/Makefile.am
+index f16f741..5c052c5 100644
+--- a/plugins/mms/Makefile.am
++++ b/plugins/mms/Makefile.am
+@@ -1,21 +1,9 @@
+ if HAVE_MMS
+ mmsdir = $(libdir)/$(PACKAGE)
+ pkglib_LTLIBRARIES = mms.la
+-mms_la_SOURCES = mmsplug.c\
+-	libmms/mms.c\
+-	libmms/mmsh.c\
+-	libmms/mmsx.c\
+-	libmms/uri.c\
+-	libmms/asfheader.h\
+-	libmms/bswap.h\
+-	libmms/mms-common.h\
+-	libmms/mms.h\
+-	libmms/mmsh.h\
+-	libmms/mmsio.h\
+-	libmms/mmsx.h\
+-	libmms/uri.h
++mms_la_SOURCES = mmsplug.c
+ 
+-mms_la_LDFLAGS = -module
++mms_la_LDFLAGS = -module -lmms
+ 
+ mms_la_LIBADD = $(LDADD) $(LIBMMS_LIBS)
+ AM_CFLAGS = $(CFLAGS) -std=c99
+diff --git a/plugins/mms/Makefile.in b/plugins/mms/Makefile.in
+index 5e9b285..806c683 100644
+--- a/plugins/mms/Makefile.in
++++ b/plugins/mms/Makefile.in
+@@ -70,12 +70,8 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)"
+ LTLIBRARIES = $(pkglib_LTLIBRARIES)
+ am__DEPENDENCIES_1 =
+ @HAVE_MMS_TRUE at mms_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+-am__mms_la_SOURCES_DIST = mmsplug.c libmms/mms.c libmms/mmsh.c \
+-	libmms/mmsx.c libmms/uri.c libmms/asfheader.h libmms/bswap.h \
+-	libmms/mms-common.h libmms/mms.h libmms/mmsh.h libmms/mmsio.h \
+-	libmms/mmsx.h libmms/uri.h
+- at HAVE_MMS_TRUE@am_mms_la_OBJECTS = mmsplug.lo mms.lo mmsh.lo mmsx.lo \
+- at HAVE_MMS_TRUE@	uri.lo
++am__mms_la_SOURCES_DIST = mmsplug.c
++ at HAVE_MMS_TRUE@am_mms_la_OBJECTS = mmsplug.lo
+ mms_la_OBJECTS = $(am_mms_la_OBJECTS)
+ mms_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(mms_la_LDFLAGS) \
+@@ -310,21 +306,8 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @HAVE_MMS_TRUE at mmsdir = $(libdir)/$(PACKAGE)
+ @HAVE_MMS_TRUE at pkglib_LTLIBRARIES = mms.la
+- at HAVE_MMS_TRUE@mms_la_SOURCES = mmsplug.c\
+- at HAVE_MMS_TRUE@	libmms/mms.c\
+- at HAVE_MMS_TRUE@	libmms/mmsh.c\
+- at HAVE_MMS_TRUE@	libmms/mmsx.c\
+- at HAVE_MMS_TRUE@	libmms/uri.c\
+- at HAVE_MMS_TRUE@	libmms/asfheader.h\
+- at HAVE_MMS_TRUE@	libmms/bswap.h\
+- at HAVE_MMS_TRUE@	libmms/mms-common.h\
+- at HAVE_MMS_TRUE@	libmms/mms.h\
+- at HAVE_MMS_TRUE@	libmms/mmsh.h\
+- at HAVE_MMS_TRUE@	libmms/mmsio.h\
+- at HAVE_MMS_TRUE@	libmms/mmsx.h\
+- at HAVE_MMS_TRUE@	libmms/uri.h
+-
+- at HAVE_MMS_TRUE@mms_la_LDFLAGS = -module
++ at HAVE_MMS_TRUE@mms_la_SOURCES = mmsplug.c
++ at HAVE_MMS_TRUE@mms_la_LDFLAGS = -module -lmms
+ @HAVE_MMS_TRUE at mms_la_LIBADD = $(LDADD) $(LIBMMS_LIBS)
+ @HAVE_MMS_TRUE at AM_CFLAGS = $(CFLAGS) -std=c99
+ all: all-am
+@@ -401,11 +384,7 @@ mostlyclean-compile:
+ distclean-compile:
+ 	-rm -f *.tab.c
+ 
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mms.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsh.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsplug.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsx.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/uri.Plo at am__quote@
+ 
+ .c.o:
+ @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@@ -428,34 +407,6 @@ distclean-compile:
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+ 
+-mms.lo: libmms/mms.c
+- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mms.lo -MD -MP -MF $(DEPDIR)/mms.Tpo -c -o mms.lo `test -f 'libmms/mms.c' || echo '$(srcdir)/'`libmms/mms.c
+- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mms.Tpo $(DEPDIR)/mms.Plo
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mms.c' object='mms.lo' libtool=yes @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mms.lo `test -f 'libmms/mms.c' || echo '$(srcdir)/'`libmms/mms.c
+-
+-mmsh.lo: libmms/mmsh.c
+- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmsh.lo -MD -MP -MF $(DEPDIR)/mmsh.Tpo -c -o mmsh.lo `test -f 'libmms/mmsh.c' || echo '$(srcdir)/'`libmms/mmsh.c
+- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mmsh.Tpo $(DEPDIR)/mmsh.Plo
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mmsh.c' object='mmsh.lo' libtool=yes @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmsh.lo `test -f 'libmms/mmsh.c' || echo '$(srcdir)/'`libmms/mmsh.c
+-
+-mmsx.lo: libmms/mmsx.c
+- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmsx.lo -MD -MP -MF $(DEPDIR)/mmsx.Tpo -c -o mmsx.lo `test -f 'libmms/mmsx.c' || echo '$(srcdir)/'`libmms/mmsx.c
+- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mmsx.Tpo $(DEPDIR)/mmsx.Plo
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mmsx.c' object='mmsx.lo' libtool=yes @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmsx.lo `test -f 'libmms/mmsx.c' || echo '$(srcdir)/'`libmms/mmsx.c
+-
+-uri.lo: libmms/uri.c
+- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uri.lo -MD -MP -MF $(DEPDIR)/uri.Tpo -c -o uri.lo `test -f 'libmms/uri.c' || echo '$(srcdir)/'`libmms/uri.c
+- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/uri.Tpo $(DEPDIR)/uri.Plo
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/uri.c' object='uri.lo' libtool=yes @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uri.lo `test -f 'libmms/uri.c' || echo '$(srcdir)/'`libmms/uri.c
+-
+ mostlyclean-libtool:
+ 	-rm -f *.lo
+ 
+-- 
diff --git a/debian/patches/0006-remove-bundled-libmms.patch b/debian/patches/0006-remove-bundled-libmms.patch
deleted file mode 100644
index 432363e..0000000
--- a/debian/patches/0006-remove-bundled-libmms.patch
+++ /dev/null
@@ -1,6327 +0,0 @@
-From: Alessandro Ghedini <al3xbio at gmail.com>
-Date: Tue, 7 Dec 2010 18:41:35 +0100
-Subject: [PATCH] remove bundled libmms
-
-Removes the bundled libmms under plugins/mms/libmms and update references
----
- plugins/mms/Makefile.am         |   16 +-
- plugins/mms/Makefile.in         |  669 ---------------
- plugins/mms/libmms/asfheader.h  |  265 ------
- plugins/mms/libmms/bswap.h      |  282 ------
- plugins/mms/libmms/mms-common.h |   35 -
- plugins/mms/libmms/mms.c        | 1802 ---------------------------------------
- plugins/mms/libmms/mms.h        |   80 --
- plugins/mms/libmms/mmsh.c       | 1534 ---------------------------------
- plugins/mms/libmms/mmsh.h       |   63 --
- plugins/mms/libmms/mmsio.h      |   93 --
- plugins/mms/libmms/mmsx.c       |  168 ----
- plugins/mms/libmms/mmsx.h       |   69 --
- plugins/mms/libmms/uri.c        | 1033 ----------------------
- plugins/mms/libmms/uri.h        |   92 --
- 14 files changed, 2 insertions(+), 6199 deletions(-)
- delete mode 100644 plugins/mms/Makefile.in
- delete mode 100644 plugins/mms/libmms/asfheader.h
- delete mode 100644 plugins/mms/libmms/bswap.h
- delete mode 100644 plugins/mms/libmms/mms-common.h
- delete mode 100644 plugins/mms/libmms/mms.c
- delete mode 100644 plugins/mms/libmms/mms.h
- delete mode 100644 plugins/mms/libmms/mmsh.c
- delete mode 100644 plugins/mms/libmms/mmsh.h
- delete mode 100644 plugins/mms/libmms/mmsio.h
- delete mode 100644 plugins/mms/libmms/mmsx.c
- delete mode 100644 plugins/mms/libmms/mmsx.h
- delete mode 100644 plugins/mms/libmms/uri.c
- delete mode 100644 plugins/mms/libmms/uri.h
-
-diff --git a/plugins/mms/Makefile.am b/plugins/mms/Makefile.am
-index f16f741..5c052c5 100644
---- a/plugins/mms/Makefile.am
-+++ b/plugins/mms/Makefile.am
-@@ -1,21 +1,9 @@
- if HAVE_MMS
- mmsdir = $(libdir)/$(PACKAGE)
- pkglib_LTLIBRARIES = mms.la
--mms_la_SOURCES = mmsplug.c\
--	libmms/mms.c\
--	libmms/mmsh.c\
--	libmms/mmsx.c\
--	libmms/uri.c\
--	libmms/asfheader.h\
--	libmms/bswap.h\
--	libmms/mms-common.h\
--	libmms/mms.h\
--	libmms/mmsh.h\
--	libmms/mmsio.h\
--	libmms/mmsx.h\
--	libmms/uri.h
-+mms_la_SOURCES = mmsplug.c
- 
--mms_la_LDFLAGS = -module
-+mms_la_LDFLAGS = -module -lmms
- 
- mms_la_LIBADD = $(LDADD) $(LIBMMS_LIBS)
- AM_CFLAGS = $(CFLAGS) -std=c99
-diff --git a/plugins/mms/Makefile.in b/plugins/mms/Makefile.in
-deleted file mode 100644
-index 5e9b285..0000000
---- a/plugins/mms/Makefile.in
-+++ /dev/null
-@@ -1,669 +0,0 @@
--# Makefile.in generated by automake 1.11.1 from Makefile.am.
--# @configure_input@
--
--# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
--# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
--# Inc.
--# This Makefile.in is free software; the Free Software Foundation
--# gives unlimited permission to copy and/or distribute it,
--# with or without modifications, as long as this notice is preserved.
--
--# This program is distributed in the hope that it will be useful,
--# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
--# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
--# PARTICULAR PURPOSE.
--
-- at SET_MAKE@
--
--VPATH = @srcdir@
--pkgdatadir = $(datadir)/@PACKAGE@
--pkgincludedir = $(includedir)/@PACKAGE@
--pkglibdir = $(libdir)/@PACKAGE@
--pkglibexecdir = $(libexecdir)/@PACKAGE@
--am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
--install_sh_DATA = $(install_sh) -c -m 644
--install_sh_PROGRAM = $(install_sh) -c
--install_sh_SCRIPT = $(install_sh) -c
--INSTALL_HEADER = $(INSTALL_DATA)
--transform = $(program_transform_name)
--NORMAL_INSTALL = :
--PRE_INSTALL = :
--POST_INSTALL = :
--NORMAL_UNINSTALL = :
--PRE_UNINSTALL = :
--POST_UNINSTALL = :
--build_triplet = @build@
--host_triplet = @host@
--subdir = plugins/mms
--DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
--ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
--am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
--	$(top_srcdir)/configure.ac
--am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
--	$(ACLOCAL_M4)
--mkinstalldirs = $(install_sh) -d
--CONFIG_HEADER = $(top_builddir)/config.h
--CONFIG_CLEAN_FILES =
--CONFIG_CLEAN_VPATH_FILES =
--am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
--am__vpath_adj = case $$p in \
--    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
--    *) f=$$p;; \
--  esac;
--am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
--am__install_max = 40
--am__nobase_strip_setup = \
--  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
--am__nobase_strip = \
--  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
--am__nobase_list = $(am__nobase_strip_setup); \
--  for p in $$list; do echo "$$p $$p"; done | \
--  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
--  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
--    if (++n[$$2] == $(am__install_max)) \
--      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
--    END { for (dir in files) print dir, files[dir] }'
--am__base_list = \
--  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
--  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
--am__installdirs = "$(DESTDIR)$(pkglibdir)"
--LTLIBRARIES = $(pkglib_LTLIBRARIES)
--am__DEPENDENCIES_1 =
-- at HAVE_MMS_TRUE@mms_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
--am__mms_la_SOURCES_DIST = mmsplug.c libmms/mms.c libmms/mmsh.c \
--	libmms/mmsx.c libmms/uri.c libmms/asfheader.h libmms/bswap.h \
--	libmms/mms-common.h libmms/mms.h libmms/mmsh.h libmms/mmsio.h \
--	libmms/mmsx.h libmms/uri.h
-- at HAVE_MMS_TRUE@am_mms_la_OBJECTS = mmsplug.lo mms.lo mmsh.lo mmsx.lo \
-- at HAVE_MMS_TRUE@	uri.lo
--mms_la_OBJECTS = $(am_mms_la_OBJECTS)
--mms_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(mms_la_LDFLAGS) \
--	$(LDFLAGS) -o $@
-- at HAVE_MMS_TRUE@am_mms_la_rpath = -rpath $(pkglibdir)
--DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
--depcomp = $(SHELL) $(top_srcdir)/depcomp
--am__depfiles_maybe = depfiles
--am__mv = mv -f
--COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
--	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--CCLD = $(CC)
--LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
--	$(LDFLAGS) -o $@
--SOURCES = $(mms_la_SOURCES)
--DIST_SOURCES = $(am__mms_la_SOURCES_DIST)
--ETAGS = etags
--CTAGS = ctags
--DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
--ACLOCAL = @ACLOCAL@
--ALLOCA = @ALLOCA@
--ALL_LINGUAS = @ALL_LINGUAS@
--ALSA_DEPS_CFLAGS = @ALSA_DEPS_CFLAGS@
--ALSA_DEPS_LIBS = @ALSA_DEPS_LIBS@
--AMTAR = @AMTAR@
--AR = @AR@
--AUTOCONF = @AUTOCONF@
--AUTOHEADER = @AUTOHEADER@
--AUTOMAKE = @AUTOMAKE@
--AWK = @AWK@
--BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
--CATOBJEXT = @CATOBJEXT@
--CC = @CC@
--CCDEPMODE = @CCDEPMODE@
--CDDA_LIBS = @CDDA_LIBS@
--CFLAGS = @CFLAGS@
--CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
--CPP = @CPP@
--CPPFLAGS = @CPPFLAGS@
--CURL_LIBS = @CURL_LIBS@
--CXX = @CXX@
--CXXCPP = @CXXCPP@
--CXXDEPMODE = @CXXDEPMODE@
--CXXFLAGS = @CXXFLAGS@
--CYGPATH_W = @CYGPATH_W@
--DATADIRNAME = @DATADIRNAME@
--DBUS_DEPS_CFLAGS = @DBUS_DEPS_CFLAGS@
--DBUS_DEPS_LIBS = @DBUS_DEPS_LIBS@
--DEFS = @DEFS@
--DEPDIR = @DEPDIR@
--DEPS_CFLAGS = @DEPS_CFLAGS@
--DEPS_LIBS = @DEPS_LIBS@
--DLLTOOL = @DLLTOOL@
--DSYMUTIL = @DSYMUTIL@
--DUMPBIN = @DUMPBIN@
--ECHO_C = @ECHO_C@
--ECHO_N = @ECHO_N@
--ECHO_T = @ECHO_T@
--EGREP = @EGREP@
--EXEEXT = @EXEEXT@
--FAAD2_LIBS = @FAAD2_LIBS@
--FFMPEG_DEPS_CFLAGS = @FFMPEG_DEPS_CFLAGS@
--FFMPEG_DEPS_LIBS = @FFMPEG_DEPS_LIBS@
--FGREP = @FGREP@
--FLAC_LIBS = @FLAC_LIBS@
--GENCAT = @GENCAT@
--GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
--GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
--GLIBC2 = @GLIBC2@
--GLIBC21 = @GLIBC21@
--GMSGFMT = @GMSGFMT@
--GMSGFMT_015 = @GMSGFMT_015@
--GREP = @GREP@
--GTKUI_DEPS_CFLAGS = @GTKUI_DEPS_CFLAGS@
--GTKUI_DEPS_LIBS = @GTKUI_DEPS_LIBS@
--HAVE_ASPRINTF = @HAVE_ASPRINTF@
--HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
--HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
--HAVE_SNPRINTF = @HAVE_SNPRINTF@
--HAVE_VISIBILITY = @HAVE_VISIBILITY@
--HAVE_WPRINTF = @HAVE_WPRINTF@
--HOTKEYS_LIBS = @HOTKEYS_LIBS@
--ICONV_LIB = @ICONV_LIB@
--INSANE_CFLAGS = @INSANE_CFLAGS@
--INSANE_CXXFLAGS = @INSANE_CXXFLAGS@
--INSTALL = @INSTALL@
--INSTALL_DATA = @INSTALL_DATA@
--INSTALL_PROGRAM = @INSTALL_PROGRAM@
--INSTALL_SCRIPT = @INSTALL_SCRIPT@
--INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
--INSTOBJEXT = @INSTOBJEXT@
--INTLBISON = @INTLBISON@
--INTLLIBS = @INTLLIBS@
--INTLOBJS = @INTLOBJS@
--INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
--INTLTOOL_MERGE = @INTLTOOL_MERGE@
--INTLTOOL_PERL = @INTLTOOL_PERL@
--INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
--INTL_DEFAULT_VERBOSITY = @INTL_DEFAULT_VERBOSITY@
--INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
--INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
--LD = @LD@
--LDFLAGS = @LDFLAGS@
--LIBICONV = @LIBICONV@
--LIBINTL = @LIBINTL@
--LIBMMS_LIBS = @LIBMMS_LIBS@
--LIBMULTITHREAD = @LIBMULTITHREAD@
--LIBOBJS = @LIBOBJS@
--LIBPTH = @LIBPTH@
--LIBPTH_PREFIX = @LIBPTH_PREFIX@
--LIBS = @LIBS@
--LIBTHREAD = @LIBTHREAD@
--LIBTOOL = @LIBTOOL@
--LIPO = @LIPO@
--LN_S = @LN_S@
--LTLIBC = @LTLIBC@
--LTLIBICONV = @LTLIBICONV@
--LTLIBINTL = @LTLIBINTL@
--LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
--LTLIBOBJS = @LTLIBOBJS@
--LTLIBPTH = @LTLIBPTH@
--LTLIBTHREAD = @LTLIBTHREAD@
--MAD_LIBS = @MAD_LIBS@
--MAINT = @MAINT@
--MAKEINFO = @MAKEINFO@
--MANIFEST_TOOL = @MANIFEST_TOOL@
--MKDIR_P = @MKDIR_P@
--MSGFMT = @MSGFMT@
--MSGFMT_015 = @MSGFMT_015@
--MSGMERGE = @MSGMERGE@
--NM = @NM@
--NMEDIT = @NMEDIT@
--NOTIFY_CFLAGS = @NOTIFY_CFLAGS@
--NOTIFY_LIBS = @NOTIFY_LIBS@
--OBJDUMP = @OBJDUMP@
--OBJEXT = @OBJEXT@
--OSS_CFLAGS = @OSS_CFLAGS@
--OTOOL = @OTOOL@
--OTOOL64 = @OTOOL64@
--PACKAGE = @PACKAGE@
--PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
--PACKAGE_NAME = @PACKAGE_NAME@
--PACKAGE_STRING = @PACKAGE_STRING@
--PACKAGE_TARNAME = @PACKAGE_TARNAME@
--PACKAGE_URL = @PACKAGE_URL@
--PACKAGE_VERSION = @PACKAGE_VERSION@
--PATH_SEPARATOR = @PATH_SEPARATOR@
--PKG_CONFIG = @PKG_CONFIG@
--PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
--PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
--PLUGINS_DIRS = @PLUGINS_DIRS@
--POSUB = @POSUB@
--PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
--PULSE_DEPS_CFLAGS = @PULSE_DEPS_CFLAGS@
--PULSE_DEPS_LIBS = @PULSE_DEPS_LIBS@
--RANLIB = @RANLIB@
--SED = @SED@
--SET_MAKE = @SET_MAKE@
--SHELL = @SHELL@
--SNDFILE_LIBS = @SNDFILE_LIBS@
--STRIP = @STRIP@
--USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
--USE_NLS = @USE_NLS@
--VALAC = @VALAC@
--VERSION = @VERSION@
--VFS_CURL_LIBS = @VFS_CURL_LIBS@
--VORBIS_LIBS = @VORBIS_LIBS@
--WAVPACK_LIBS = @WAVPACK_LIBS@
--WINDRES = @WINDRES@
--WOE32 = @WOE32@
--WOE32DLL = @WOE32DLL@
--XGETTEXT = @XGETTEXT@
--XGETTEXT_015 = @XGETTEXT_015@
--XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
--ZLIB_LIBS = @ZLIB_LIBS@
--abs_builddir = @abs_builddir@
--abs_srcdir = @abs_srcdir@
--abs_top_builddir = @abs_top_builddir@
--abs_top_srcdir = @abs_top_srcdir@
--ac_ct_AR = @ac_ct_AR@
--ac_ct_CC = @ac_ct_CC@
--ac_ct_CXX = @ac_ct_CXX@
--ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
--am__include = @am__include@
--am__leading_dot = @am__leading_dot@
--am__quote = @am__quote@
--am__tar = @am__tar@
--am__untar = @am__untar@
--bindir = @bindir@
--build = @build@
--build_alias = @build_alias@
--build_cpu = @build_cpu@
--build_os = @build_os@
--build_vendor = @build_vendor@
--builddir = @builddir@
--datadir = @datadir@
--datarootdir = @datarootdir@
--docdir = @docdir@
--dvidir = @dvidir@
--exec_prefix = @exec_prefix@
--host = @host@
--host_alias = @host_alias@
--host_cpu = @host_cpu@
--host_os = @host_os@
--host_vendor = @host_vendor@
--htmldir = @htmldir@
--includedir = @includedir@
--infodir = @infodir@
--install_sh = @install_sh@
--libdir = @libdir@
--libexecdir = @libexecdir@
--localedir = @localedir@
--localstatedir = @localstatedir@
--mandir = @mandir@
--mkdir_p = @mkdir_p@
--oldincludedir = @oldincludedir@
--pdfdir = @pdfdir@
--prefix = @prefix@
--program_transform_name = @program_transform_name@
--psdir = @psdir@
--sbindir = @sbindir@
--sharedstatedir = @sharedstatedir@
--srcdir = @srcdir@
--sysconfdir = @sysconfdir@
--target_alias = @target_alias@
--top_build_prefix = @top_build_prefix@
--top_builddir = @top_builddir@
--top_srcdir = @top_srcdir@
-- at HAVE_MMS_TRUE@mmsdir = $(libdir)/$(PACKAGE)
-- at HAVE_MMS_TRUE@pkglib_LTLIBRARIES = mms.la
-- at HAVE_MMS_TRUE@mms_la_SOURCES = mmsplug.c\
-- at HAVE_MMS_TRUE@	libmms/mms.c\
-- at HAVE_MMS_TRUE@	libmms/mmsh.c\
-- at HAVE_MMS_TRUE@	libmms/mmsx.c\
-- at HAVE_MMS_TRUE@	libmms/uri.c\
-- at HAVE_MMS_TRUE@	libmms/asfheader.h\
-- at HAVE_MMS_TRUE@	libmms/bswap.h\
-- at HAVE_MMS_TRUE@	libmms/mms-common.h\
-- at HAVE_MMS_TRUE@	libmms/mms.h\
-- at HAVE_MMS_TRUE@	libmms/mmsh.h\
-- at HAVE_MMS_TRUE@	libmms/mmsio.h\
-- at HAVE_MMS_TRUE@	libmms/mmsx.h\
-- at HAVE_MMS_TRUE@	libmms/uri.h
--
-- at HAVE_MMS_TRUE@mms_la_LDFLAGS = -module
-- at HAVE_MMS_TRUE@mms_la_LIBADD = $(LDADD) $(LIBMMS_LIBS)
-- at HAVE_MMS_TRUE@AM_CFLAGS = $(CFLAGS) -std=c99
--all: all-am
--
--.SUFFIXES:
--.SUFFIXES: .c .lo .o .obj
--$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
--	@for dep in $?; do \
--	  case '$(am__configure_deps)' in \
--	    *$$dep*) \
--	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
--	        && { if test -f $@; then exit 0; else break; fi; }; \
--	      exit 1;; \
--	  esac; \
--	done; \
--	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/mms/Makefile'; \
--	$(am__cd) $(top_srcdir) && \
--	  $(AUTOMAKE) --gnu plugins/mms/Makefile
--.PRECIOUS: Makefile
--Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
--	@case '$?' in \
--	  *config.status*) \
--	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
--	  *) \
--	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
--	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
--	esac;
--
--$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--
--$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
--	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
--$(am__aclocal_m4_deps):
--install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
--	@$(NORMAL_INSTALL)
--	test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
--	@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
--	list2=; for p in $$list; do \
--	  if test -f $$p; then \
--	    list2="$$list2 $$p"; \
--	  else :; fi; \
--	done; \
--	test -z "$$list2" || { \
--	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
--	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
--	}
--
--uninstall-pkglibLTLIBRARIES:
--	@$(NORMAL_UNINSTALL)
--	@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
--	for p in $$list; do \
--	  $(am__strip_dir) \
--	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
--	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
--	done
--
--clean-pkglibLTLIBRARIES:
--	-test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
--	@list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
--	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
--	  test "$$dir" != "$$p" || dir=.; \
--	  echo "rm -f \"$${dir}/so_locations\""; \
--	  rm -f "$${dir}/so_locations"; \
--	done
--mms.la: $(mms_la_OBJECTS) $(mms_la_DEPENDENCIES) 
--	$(mms_la_LINK) $(am_mms_la_rpath) $(mms_la_OBJECTS) $(mms_la_LIBADD) $(LIBS)
--
--mostlyclean-compile:
--	-rm -f *.$(OBJEXT)
--
--distclean-compile:
--	-rm -f *.tab.c
--
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mms.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsh.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsplug.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mmsx.Plo at am__quote@
-- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/uri.Plo at am__quote@
--
--.c.o:
-- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(COMPILE) -c $<
--
--.c.obj:
-- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
--
--.c.lo:
-- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
--
--mms.lo: libmms/mms.c
-- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mms.lo -MD -MP -MF $(DEPDIR)/mms.Tpo -c -o mms.lo `test -f 'libmms/mms.c' || echo '$(srcdir)/'`libmms/mms.c
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mms.Tpo $(DEPDIR)/mms.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mms.c' object='mms.lo' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mms.lo `test -f 'libmms/mms.c' || echo '$(srcdir)/'`libmms/mms.c
--
--mmsh.lo: libmms/mmsh.c
-- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmsh.lo -MD -MP -MF $(DEPDIR)/mmsh.Tpo -c -o mmsh.lo `test -f 'libmms/mmsh.c' || echo '$(srcdir)/'`libmms/mmsh.c
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mmsh.Tpo $(DEPDIR)/mmsh.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mmsh.c' object='mmsh.lo' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmsh.lo `test -f 'libmms/mmsh.c' || echo '$(srcdir)/'`libmms/mmsh.c
--
--mmsx.lo: libmms/mmsx.c
-- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmsx.lo -MD -MP -MF $(DEPDIR)/mmsx.Tpo -c -o mmsx.lo `test -f 'libmms/mmsx.c' || echo '$(srcdir)/'`libmms/mmsx.c
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mmsx.Tpo $(DEPDIR)/mmsx.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/mmsx.c' object='mmsx.lo' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmsx.lo `test -f 'libmms/mmsx.c' || echo '$(srcdir)/'`libmms/mmsx.c
--
--uri.lo: libmms/uri.c
-- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT uri.lo -MD -MP -MF $(DEPDIR)/uri.Tpo -c -o uri.lo `test -f 'libmms/uri.c' || echo '$(srcdir)/'`libmms/uri.c
-- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/uri.Tpo $(DEPDIR)/uri.Plo
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libmms/uri.c' object='uri.lo' libtool=yes @AMDEPBACKSLASH@
-- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o uri.lo `test -f 'libmms/uri.c' || echo '$(srcdir)/'`libmms/uri.c
--
--mostlyclean-libtool:
--	-rm -f *.lo
--
--clean-libtool:
--	-rm -rf .libs _libs
--
--ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
--	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	mkid -fID $$unique
--tags: TAGS
--
--TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
--		$(TAGS_FILES) $(LISP)
--	set x; \
--	here=`pwd`; \
--	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	shift; \
--	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
--	  test -n "$$unique" || unique=$$empty_fix; \
--	  if test $$# -gt 0; then \
--	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
--	      "$$@" $$unique; \
--	  else \
--	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
--	      $$unique; \
--	  fi; \
--	fi
--ctags: CTAGS
--CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
--		$(TAGS_FILES) $(LISP)
--	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
--	unique=`for i in $$list; do \
--	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
--	  done | \
--	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
--	      END { if (nonempty) { for (i in files) print i; }; }'`; \
--	test -z "$(CTAGS_ARGS)$$unique" \
--	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
--	     $$unique
--
--GTAGS:
--	here=`$(am__cd) $(top_builddir) && pwd` \
--	  && $(am__cd) $(top_srcdir) \
--	  && gtags -i $(GTAGS_ARGS) "$$here"
--
--distclean-tags:
--	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
--
--distdir: $(DISTFILES)
--	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
--	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
--	list='$(DISTFILES)'; \
--	  dist_files=`for file in $$list; do echo $$file; done | \
--	  sed -e "s|^$$srcdirstrip/||;t" \
--	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
--	case $$dist_files in \
--	  */*) $(MKDIR_P) `echo "$$dist_files" | \
--			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
--			   sort -u` ;; \
--	esac; \
--	for file in $$dist_files; do \
--	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
--	  if test -d $$d/$$file; then \
--	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
--	    if test -d "$(distdir)/$$file"; then \
--	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
--	    fi; \
--	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
--	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
--	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
--	    fi; \
--	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
--	  else \
--	    test -f "$(distdir)/$$file" \
--	    || cp -p $$d/$$file "$(distdir)/$$file" \
--	    || exit 1; \
--	  fi; \
--	done
--check-am: all-am
--check: check-am
--all-am: Makefile $(LTLIBRARIES)
--installdirs:
--	for dir in "$(DESTDIR)$(pkglibdir)"; do \
--	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
--	done
--install: install-am
--install-exec: install-exec-am
--install-data: install-data-am
--uninstall: uninstall-am
--
--install-am: all-am
--	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
--
--installcheck: installcheck-am
--install-strip:
--	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
--	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
--	  `test -z '$(STRIP)' || \
--	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
--mostlyclean-generic:
--
--clean-generic:
--
--distclean-generic:
--	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
--	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
--
--maintainer-clean-generic:
--	@echo "This command is intended for maintainers to use"
--	@echo "it deletes files that may require special tools to rebuild."
--clean: clean-am
--
--clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
--	mostlyclean-am
--
--distclean: distclean-am
--	-rm -rf ./$(DEPDIR)
--	-rm -f Makefile
--distclean-am: clean-am distclean-compile distclean-generic \
--	distclean-tags
--
--dvi: dvi-am
--
--dvi-am:
--
--html: html-am
--
--html-am:
--
--info: info-am
--
--info-am:
--
--install-data-am:
--
--install-dvi: install-dvi-am
--
--install-dvi-am:
--
--install-exec-am: install-pkglibLTLIBRARIES
--
--install-html: install-html-am
--
--install-html-am:
--
--install-info: install-info-am
--
--install-info-am:
--
--install-man:
--
--install-pdf: install-pdf-am
--
--install-pdf-am:
--
--install-ps: install-ps-am
--
--install-ps-am:
--
--installcheck-am:
--
--maintainer-clean: maintainer-clean-am
--	-rm -rf ./$(DEPDIR)
--	-rm -f Makefile
--maintainer-clean-am: distclean-am maintainer-clean-generic
--
--mostlyclean: mostlyclean-am
--
--mostlyclean-am: mostlyclean-compile mostlyclean-generic \
--	mostlyclean-libtool
--
--pdf: pdf-am
--
--pdf-am:
--
--ps: ps-am
--
--ps-am:
--
--uninstall-am: uninstall-pkglibLTLIBRARIES
--
--.MAKE: install-am install-strip
--
--.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
--	clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
--	distclean-compile distclean-generic distclean-libtool \
--	distclean-tags distdir dvi dvi-am html html-am info info-am \
--	install install-am install-data install-data-am install-dvi \
--	install-dvi-am install-exec install-exec-am install-html \
--	install-html-am install-info install-info-am install-man \
--	install-pdf install-pdf-am install-pkglibLTLIBRARIES \
--	install-ps install-ps-am install-strip installcheck \
--	installcheck-am installdirs maintainer-clean \
--	maintainer-clean-generic mostlyclean mostlyclean-compile \
--	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
--	tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES
--
--
--# Tell versions [3.59,3.63) of GNU make to not export all variables.
--# Otherwise a system limit (for SysV at least) may be exceeded.
--.NOEXPORT:
-diff --git a/plugins/mms/libmms/asfheader.h b/plugins/mms/libmms/asfheader.h
-deleted file mode 100644
-index 2aaffb3..0000000
---- a/plugins/mms/libmms/asfheader.h
-+++ /dev/null
-@@ -1,265 +0,0 @@
--/*
-- * Copyright (C) 2000-2003 the xine project
-- *
-- * This file is part of xine, a free video player.
-- *
-- * xine is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * xine is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * $Id: asfheader.h,v 1.2 2005/12/12 09:24:19 theuraeus Exp $
-- *
-- * demultiplexer for asf streams
-- *
-- * based on ffmpeg's
-- * ASF compatible encoder and decoder.
-- * Copyright (c) 2000, 2001 Gerard Lantau.
-- *
-- * GUID list from avifile
-- * some other ideas from MPlayer
-- */
--
--#ifndef ASFHEADER_H
--#define ASFHEADER_H
--
--/*
-- * define asf GUIDs (list from avifile)
-- */
--#define GUID_ERROR                              0
--
--    /* base ASF objects */
--#define GUID_ASF_HEADER                         1
--#define GUID_ASF_DATA                           2
--#define GUID_ASF_SIMPLE_INDEX                   3
--#define GUID_INDEX                              4
--#define GUID_MEDIA_OBJECT_INDEX                 5
--#define GUID_TIMECODE_INDEX                     6
--
--    /* header ASF objects */
--#define GUID_ASF_FILE_PROPERTIES                7
--#define GUID_ASF_STREAM_PROPERTIES              8
--#define GUID_ASF_HEADER_EXTENSION               9
--#define GUID_ASF_CODEC_LIST                    10
--#define GUID_ASF_SCRIPT_COMMAND                11
--#define GUID_ASF_MARKER                        12
--#define GUID_ASF_BITRATE_MUTUAL_EXCLUSION      13
--#define GUID_ASF_ERROR_CORRECTION              14
--#define GUID_ASF_CONTENT_DESCRIPTION           15
--#define GUID_ASF_EXTENDED_CONTENT_DESCRIPTION  16
--#define GUID_ASF_STREAM_BITRATE_PROPERTIES     17
--#define GUID_ASF_EXTENDED_CONTENT_ENCRYPTION   18
--#define GUID_ASF_PADDING                       19
--    
--    /* stream properties object stream type */
--#define GUID_ASF_AUDIO_MEDIA                   20
--#define GUID_ASF_VIDEO_MEDIA                   21
--#define GUID_ASF_COMMAND_MEDIA                 22
--#define GUID_ASF_JFIF_MEDIA                    23
--#define GUID_ASF_DEGRADABLE_JPEG_MEDIA         24
--#define GUID_ASF_FILE_TRANSFER_MEDIA           25
--#define GUID_ASF_BINARY_MEDIA                  26
--
--    /* stream properties object error correction type */
--#define GUID_ASF_NO_ERROR_CORRECTION           27
--#define GUID_ASF_AUDIO_SPREAD                  28
--
--    /* mutual exclusion object exlusion type */
--#define GUID_ASF_MUTEX_BITRATE                 29
--#define GUID_ASF_MUTEX_UKNOWN                  30
--
--    /* header extension */
--#define GUID_ASF_RESERVED_1                    31
--    
--    /* script command */
--#define GUID_ASF_RESERVED_SCRIPT_COMMNAND      32
--
--    /* marker object */
--#define GUID_ASF_RESERVED_MARKER               33
--
--    /* various */
--/*
--#define GUID_ASF_HEAD2                         27
--*/
--#define GUID_ASF_AUDIO_CONCEAL_NONE            34
--#define GUID_ASF_CODEC_COMMENT1_HEADER         35
--#define GUID_ASF_2_0_HEADER                    36
--#define GUID_ASF_EXTENDED_STREAM_PROPERTIES    37
--
--#define GUID_END                               38
--
--
--/* asf stream types */
--#define ASF_STREAM_TYPE_UNKNOWN           0
--#define ASF_STREAM_TYPE_AUDIO             1
--#define ASF_STREAM_TYPE_VIDEO             2
--#define ASF_STREAM_TYPE_CONTROL           3
--#define ASF_STREAM_TYPE_JFIF              4
--#define ASF_STREAM_TYPE_DEGRADABLE_JPEG   5
--#define ASF_STREAM_TYPE_FILE_TRANSFER     6
--#define ASF_STREAM_TYPE_BINARY            7
--
--#define ASF_MAX_NUM_STREAMS     23
--
--#ifndef GUID_DEFINED
--#define GUID_DEFINED
--
--typedef struct _GUID {          /* size is 16 */
--  uint32_t Data1;
--  uint16_t Data2;
--  uint16_t Data3;
--  uint8_t  Data4[8];
--} GUID;
--
--#endif /* !GUID_DEFINED */
--
--static const struct
--{
--    const char* name;
--    const GUID  guid;
--} guids[] =
--{
--    { "error",
--    { 0x0,} },
--
--
--    /* base ASF objects */
--    { "header",
--    { 0x75b22630, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} },
--
--    { "data",
--    { 0x75b22636, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} },
--
--    { "simple index",
--    { 0x33000890, 0xe5b1, 0x11cf, { 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb }} },
--
--    { "index",
--    { 0xd6e229d3, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} },
--
--    { "media object index",
--    { 0xfeb103f8, 0x12ad, 0x4c64, { 0x84, 0x0f, 0x2a, 0x1d, 0x2f, 0x7a, 0xd4, 0x8c }} },
--
--    { "timecode index",
--    { 0x3cb73fd0, 0x0c4a, 0x4803, { 0x95, 0x3d, 0xed, 0xf7, 0xb6, 0x22, 0x8f, 0x0c }} },
--
--    /* header ASF objects */
--    { "file properties",
--    { 0x8cabdca1, 0xa947, 0x11cf, { 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--
--    { "stream header",
--    { 0xb7dc0791, 0xa9b7, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--
--    { "header extension",
--    { 0x5fbf03b5, 0xa92e, 0x11cf, { 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--
--    { "codec list",
--    { 0x86d15240, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} },
--
--    { "script command",
--    { 0x1efb1a30, 0x0b62, 0x11d0, { 0xa3, 0x9b, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} },
--
--    { "marker",
--    { 0xf487cd01, 0xa951, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--
--    { "bitrate mutual exclusion",
--    { 0xd6e229dc, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} },
--
--    { "error correction",
--    { 0x75b22635, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} },
--
--    { "content description",
--    { 0x75b22633, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} },
--
--    { "extended content description",
--    { 0xd2d0a440, 0xe307, 0x11d2, { 0x97, 0xf0, 0x00, 0xa0, 0xc9, 0x5e, 0xa8, 0x50 }} },
--
--    { "stream bitrate properties", /* (http://get.to/sdp) */
--    { 0x7bf875ce, 0x468d, 0x11d1, { 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2 }} },
--
--    { "extended content encryption",
--    { 0x298ae614, 0x2622, 0x4c17, { 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c }} },
--
--    { "padding",
--    { 0x1806d474, 0xcadf, 0x4509, { 0xa4, 0xba, 0x9a, 0xab, 0xcb, 0x96, 0xaa, 0xe8 }} },
--
--
--    /* stream properties object stream type */
--    { "audio media",
--    { 0xf8699e40, 0x5b4d, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} },
--
--    { "video media",
--    { 0xbc19efc0, 0x5b4d, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} },
--
--    { "command media",
--    { 0x59dacfc0, 0x59e6, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} },
--
--    { "JFIF media (JPEG)",
--    { 0xb61be100, 0x5b4e, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} },
--
--    { "Degradable JPEG media",
--    { 0x35907de0, 0xe415, 0x11cf, { 0xa9, 0x17, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} },
--
--    { "File Transfer media",
--    { 0x91bd222c, 0xf21c, 0x497a, { 0x8b, 0x6d, 0x5a, 0xa8, 0x6b, 0xfc, 0x01, 0x85 }} },
--
--    { "Binary media",
--    { 0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43 }} },
--
--    /* stream properties object error correction */
--    { "no error correction",
--    { 0x20fb5700, 0x5b55, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} },
--
--    { "audio spread",
--    { 0xbfc3cd50, 0x618f, 0x11cf, { 0x8b, 0xb2, 0x00, 0xaa, 0x00, 0xb4, 0xe2, 0x20 }} },
--
--
--    /* mutual exclusion object exlusion type */
--    { "mutex bitrate",
--    { 0xd6e22a01, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} },
--
--    { "mutex unknown", 
--    { 0xd6e22a02, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} },
--
--
--    /* header extension */
--    { "reserved_1",
--    { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--
--
--    /* script command */
--    { "reserved script command",
--    { 0x4B1ACBE3, 0x100B, 0x11D0, { 0xA3, 0x9B, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }} },
--
--    /* marker object */
--    { "reserved marker",
--    { 0x4CFEDB20, 0x75F6, 0x11CF, { 0x9C, 0x0F, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB }} },
--
--    /* various */
--    /* Already defined (reserved_1)
--    { "head2",
--    { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} },
--    */
--    { "audio conceal none",
--    { 0x49f1a440, 0x4ece, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} },
--
--    { "codec comment1 header",
--    { 0x86d15241, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} },
--
--    { "asf 2.0 header",
--    { 0xd6e229d1, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} },
--
--    { "extended stream properties",
--    { 0x14e6a5cb, 0xc672, 0x4332, { 0x83, 0x99, 0xa9, 0x69, 0x52, 0x06, 0x5b, 0x5a }} },
--
--};
--
--#endif
-diff --git a/plugins/mms/libmms/bswap.h b/plugins/mms/libmms/bswap.h
-deleted file mode 100644
-index 6a6e1d1..0000000
---- a/plugins/mms/libmms/bswap.h
-+++ /dev/null
-@@ -1,282 +0,0 @@
--#ifndef BSWAP_H_INCLUDED
--#define BSWAP_H_INCLUDED
--
--/*
-- * Copyright (C) 2004 Maciej Katafiasz <mathrick at users.sourceforge.net>
-- *
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU Library General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * This program is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--
--/* NOTE:
-- * Now, to clear up confusion: LE_XX means "from LE to native, XX bits wide"
-- * I know it's not very clear naming (tell me about it, I
-- * misinterpreted in first version and caused bad nasty bug, *sigh*),
-- * but that's inherited code, will clean up as things go
-- * Oh, and one more thing -- they take *pointers*, not actual ints
-- */
--
--/* Basic bit swapping functions
-- */
--#define GUINT16_SWAP_LE_BE_CONSTANT(val)	((guint16) ( \
--    (guint16) ((guint16) (val) >> 8) |	\
--    (guint16) ((guint16) (val) << 8)))
--
--#define GUINT32_SWAP_LE_BE_CONSTANT(val)	((guint32) ( \
--    (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \
--    (((guint32) (val) & (guint32) 0x0000ff00U) <<  8) | \
--    (((guint32) (val) & (guint32) 0x00ff0000U) >>  8) | \
--    (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
--
--#define GUINT64_SWAP_LE_BE_CONSTANT(val)	((guint64) ( \
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) <<  8) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >>  8) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) |	\
--      (((guint64) (val) &						\
--	(guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56)))
--
--/* Arch specific stuff for speed
-- */
--#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
--#  if defined (__i386__)
--#    define GUINT16_SWAP_LE_BE_IA32(val) \
--       (__extension__						\
--	({ register guint16 __v, __x = ((guint16) (val));	\
--	   if (__builtin_constant_p (__x))			\
--	     __v = GUINT16_SWAP_LE_BE_CONSTANT (__x);		\
--	   else							\
--	     __asm__ ("rorw $8, %w0"				\
--		      : "=r" (__v)				\
--		      : "0" (__x)				\
--		      : "cc");					\
--	    __v; }))
--#    if !defined (__i486__) && !defined (__i586__) \
--	&& !defined (__pentium__) && !defined (__i686__) \
--	&& !defined (__pentiumpro__) && !defined (__pentium4__)
--#       define GUINT32_SWAP_LE_BE_IA32(val) \
--	  (__extension__					\
--	   ({ register guint32 __v, __x = ((guint32) (val));	\
--	      if (__builtin_constant_p (__x))			\
--		__v = GUINT32_SWAP_LE_BE_CONSTANT (__x);	\
--	      else						\
--		__asm__ ("rorw $8, %w0\n\t"			\
--			 "rorl $16, %0\n\t"			\
--			 "rorw $8, %w0"				\
--			 : "=r" (__v)				\
--			 : "0" (__x)				\
--			 : "cc");				\
--	      __v; }))
--#    else /* 486 and higher has bswap */
--#       define GUINT32_SWAP_LE_BE_IA32(val) \
--	  (__extension__					\
--	   ({ register guint32 __v, __x = ((guint32) (val));	\
--	      if (__builtin_constant_p (__x))			\
--		__v = GUINT32_SWAP_LE_BE_CONSTANT (__x);	\
--	      else						\
--		__asm__ ("bswap %0"				\
--			 : "=r" (__v)				\
--			 : "0" (__x));				\
--	      __v; }))
--#    endif /* processor specific 32-bit stuff */
--#    define GUINT64_SWAP_LE_BE_IA32(val) \
--       (__extension__							\
--	({ union { guint64 __ll;					\
--		   guint32 __l[2]; } __w, __r;				\
--	   __w.__ll = ((guint64) (val));				\
--	   if (__builtin_constant_p (__w.__ll))				\
--	     __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll);		\
--	   else								\
--	     {								\
--	       __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]);		\
--	       __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]);		\
--	     }								\
--	   __r.__ll; }))
--     /* Possibly just use the constant version and let gcc figure it out? */
--#    define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val))
--#    define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
--#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
--#  elif defined (__ia64__)
--#    define GUINT16_SWAP_LE_BE_IA64(val) \
--       (__extension__						\
--	({ register guint16 __v, __x = ((guint16) (val));	\
--	   if (__builtin_constant_p (__x))			\
--	     __v = GUINT16_SWAP_LE_BE_CONSTANT (__x);		\
--	   else							\
--	     __asm__ __volatile__ ("shl %0 = %1, 48 ;;"		\
--				   "mux1 %0 = %0, @rev ;;"	\
--				    : "=r" (__v)		\
--				    : "r" (__x));		\
--	    __v; }))
--#    define GUINT32_SWAP_LE_BE_IA64(val) \
--       (__extension__						\
--	 ({ register guint32 __v, __x = ((guint32) (val));	\
--	    if (__builtin_constant_p (__x))			\
--	      __v = GUINT32_SWAP_LE_BE_CONSTANT (__x);		\
--	    else						\
--	     __asm__ __volatile__ ("shl %0 = %1, 32 ;;"		\
--				   "mux1 %0 = %0, @rev ;;"	\
--				    : "=r" (__v)		\
--				    : "r" (__x));		\
--	    __v; }))
--#    define GUINT64_SWAP_LE_BE_IA64(val) \
--       (__extension__						\
--	({ register guint64 __v, __x = ((guint64) (val));	\
--	   if (__builtin_constant_p (__x))			\
--	     __v = GUINT64_SWAP_LE_BE_CONSTANT (__x);		\
--	   else							\
--	     __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;"	\
--				   : "=r" (__v)			\
--				   : "r" (__x));		\
--	   __v; }))
--#    define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val))
--#    define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
--#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
--#  elif defined (__x86_64__)
--#    define GUINT32_SWAP_LE_BE_X86_64(val) \
--       (__extension__						\
--	 ({ register guint32 __v, __x = ((guint32) (val));	\
--	    if (__builtin_constant_p (__x))			\
--	      __v = GUINT32_SWAP_LE_BE_CONSTANT (__x);		\
--	    else						\
--	     __asm__ ("bswapl %0"				\
--		      : "=r" (__v)				\
--		      : "0" (__x));				\
--	    __v; }))
--#    define GUINT64_SWAP_LE_BE_X86_64(val) \
--       (__extension__						\
--	({ register guint64 __v, __x = ((guint64) (val));	\
--	   if (__builtin_constant_p (__x))			\
--	     __v = GUINT64_SWAP_LE_BE_CONSTANT (__x);		\
--	   else							\
--	     __asm__ ("bswapq %0"				\
--		      : "=r" (__v)				\
--		      : "0" (__x));				\
--	   __v; }))
--     /* gcc seems to figure out optimal code for this on its own */
--#    define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
--#    define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
--#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
--#  else /* generic gcc */
--#    define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
--#    define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
--#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
--#  endif
--#else /* generic */
--#  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
--#  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
--#  define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
--#endif /* generic */
--
--#define GUINT16_SWAP_LE_PDP(val)	((guint16) (val))
--#define GUINT16_SWAP_BE_PDP(val)	(GUINT16_SWAP_LE_BE (val))
--#define GUINT32_SWAP_LE_PDP(val)	((guint32) ( \
--    (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \
--    (((guint32) (val) & (guint32) 0xffff0000U) >> 16)))
--#define GUINT32_SWAP_BE_PDP(val)	((guint32) ( \
--    (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
--    (((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
--
--
--/* The G*_TO_?E() macros are defined in glibconfig.h.
-- * The transformation is symmetric, so the FROM just maps to the TO.
-- */
--#define GINT16_FROM_LE(val)	(GINT16_TO_LE (val))
--#define GUINT16_FROM_LE(val)	(GUINT16_TO_LE (val))
--#define GINT16_FROM_BE(val)	(GINT16_TO_BE (val))
--#define GUINT16_FROM_BE(val)	(GUINT16_TO_BE (val))
--#define GINT32_FROM_LE(val)	(GINT32_TO_LE (val))
--#define GUINT32_FROM_LE(val)	(GUINT32_TO_LE (val))
--#define GINT32_FROM_BE(val)	(GINT32_TO_BE (val))
--#define GUINT32_FROM_BE(val)	(GUINT32_TO_BE (val))
--
--#define GINT64_FROM_LE(val)	(GINT64_TO_LE (val))
--#define GUINT64_FROM_LE(val)	(GUINT64_TO_LE (val))
--#define GINT64_FROM_BE(val)	(GINT64_TO_BE (val))
--#define GUINT64_FROM_BE(val)	(GUINT64_TO_BE (val))
--
--#define GLONG_FROM_LE(val)	(GLONG_TO_LE (val))
--#define GULONG_FROM_LE(val)	(GULONG_TO_LE (val))
--#define GLONG_FROM_BE(val)	(GLONG_TO_BE (val))
--#define GULONG_FROM_BE(val)	(GULONG_TO_BE (val))
--
--#define GINT_FROM_LE(val)	(GINT_TO_LE (val))
--#define GUINT_FROM_LE(val)	(GUINT_TO_LE (val))
--#define GINT_FROM_BE(val)	(GINT_TO_BE (val))
--#define GUINT_FROM_BE(val)	(GUINT_TO_BE (val))
--
--#define GSIZE_FROM_LE(val)	(GSIZE_TO_LE (val))
--#define GSSIZE_FROM_LE(val)	(GSSIZE_TO_LE (val))
--#define GSIZE_FROM_BE(val)	(GSIZE_TO_BE (val))
--#define GSSIZE_FROM_BE(val)	(GSSIZE_TO_BE (val))
--
--
--/* Portable versions of host-network order stuff
-- */
--#define g_ntohl(val) (GUINT32_FROM_BE (val))
--#define g_ntohs(val) (GUINT16_FROM_BE (val))
--#define g_htonl(val) (GUINT32_TO_BE (val))
--#define g_htons(val) (GUINT16_TO_BE (val))
--
--#include <../../config.h>
--
--#if WORDS_BIGENDIAN
--#define GUINT64_TO_BE(val) (val)
--#define GUINT32_TO_BE(val) (val)
--#define GUINT16_TO_BE(val) (val)
--#define GUINT64_TO_LE(val) GUINT64_SWAP_LE_BE(val)
--#define GUINT32_TO_LE(val) GUINT32_SWAP_LE_BE(val)
--#define GUINT16_TO_LE(val) GUINT16_SWAP_LE_BE(val)
--#define GINT64_TO_BE(val) (val)
--#define GINT32_TO_BE(val) (val)
--#define GINT16_TO_BE(val) (val)
--#define GINT64_TO_LE(val) GUINT64_SWAP_LE_BE(val)
--#define GINT32_TO_LE(val) GUINT32_SWAP_LE_BE(val)
--#define GINT16_TO_LE(val) GUINT16_SWAP_LE_BE(val)
--#else
--#define GUINT64_TO_BE(val) GUINT64_SWAP_LE_BE(val)
--#define GUINT32_TO_BE(val) GUINT32_SWAP_LE_BE(val)
--#define GUINT16_TO_BE(val) GUINT16_SWAP_LE_BE(val)
--#define GUINT64_TO_LE(val) (val)
--#define GUINT32_TO_LE(val) (val)
--#define GUINT16_TO_LE(val) (val)
--#define GINT64_TO_BE(val) GUINT64_SWAP_LE_BE(val)
--#define GINT32_TO_BE(val) GUINT32_SWAP_LE_BE(val)
--#define GINT16_TO_BE(val) GUINT16_SWAP_LE_BE(val)
--#define GINT64_TO_LE(val) (val)
--#define GINT32_TO_LE(val) (val)
--#define GINT16_TO_LE(val) (val)
--#endif
--
--#define LE_16(val) (GINT16_FROM_LE (*((u_int16_t*)(val))))
--#define BE_16(val) (GINT16_FROM_BE (*((u_int16_t*)(val))))
--#define LE_32(val) (GINT32_FROM_LE (*((u_int32_t*)(val))))
--#define BE_32(val) (GINT32_FROM_BE (*((u_int32_t*)(val))))
--
--#define LE_64(val) (GINT64_FROM_LE (*((u_int64_t*)(val))))
--#define BE_64(val) (GINT64_FROM_BE (*((u_int64_t*)(val))))
--
--#endif /* BSWAP_H_INCLUDED */
-diff --git a/plugins/mms/libmms/mms-common.h b/plugins/mms/libmms/mms-common.h
-deleted file mode 100644
-index 444d35a..0000000
---- a/plugins/mms/libmms/mms-common.h
-+++ /dev/null
-@@ -1,35 +0,0 @@
--/*
-- * Copyright (C) 2010 Hans de Goede <j.w.r.degoede at hhs.nl>
-- *
-- * This file is part of libmms a free mms protocol library
-- *
-- * libmms is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU Library General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * libmss is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- */
--
--/* This file contains code which is shared between the mms and mmsh protocol
--   handling code. */
--
--#ifndef __MMS_COMMON_H
--#define __MMS_COMMON_H
--
--typedef struct mms_stream_s mms_stream_t;
--struct mms_stream_s {
--  int           stream_id;
--  int           stream_type;
--  uint32_t      bitrate;
--  uint32_t      bitrate_pos;
--};
--
--#endif
-diff --git a/plugins/mms/libmms/mms.c b/plugins/mms/libmms/mms.c
-deleted file mode 100644
-index 7e0d4a0..0000000
---- a/plugins/mms/libmms/mms.c
-+++ /dev/null
-@@ -1,1802 +0,0 @@
--/*
-- * Copyright (C) 2002-2004 the xine project
-- * 
-- * This file is part of LibMMS, an MMS protocol handling library.
-- * 
-- * xine is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the ree Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- * 
-- * xine is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- * 
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * $Id: mms.c,v 1.31 2007/12/11 20:35:01 jwrdegoede Exp $
-- *
-- * MMS over TCP protocol
-- *   based on work from major mms
-- *   utility functions to handle communication with an mms server
-- */
--
--#ifdef HAVE_CONFIG_H
--#include "config.h"
--#endif
--
--#include <unistd.h>
--#include <stdio.h>
--#include <sys/socket.h>
--#include <netinet/in.h>
--#include <netdb.h>
--#include <string.h>
--#include <sys/types.h>
--#include <sys/stat.h>
--#include <fcntl.h>
--#include <errno.h>
--#include <stdlib.h>
--#include <time.h>
--#include <iconv.h>
--
--/********** logging **********/
--#define lprintf(...) if (getenv("LIBMMS_DEBUG")) fprintf(stderr, __VA_ARGS__)
--
--#define __MMS_C__
--
--#include "bswap.h"
--#include "mms.h"
--#include "asfheader.h"
--#include "uri.h"
--#include "mms-common.h"
--
--/* 
-- * mms specific types 
-- */
--
--#define MMST_PORT 1755
--
--#define BUF_SIZE 102400
--
--#define CMD_HEADER_LEN   40
--#define CMD_PREFIX_LEN    8
--#define CMD_BODY_LEN   1024 * 16 /* FIXME: make this dynamic */
--
--#define ASF_HEADER_LEN (8192 * 2)
--
--
--#define MMS_PACKET_ERR        0
--#define MMS_PACKET_COMMAND    1
--#define MMS_PACKET_ASF_HEADER 2
--#define MMS_PACKET_ASF_PACKET 3
--
--#define ASF_HEADER_PACKET_ID_TYPE 2
--#define ASF_MEDIA_PACKET_ID_TYPE  4
--
--
--typedef struct mms_buffer_s mms_buffer_t;
--struct mms_buffer_s {
--  uint8_t *buffer;
--  int pos;
--};
--
--typedef struct mms_packet_header_s mms_packet_header_t;
--struct mms_packet_header_s {
--  uint32_t  packet_len;
--  uint8_t   flags;
--  uint8_t   packet_id_type;
--  uint32_t  packet_seq;
--};
--
--struct mms_s {
--
--  int           s;
--  
--  /* url parsing */
--  GURI         *guri;
--  char         *url;
--  char         *proto;
--  char         *host;
--  int           port;
--  char         *user;
--  char         *password;
--  char         *uri;
--
--  /* command to send */
--  char          scmd[CMD_HEADER_LEN + CMD_BODY_LEN];
--  char         *scmd_body; /* pointer to &scmd[CMD_HEADER_LEN] */
--  int           scmd_len; /* num bytes written in header */
--  
--  char          str[1024]; /* scratch buffer to built strings */
--  
--  /* receive buffer */
--  uint8_t       buf[BUF_SIZE];
--  int           buf_size;
--  int           buf_read;
--  off_t         buf_packet_seq_offset; /* packet sequence offset residing in
--                                          buf */
--  
--  uint8_t       asf_header[ASF_HEADER_LEN];
--  uint32_t      asf_header_len;
--  uint32_t      asf_header_read;
--  int           seq_num;
--  int           num_stream_ids;
--  mms_stream_t  streams[ASF_MAX_NUM_STREAMS];
--  uint8_t       packet_id_type;
--  off_t         start_packet_seq; /* for live streams != 0, need to keep it around */
--  int           need_discont; /* whether we need to set start_packet_seq */
--  uint32_t      asf_packet_len;
--  uint64_t      file_len;
--  uint64_t      time_len; /* playback time in 100 nanosecs (10^-7) */
--  uint64_t      preroll;
--  uint64_t      asf_num_packets;
--  char          guid[37];
--  int           bandwidth;
--  
--  int           has_audio;
--  int           has_video;
--  int           live_flag;
--  int           seekable;
--  off_t         current_pos;
--  int           eos;
--};
--
--static int fallback_io_select(void *data, int socket, int state, int timeout_msec)
--{
--  fd_set set;
--  struct timeval tv = { timeout_msec / 1000, (timeout_msec % 1000) * 1000};
--  FD_ZERO(&set);
--  FD_SET(socket, &set);
--  return select(1, (state == MMS_IO_READ_READY) ? &set : NULL,
--                   (state == MMS_IO_WRITE_READY) ? &set : NULL, NULL, &tv);
--}
--
--static off_t fallback_io_read(void *data, int socket, char *buf, off_t num)
--{
--  off_t len = 0, ret;
--/*   lprintf("%d\n", fallback_io_select(data, socket, MMS_IO_READ_READY, 1000)); */
--  errno = 0;
--  while (len < num)
--  {
--    ret = (off_t)read(socket, buf + len, num - len);
--    if(ret == 0)
--      break; /* EOF */
--    if(ret < 0) {
--      lprintf("mms: read error @ len = %lld: %s\n", (long long int) len,
--              strerror(errno));
--      switch(errno)
--      {
--          case EAGAIN:
--            continue;
--          default:
--            /* if already read something, return it, we will fail next time */
--            return len ? len : ret; 
--      }
--    }
--    len += ret;
--  }
--  return len;
--}
--
--static off_t fallback_io_write(void *data, int socket, char *buf, off_t num)
--{
--  return (off_t)write(socket, buf, num);
--}
--
--static int fallback_io_tcp_connect(void *data, const char *host, int port)
--{
--  
--  struct hostent *h;
--  int i, s;
--  
--  h = gethostbyname(host);
--  if (h == NULL) {
--    lprintf("mms: unable to resolve host: %s\n", host);
--    return -1;
--  }
--
--  s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);  
--  if (s == -1) {
--    lprintf("mms: failed to create socket: %s\n", strerror(errno));
--    return -1;
--  }
--
--  if (fcntl (s, F_SETFL, fcntl (s, F_GETFL) & ~O_NONBLOCK) == -1) {
--    lprintf("mms: failed to set socket flags: %s\n", strerror(errno));
--    return -1;
--  }
--
--  for (i = 0; h->h_addr_list[i]; i++) {
--    struct in_addr ia;
--    struct sockaddr_in sin;
-- 
--    memcpy (&ia, h->h_addr_list[i], 4);
--    sin.sin_family = AF_INET;
--    sin.sin_addr   = ia;
--    sin.sin_port   = htons(port);
--    
--    if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) ==-1 && errno != EINPROGRESS) {
--      continue;
--    }
--    
--    return s;
--  }
--  close(s);
--  return -1;
--}
--
--
--static mms_io_t fallback_io =
--  {
--    &fallback_io_select,
--    NULL,
--    &fallback_io_read,
--    NULL,
--    &fallback_io_write,
--    NULL,
--    &fallback_io_tcp_connect,
--    NULL,
--  };
--
--static mms_io_t default_io =   {
--    &fallback_io_select,
--    NULL,
--    &fallback_io_read,
--    NULL,
--    &fallback_io_write,
--    NULL,
--    &fallback_io_tcp_connect,
--    NULL,
--  };
--
--
--#define io_read(io, args...) ((io) ? (io)->read(io->read_data , ## args) : default_io.read(NULL , ## args))
--#define io_write(io, args...) ((io) ? (io)->write(io->write_data , ## args) : default_io.write(NULL , ## args))
--#define io_select(io, args...) ((io) ? (io)->select(io->select_data , ## args) : default_io.select(NULL , ## args))
--#define io_connect(io, args...) ((io) ? (io)->connect(io->connect_data , ## args) : default_io.connect(NULL , ## args))
--  
--const mms_io_t* mms_get_default_io_impl()
--{
--  return &default_io;
--}
--
--void mms_set_default_io_impl(const mms_io_t *io)
--{
--  if(io->select)
--  {
--    default_io.select = io->select;
--    default_io.select_data = io->select_data;
--  } else
--  {
--    default_io.select = fallback_io.select;
--    default_io.select_data = fallback_io.select_data;
--  }
--  if(io->read)
--  {
--    default_io.read = io->read;
--    default_io.read_data = io->read_data;
--  } else
--  {
--    default_io.read = fallback_io.read;
--    default_io.read_data = fallback_io.read_data;
--  }
--  if(io->write)
--  {
--    default_io.write = io->write;
--    default_io.write_data = io->write_data;
--  } else
--  {
--    default_io.write = fallback_io.write;
--    default_io.write_data = fallback_io.write_data;
--  }
--  if(io->connect)
--  {
--    default_io.connect = io->connect;
--    default_io.connect_data = io->connect_data;
--  } else
--  {
--    default_io.connect = fallback_io.connect;
--    default_io.connect_data = fallback_io.connect_data;
--  }
--}
--
--static void mms_buffer_init (mms_buffer_t *mms_buffer, uint8_t *buffer) {
--  mms_buffer->buffer = buffer;
--  mms_buffer->pos = 0;
--}
--
--static void mms_buffer_put_8 (mms_buffer_t *mms_buffer, uint8_t value) {
--
--  mms_buffer->buffer[mms_buffer->pos]     = value          & 0xff;
--
--  mms_buffer->pos += 1;
--}
--
--#if 0
--static void mms_buffer_put_16 (mms_buffer_t *mms_buffer, uint16_t value) {
--
--  mms_buffer->buffer[mms_buffer->pos]     = value          & 0xff;
--  mms_buffer->buffer[mms_buffer->pos + 1] = (value  >> 8)  & 0xff;
--
--  mms_buffer->pos += 2;
--}
--#endif
--
--static void mms_buffer_put_32 (mms_buffer_t *mms_buffer, uint32_t value) {
--
--  mms_buffer->buffer[mms_buffer->pos]     = value          & 0xff;
--  mms_buffer->buffer[mms_buffer->pos + 1] = (value  >> 8)  & 0xff;
--  mms_buffer->buffer[mms_buffer->pos + 2] = (value  >> 16) & 0xff;
--  mms_buffer->buffer[mms_buffer->pos + 3] = (value  >> 24) & 0xff;
--
--  mms_buffer->pos += 4;
--}
--
--static int get_guid (unsigned char *buffer, int offset) {
--  int i;
--  GUID g;
--  
--  g.Data1 = LE_32(buffer + offset);
--  g.Data2 = LE_16(buffer + offset + 4);
--  g.Data3 = LE_16(buffer + offset + 6);
--  for(i = 0; i < 8; i++) {
--    g.Data4[i] = buffer[offset + 8 + i];
--  }
--  
--  for (i = 1; i < GUID_END; i++) {
--    if (!memcmp(&g, &guids[i].guid, sizeof(GUID))) {
--      lprintf("mms: GUID: %s\n", guids[i].name);
--      return i;
--    }
--  }
--  
--  lprintf("mms: unknown GUID: 0x%x, 0x%x, 0x%x, "
--           "{ 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx }\n",
--           g.Data1, g.Data2, g.Data3,
--           g.Data4[0], g.Data4[1], g.Data4[2], g.Data4[3], 
--           g.Data4[4], g.Data4[5], g.Data4[6], g.Data4[7]);
--
--  return GUID_ERROR;
--}
--
--
--static void print_command (char *data, int len) {
--
--#ifdef DEBUG
--  int i;
--  int dir = LE_32 (data + 36) >> 16;
--  int comm = LE_32 (data + 36) & 0xFFFF;
--
--  lprintf ("----------------------------------------------\n");
--  if (dir == 3) {
--    lprintf ("send command 0x%02x, %d bytes\n", comm, len);
--  } else {
--    lprintf ("receive command 0x%02x, %d bytes\n", comm, len);
--  }
--  lprintf ("  start sequence %08x\n", LE_32 (data +  0));
--  lprintf ("  command id     %08x\n", LE_32 (data +  4));
--  lprintf ("  length         %8x \n", LE_32 (data +  8));
--  lprintf ("  protocol       %08x\n", LE_32 (data + 12));
--  lprintf ("  len8           %8x \n", LE_32 (data + 16));
--  lprintf ("  sequence #     %08x\n", LE_32 (data + 20));
--  lprintf ("  len8  (II)     %8x \n", LE_32 (data + 32));
--  lprintf ("  dir | comm     %08x\n", LE_32 (data + 36));
--  if (len >= 4)
--    lprintf ("  prefix1        %08x\n", LE_32 (data + 40));
--  if (len >= 8)
--    lprintf ("  prefix2        %08x\n", LE_32 (data + 44));
--
--  for (i = (CMD_HEADER_LEN + CMD_PREFIX_LEN); i < (CMD_HEADER_LEN + CMD_PREFIX_LEN + len); i += 1) {
--    unsigned char c = data[i];
--    
--    if ((c >= 32) && (c < 128))
--      lprintf ("%c", c);
--    else
--      lprintf (" %02x ", c);
--    
--  }
--  if (len > CMD_HEADER_LEN)
--    lprintf ("\n");
--  lprintf ("----------------------------------------------\n");
--#endif
--}  
--
--
--
--static int send_command (mms_io_t *io, mms_t *this, int command,
--                         uint32_t prefix1, uint32_t prefix2,
--                         int length) {
--  int    len8;
--  off_t  n;
--  mms_buffer_t command_buffer;
--
--  len8 = (length + 7) / 8;
--
--  this->scmd_len = 0;
--
--  mms_buffer_init(&command_buffer, this->scmd);
--  mms_buffer_put_32 (&command_buffer, 0x00000001);   /* start sequence */
--  mms_buffer_put_32 (&command_buffer, 0xB00BFACE);   /* #-)) */
--  mms_buffer_put_32 (&command_buffer, len8 * 8 + 32);
--  mms_buffer_put_32 (&command_buffer, 0x20534d4d);   /* protocol type "MMS " */
--  mms_buffer_put_32 (&command_buffer, len8 + 4);
--  mms_buffer_put_32 (&command_buffer, this->seq_num);
--  this->seq_num++;
--  mms_buffer_put_32 (&command_buffer, 0x0);          /* timestamp */
--  mms_buffer_put_32 (&command_buffer, 0x0);
--  mms_buffer_put_32 (&command_buffer, len8 + 2);
--  mms_buffer_put_32 (&command_buffer, 0x00030000 | command); /* dir | command */
--  /* end of the 40 byte command header */
--  
--  mms_buffer_put_32 (&command_buffer, prefix1);
--  mms_buffer_put_32 (&command_buffer, prefix2);
--
--  if (length & 7)
--          memset(this->scmd + length + CMD_HEADER_LEN + CMD_PREFIX_LEN, 0, 8 - (length & 7));
--
--  n = io_write(io,  this->s, this->scmd, len8 * 8 + CMD_HEADER_LEN + CMD_PREFIX_LEN);
--  if (n != (len8 * 8 + CMD_HEADER_LEN + CMD_PREFIX_LEN)) {
--    return 0;
--  }
--
--  print_command (this->scmd, length);
--
--  return 1;
--}
--
--static int string_utf16(iconv_t url_conv, char *dest, char *src, int dest_len)
--{
--  char *ip = src, *op = dest;
--  size_t ip_len = strlen(src);
--  size_t op_len = dest_len - 2; /* reserve 2 bytes for 0 termination */
--
--  if (iconv(url_conv, &ip, &ip_len, &op, &op_len) == (size_t)-1) {
--    lprintf("mms: Error converting uri to unicode: %s\n", strerror(errno));
--    return 0;
--  }
--  
--  /* 0 terminate the string */
--  *op++ = 0;
--  *op++ = 0;
--
--  return op - dest;
--}
--
--/*
-- * return packet type
-- */
--static int get_packet_header (mms_io_t *io, mms_t *this, mms_packet_header_t *header) {
--  size_t len;
--  int packet_type;
--
--  header->packet_len     = 0;
--  header->packet_seq     = 0;
--  header->flags          = 0;
--  header->packet_id_type = 0;
--  len = io_read(io,  this->s, this->buf, 8);
--  this->buf_packet_seq_offset = -1;
--  if (len != 8)
--    goto error;
--
--  if (LE_32(this->buf + 4) == 0xb00bface) {
--    /* command packet */
--    header->flags = this->buf[3];
--    len = io_read(io,  this->s, this->buf + 8, 4);
--    if (len != 4)
--      goto error;
--    
--    header->packet_len = LE_32(this->buf + 8) + 4;
--    if (header->packet_len > BUF_SIZE - 12) {
--        lprintf("mms: get_packet_header error cmd packet length > bufsize\n");
--        header->packet_len = 0;
--        return MMS_PACKET_ERR;
--    }
--    packet_type = MMS_PACKET_COMMAND;
--  } else {
--    header->packet_seq     = LE_32(this->buf);
--    header->packet_id_type = this->buf[4];
--    header->flags          = this->buf[5];
--    header->packet_len     = (LE_16(this->buf + 6) - 8) & 0xffff;
--    if (header->packet_id_type == ASF_HEADER_PACKET_ID_TYPE) {
--      packet_type = MMS_PACKET_ASF_HEADER;
--    } else {
--      packet_type = MMS_PACKET_ASF_PACKET;
--    }
--  }
--  
--  return packet_type;
--  
--error:
--  lprintf("mms: error reading packet header\n");
--  return MMS_PACKET_ERR;
--}
--
--
--static int get_packet_command (mms_io_t *io, mms_t *this, uint32_t packet_len) {
--
--
--  int  command = 0;
--  size_t len;
--  
--  len = io_read(io,  this->s, this->buf + 12, packet_len) ;
--  //this->buf_packet_seq_offset = -1; // already set in get_packet_header
--  if (len != packet_len) {
--    lprintf("mms: error reading command packet\n");
--    return 0;
--  }
--
--  print_command (this->buf, len);
--  
--  /* check protocol type ("MMS ") */
--  if (LE_32(this->buf + 12) != 0x20534D4D) {
--    lprintf("mms: unknown protocol type: %c%c%c%c (0x%08X)\n",
--            this->buf[12], this->buf[13], this->buf[14], this->buf[15],
--            LE_32(this->buf + 12));  
--    return 0;
--  }
--
--  command = LE_32 (this->buf + 36) & 0xFFFF;
--  lprintf("mms: received command = %02x, len: %d\n", command, packet_len);
--    
--  return command;
--}
--
--static int get_answer (mms_io_t *io, mms_t *this) {
--  int command = 0;
--  mms_packet_header_t header;
--
--  switch (get_packet_header (io, this, &header)) {
--    case MMS_PACKET_ERR:
--      break;
--    case MMS_PACKET_COMMAND:
--      command = get_packet_command (io, this, header.packet_len);
--      if (command == 0)
--        return 0;
--
--      if (command == 0x1b) {
--        if (!send_command (io, this, 0x1b, 0, 0, 0)) {
--          lprintf("mms: error sending ping reply\n");
--          return 0;
--        }
--        /* FIXME: limit recursion */
--        command = get_answer (io, this);
--      }
--      break;
--    case MMS_PACKET_ASF_HEADER:
--      lprintf("mms: unexpected asf header packet\n");
--      break;
--    case MMS_PACKET_ASF_PACKET:
--      lprintf("mms: unexpected asf packet\n");
--      break;
--  }
--  
--  return command;
--}
--
--
--static int get_asf_header (mms_io_t *io, mms_t *this) {
--
--  off_t len;
--  int stop = 0;
--  
--  this->asf_header_read = 0;
--  this->asf_header_len = 0;
--
--  while (!stop) {
--    mms_packet_header_t header;
--    int command;
--
--    switch (get_packet_header (io, this, &header)) {
--      case MMS_PACKET_ERR:
--        return 0;
--      case MMS_PACKET_COMMAND:
--        command = get_packet_command (io, this, header.packet_len);
--        if (command == 0)
--          return 0;
--
--        if (command == 0x1b) {
--          if (!send_command (io, this, 0x1b, 0, 0, 0)) {
--            lprintf("mms: error sending ping reply\n");
--            return 0;
--          }
--          command = get_answer (io, this);
--        } else {
--          lprintf("mms: unexpected command packet\n");
--        }
--        break;
--      case MMS_PACKET_ASF_HEADER:
--      case MMS_PACKET_ASF_PACKET:
--        if (header.packet_len + this->asf_header_len > ASF_HEADER_LEN) {
--            lprintf("mms: asf packet too large: %d\n", 
--                    header.packet_len + this->asf_header_len);
--            return 0;
--        }
--        len = io_read(io,  this->s,
--                              this->asf_header + this->asf_header_len, header.packet_len);
--        if (len != header.packet_len) {
--           lprintf("mms: error reading asf header\n");
--           return 0;
--        }
--        this->asf_header_len += header.packet_len;
--        lprintf("mms: header flags: %d\n", header.flags);
--        if ((header.flags == 0X08) || (header.flags == 0X0C))
--          stop = 1;
--        break;
--    }
--  }
--  return 1;
--}
--
--static void interp_stream_properties(mms_t *this, int i)
--{
--  uint16_t flags;
--  uint16_t stream_id;
--  int      type;
--  int      encrypted;
--  int      guid;
--
--  guid = get_guid(this->asf_header, i);
--  switch (guid) {
--    case GUID_ASF_AUDIO_MEDIA:
--      type = ASF_STREAM_TYPE_AUDIO;
--      this->has_audio = 1;
--      break;
--
--    case GUID_ASF_VIDEO_MEDIA:
--    case GUID_ASF_JFIF_MEDIA:
--    case GUID_ASF_DEGRADABLE_JPEG_MEDIA:
--      type = ASF_STREAM_TYPE_VIDEO;
--      this->has_video = 1;
--      break;
--  
--    case GUID_ASF_COMMAND_MEDIA:
--      type = ASF_STREAM_TYPE_CONTROL;
--      break;
--
--    default:
--      type = ASF_STREAM_TYPE_UNKNOWN;
--  }
--
--  flags = LE_16(this->asf_header + i + 48);
--  stream_id = flags & 0x7F;
--  encrypted = flags >> 15;
--
--  lprintf("mms: stream object, stream id: %d, type: %d, encrypted: %d\n",
--          stream_id, type, encrypted);
--
--  if (this->num_stream_ids < ASF_MAX_NUM_STREAMS) {
--    this->streams[this->num_stream_ids].stream_type = type;
--    this->streams[this->num_stream_ids].stream_id = stream_id;
--    this->num_stream_ids++;
--  } else {
--    lprintf("mms: too many streams, skipping\n");
--  }
--}
--
--static void interp_asf_header (mms_t *this) {
--
--  int i;
--
--  this->asf_packet_len = 0;
--  this->num_stream_ids = 0;
--  this->asf_num_packets = 0;
--  /*
--   * parse header
--   */
--   
--  i = 30;
--  while ((i + 24) <= this->asf_header_len) {
--    
--    int guid;
--    uint64_t length;
--
--    guid = get_guid(this->asf_header, i);
--    length = LE_64(this->asf_header + i + 16);
--
--    if ((i + length) > this->asf_header_len) return;
--
--    switch (guid) {
--    
--      case GUID_ASF_FILE_PROPERTIES:
--
--        this->asf_packet_len = LE_32(this->asf_header + i + 92);
--        if (this->asf_packet_len > BUF_SIZE) {
--          lprintf("mms: asf packet len too large: %d\n", this->asf_packet_len);
--          this->asf_packet_len = 0;
--          break;
--        }
--        this->file_len       = LE_64(this->asf_header + i + 40);
--        this->time_len       = LE_64(this->asf_header + i + 64);
--        //this->time_len       = LE_64(this->asf_header + i + 72);
--        this->preroll        = LE_64(this->asf_header + i + 80);
--        lprintf("mms: file object, packet length = %d (%d)\n",
--                this->asf_packet_len, LE_32(this->asf_header + i + 96));
--        break;
--
--      case GUID_ASF_STREAM_PROPERTIES:
--        interp_stream_properties(this, i + 24);
--        break;
--
--      case GUID_ASF_STREAM_BITRATE_PROPERTIES:
--        {
--          uint16_t streams = LE_16(this->asf_header + i + 24);
--          uint16_t stream_id;
--          int j;
--
--          for(j = 0; j < streams; j++) {
--            int stream_index;
--            stream_id = LE_16(this->asf_header + i + 24 + 2 + j * 6);
--            for(stream_index = 0; stream_index < this->num_stream_ids; stream_index++) {
--              if (this->streams[stream_index].stream_id == stream_id)
--                break;
--            }
--            if (stream_index < this->num_stream_ids) {
--              this->streams[stream_index].bitrate = LE_32(this->asf_header + i + 24 + 4 + j * 6);
--              this->streams[stream_index].bitrate_pos = i + 24 + 4 + j * 6;
--              lprintf("mms: stream id %d, bitrate %d\n", stream_id, 
--                      this->streams[stream_index].bitrate);
--            } else
--              lprintf ("mms: unknown stream id %d in bitrate properties\n",
--                        stream_id);
--          }
--        }
--        break;
--    
--      case GUID_ASF_HEADER_EXTENSION:
--        {
--          if ((24 + 18 + 4) > length)
--            break;
--
--          int size = LE_32(this->asf_header + i + 24 + 18);
--          int j = 24 + 18 + 4;
--          int l;
--          lprintf("mms: Extension header data size: %d\n", size);
--
--          while ((j + 24) <= length) {
--            guid = get_guid(this->asf_header, i + j);
--            l = LE_64(this->asf_header + i + j + 16);
--
--            if ((j + l) > length)
--              break;
--
--            if (guid == GUID_ASF_EXTENDED_STREAM_PROPERTIES &&
--                (24 + 64) <= l) {
--                  int stream_no = LE_16(this->asf_header + i + j + 24 + 48);
--                  int name_count = LE_16(this->asf_header + i + j + 24 + 60);
--                  int ext_count = LE_16(this->asf_header + i + j + 24 + 62);
--                  int ext_j = 24 + 64;
--                  int x;
--
--                  lprintf("mms: l: %d\n", l);
--                  lprintf("mms: Stream No: %d\n", stream_no);
--                  lprintf("mms: ext_count: %d\n", ext_count);
--
--                  // Loop through the number of stream names
--                  for (x = 0; x < name_count && (ext_j + 4) <= l; x++) {
--                    int lang_id_index;
--                    int stream_name_len;
--
--                    lang_id_index = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += 2;
--
--                    stream_name_len = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += stream_name_len + 2;
--
--                    lprintf("mms: Language id index: %d\n", lang_id_index);
--                    lprintf("mms: Stream name Len: %d\n", stream_name_len);
--                  }
--
--                  // Loop through the number of extension system info
--                  for (x = 0; x < ext_count && (ext_j + 22) <= l; x++) {
--                    ext_j += 18;
--                    int len = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += 4 + len;
--                  }
--
--                  lprintf("mms: ext_j: %d\n", ext_j);
--                  // Finally, we arrive at the interesting point: The optional Stream Property Object
--                  if ((ext_j + 24) <= l) {
--                    guid = get_guid(this->asf_header, i + j + ext_j);
--                    int len = LE_64(this->asf_header + i + j + ext_j + 16);
--                    if (guid == GUID_ASF_STREAM_PROPERTIES &&
--                        (ext_j + len) <= l) {
--                      interp_stream_properties(this, i + j + ext_j + 24);
--                    }
--                  } else {
--                    lprintf("mms: Sorry, field not long enough\n");
--                  }
--            }
--            j += l;
--          }
--        }
--        break;
--
--      case GUID_ASF_DATA:
--        this->asf_num_packets = LE_64(this->asf_header + i + 40 - 24);
--        break;
--    }
--
--    lprintf("mms: length: %llu\n", (unsigned long long)length);
--    i += length;
--  }
--}
--
--const static char *const mmst_proto_s[] = { "mms", "mmst", NULL };
--
--static int mmst_valid_proto (char *proto) {
--  int i = 0;
--
--  if (!proto)
--    return 0;
--
--  while(mmst_proto_s[i]) {
--    if (!strcasecmp(proto, mmst_proto_s[i])) {
--      return 1;
--    }
--    i++;
--  }
--  return 0;
--}
--
--/*
-- * returns 1 on error
-- */
--static int mms_tcp_connect(mms_io_t *io, mms_t *this) {
--  if (!this->port) this->port = MMST_PORT;
--
--  /* 
--   * try to connect 
--   */
--  lprintf("mms: trying to connect to %s on port %d\n", this->host, this->port);
--  this->s = io_connect(io,  this->host, this->port);
--  if (this->s == -1) {
--    lprintf("mms: failed to connect to %s\n", this->host);
--    return 1;
--  }
--
--  lprintf("mms: connected\n");
--  return 0;
--}
--
--static void mms_gen_guid(char guid[]) {
--  static char digit[16] = "0123456789ABCDEF";
--  int i = 0;
--
--  srand(time(NULL));
--  for (i = 0; i < 36; i++) {
--    guid[i] = digit[(int) ((16.0*rand())/(RAND_MAX+1.0))];
--  }
--  guid[8] = '-'; guid[13] = '-'; guid[18] = '-'; guid[23] = '-';
--  guid[36] = '\0';
--}
--
--const char *status_to_string(int status)
--{
--  switch (status) {
--  case 0x80070003:
--    return "Path not found";
--  case 0x80070005:
--    return "Access Denied";
--  default:
--    return "Unknown";
--  }
--}
--
--/*
-- * return 0 on error
-- */
--int static mms_choose_best_streams(mms_io_t *io, mms_t *this) {
--  int     i;
--  int     video_stream = -1;
--  int     audio_stream = -1;
--  int     max_arate    = 0;
--  int     min_vrate    = 0;
--  int     min_bw_left  = 0;
--  int     bandwitdh_left;
--  int     res;
--
--  /* command 0x33 */
--  /* choose the best quality for the audio stream */
--  /* i've never seen more than one audio stream */
--  for (i = 0; i < this->num_stream_ids; i++) {
--    switch (this->streams[i].stream_type) {
--      case ASF_STREAM_TYPE_AUDIO:
--        if (this->streams[i].bitrate > max_arate) {
--          audio_stream = this->streams[i].stream_id;
--          max_arate = this->streams[i].bitrate;
--        }
--        break;
--      default:
--        break;
--    }
--  }
--  
--  /* choose a video stream adapted to the user bandwidth */
--  bandwitdh_left = this->bandwidth - max_arate;
--  if (bandwitdh_left < 0) {
--    bandwitdh_left = 0;
--  }
--  lprintf("mms: bandwidth %d, left %d\n", this->bandwidth, bandwitdh_left);
--
--  min_bw_left = bandwitdh_left;
--  for (i = 0; i < this->num_stream_ids; i++) {
--    switch (this->streams[i].stream_type) {
--      case ASF_STREAM_TYPE_VIDEO:
--        if (((bandwitdh_left - this->streams[i].bitrate) < min_bw_left) &&
--            (bandwitdh_left >= this->streams[i].bitrate)) {
--          video_stream = this->streams[i].stream_id;
--          min_bw_left = bandwitdh_left - this->streams[i].bitrate;
--        }
--        break;
--      default:
--        break;
--    }
--  }  
--
--  /* choose the lower bitrate of */
--  if (video_stream == -1 && this->has_video) {
--    for (i = 0; i < this->num_stream_ids; i++) {
--      switch (this->streams[i].stream_type) {
--        case ASF_STREAM_TYPE_VIDEO:
--          if ((this->streams[i].bitrate < min_vrate) ||
--              (!min_vrate)) {
--            video_stream = this->streams[i].stream_id;
--            min_vrate = this->streams[i].bitrate;
--          }
--          break;
--        default:
--          break;
--      }
--    }
--  }
--    
--  lprintf("mms: selected streams: audio %d, video %d\n", audio_stream, video_stream);
--  memset (this->scmd_body, 0, 40);
--  for (i = 1; i < this->num_stream_ids; i++) {
--    this->scmd_body [ (i - 1) * 6 + 2 ] = 0xFF;
--    this->scmd_body [ (i - 1) * 6 + 3 ] = 0xFF;
--    this->scmd_body [ (i - 1) * 6 + 4 ] = this->streams[i].stream_id ;
--    this->scmd_body [ (i - 1) * 6 + 5 ] = this->streams[i].stream_id >> 8;
--    if ((this->streams[i].stream_id == audio_stream) ||
--        (this->streams[i].stream_id == video_stream)) {
--      this->scmd_body [ (i - 1) * 6 + 6 ] = 0x00;
--      this->scmd_body [ (i - 1) * 6 + 7 ] = 0x00;
--    } else {
--      lprintf("mms: disabling stream %d\n", this->streams[i].stream_id);
--      this->scmd_body [ (i - 1) * 6 + 6 ] = 0x02;
--      this->scmd_body [ (i - 1) * 6 + 7 ] = 0x00;
--      
--      /* forces the asf demuxer to not choose this stream */
--      if (this->streams[i].bitrate_pos) {
--        if (this->streams[i].bitrate_pos+3 < ASF_HEADER_LEN) {
--          this->asf_header[this->streams[i].bitrate_pos    ] = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 1] = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 2] = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 3] = 0;
--        } else {
--          lprintf("mms: attempt to write beyond asf header limit\n");
--        }
--      }
--    }
--  }
--
--  lprintf("mms: send command 0x33\n");
--  if (!send_command (io, this, 0x33, this->num_stream_ids, 
--                     0xFFFF | this->streams[0].stream_id << 16, 
--                     this->num_stream_ids * 6 + 2)) {
--    lprintf("mms: mms_choose_best_streams failed\n");
--    return 0;
--  }
--
--  if ((res = get_answer (io, this)) != 0x21) {
--    lprintf("mms: unexpected response: %02x (0x21)\n", res);
--    return 0;
--  }
--
--  res = LE_32(this->buf + 40);
--  if (res != 0) {
--    lprintf("mms: error answer 0x21 status: %08x (%s)\n",
--            res, status_to_string(res));
--    return 0;
--  }
--
--  return 1;
--}
--
--/*
-- * TODO: error messages
-- *       network timing request
-- */
--/* FIXME: got somewhat broken during xine_stream_t->(void*) conversion */
--mms_t *mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth) {
--  iconv_t url_conv = (iconv_t)-1;
--  mms_t  *this;
--  int     res;
--  uint32_t openid;
--  mms_buffer_t command_buffer;
--  
--  if (!url)
--    return NULL;
--
--  /* FIXME: needs proper error-signalling work */
--  this = (mms_t*) malloc (sizeof (mms_t));
--
--  this->url             = strdup (url);
--  this->s               = -1;
--  this->seq_num         = 0;
--  this->scmd_body       = this->scmd + CMD_HEADER_LEN + CMD_PREFIX_LEN;
--  this->asf_header_len  = 0;
--  this->asf_header_read = 0;
--  this->num_stream_ids  = 0;
--  this->asf_packet_len  = 0;
--  this->start_packet_seq= 0;
--  this->need_discont    = 1;
--  this->buf_size        = 0;
--  this->buf_read        = 0;
--  this->buf_packet_seq_offset = -1;
--  this->has_audio       = 0;
--  this->has_video       = 0;
--  this->bandwidth       = bandwidth;
--  this->current_pos     = 0;
--  this->eos             = 0;
--
--  this->guri = gnet_uri_new(this->url);
--  if(!this->guri) {
--    lprintf("mms: invalid url\n");
--    goto fail;
--  }
--  
--  /* MMS wants unescaped (so not percent coded) strings */
--  gnet_uri_unescape(this->guri);
--
--  this->proto = this->guri->scheme;
--  this->user = this->guri->user;
--  this->host = this->guri->hostname;
--  this->port = this->guri->port;
--  this->password = this->guri->passwd;
--  this->uri = gnet_mms_helper(this->guri, 0);
--
--  if(!this->uri)
--        goto fail;
--
--  if (!mmst_valid_proto(this->proto)) {
--    lprintf("mms: unsupported protocol: %s\n", this->proto);
--    goto fail;
--  }
--  
--  if (mms_tcp_connect(io, this)) {
--    goto fail;
--  }
--  
--  url_conv = iconv_open("UTF-16LE", "UTF-8");
--  if (url_conv == (iconv_t)-1) {
--    lprintf("mms: could not get iconv handle to convert url to unicode\n");
--    goto fail;
--  }
--
--  /*
--   * let the negotiations begin...
--   */
--
--  /* command 0x1 */
--  lprintf("mms: send command 0x01\n");
--  mms_buffer_init(&command_buffer, this->scmd_body);
--  mms_buffer_put_32 (&command_buffer, 0x0003001C);
--  mms_gen_guid(this->guid);
--  sprintf(this->str, "NSPlayer/7.0.0.1956; {%s}; Host: %s", this->guid,
--          this->host);
--  res = string_utf16(url_conv, this->scmd_body + command_buffer.pos, this->str,
--                     CMD_BODY_LEN - command_buffer.pos);
--  if(!res)
--    goto fail;
--
--  if (!send_command(io, this, 1, 0, 0x0004000b, command_buffer.pos + res)) {
--    lprintf("mms: failed to send command 0x01\n");
--    goto fail;
--  }
--  
--  if ((res = get_answer (io, this)) != 0x01) {
--    lprintf("mms: unexpected response: %02x (0x01)\n", res);
--    goto fail;
--  }
--
--  res = LE_32(this->buf + 40);
--  if (res != 0) {
--    lprintf("mms: error answer 0x01 status: %08x (%s)\n",
--            res, status_to_string(res));
--    goto fail;
--  }
--
--  /* TODO: insert network timing request here */
--  /* command 0x2 */
--  lprintf("mms: send command 0x02\n");
--  mms_buffer_init(&command_buffer, this->scmd_body);
--  mms_buffer_put_32 (&command_buffer, 0x00000000);
--  mms_buffer_put_32 (&command_buffer, 0x00989680);
--  mms_buffer_put_32 (&command_buffer, 0x00000002);
--  res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
--                     "\\\\192.168.0.129\\TCP\\1037",
--                     CMD_BODY_LEN - command_buffer.pos);
--  if(!res)
--    goto fail;
--
--  if (!send_command(io, this, 2, 0, 0xffffffff, command_buffer.pos + res)) {
--    lprintf("mms: failed to send command 0x02\n");
--    goto fail;
--  }
--
--  switch (res = get_answer (io, this)) {
--    case 0x02:
--      /* protocol accepted */
--      break;
--    case 0x03:
--      lprintf("mms: protocol failed\n");
--      goto fail;
--    default:
--      lprintf("mms: unexpected response: %02x (0x02 or 0x03)\n", res);
--      goto fail;
--  }
--
--  res = LE_32(this->buf + 40);
--  if (res != 0) {
--    lprintf("mms: error answer 0x02 status: %08x (%s)\n",
--            res, status_to_string(res));
--    goto fail;
--  }
--
--  /* command 0x5 */
--  {
--    mms_buffer_t command_buffer;
--    
--    lprintf("mms: send command 0x05\n");
--    mms_buffer_init(&command_buffer, this->scmd_body);
--    mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00000000); /* ?? */
--
--    res = string_utf16(url_conv, this->scmd_body + command_buffer.pos,
--                       this->uri, CMD_BODY_LEN - command_buffer.pos);
--    if(!res)
--      goto fail;
--
--    if (!send_command(io, this, 5, 1, 0, command_buffer.pos + res)) {
--      lprintf("mms: failed to send command 0x05\n");
--      goto fail;
--    }
--  }
--  
--  switch (res = get_answer (io, this)) {
--    case 0x06:
--      {
--        int xx, yy;
--        /* no authentication required */
--        openid = LE_32(this->buf + 48);
--      
--        /* Warning: sdp is not right here */
--        xx = this->buf[62];
--        yy = this->buf[63];
--        this->live_flag = ((xx == 0) && ((yy & 0xf) == 2));
--        this->seekable = !this->live_flag;
--        lprintf("mms: openid=%d, live: live_flag=%d, xx=%d, yy=%d\n", openid, this->live_flag, xx, yy);
--      }
--      break;
--    case 0x1A:
--      /* authentication request, not yet supported */
--      lprintf("mms: authentication request, not yet supported\n");
--      goto fail;
--      break;
--    default:
--      lprintf("mms: unexpected response: %02x (0x06 or 0x1A)\n", res);
--      goto fail;
--  }
--
--  res = LE_32(this->buf + 40);
--  if (res != 0) {
--    lprintf("mms: error answer 0x06 status: %08x (%s)\n",
--            res, status_to_string(res));
--    goto fail;
--  }
--
--  /* command 0x15 */
--  lprintf("mms: send command 0x15\n");
--  {
--    mms_buffer_t command_buffer;
--    mms_buffer_init(&command_buffer, this->scmd_body);
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00008000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0x40AC2000);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, ASF_HEADER_PACKET_ID_TYPE);   /* Header Packet ID type */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* ?? */
--    if (!send_command (io, this, 0x15, openid, 0, command_buffer.pos)) {
--      lprintf("mms: failed to send command 0x15\n");
--      goto fail;
--    }
--  }
--  
--  if ((res = get_answer (io, this)) != 0x11) {
--    lprintf("mms: unexpected response: %02x (0x11)\n", res);
--    goto fail;
--  }
--
--  res = LE_32(this->buf + 40);
--  if (res != 0) {
--    lprintf("mms: error answer 0x11 status: %08x (%s)\n",
--            res, status_to_string(res));
--    goto fail;
--  }
--
--  this->num_stream_ids = 0;
--
--  if (!get_asf_header (io, this))
--    goto fail;
--
--  interp_asf_header (this);
--  if (!this->asf_packet_len || !this->num_stream_ids)
--    goto fail;
--
--  if (!mms_choose_best_streams(io, this)) {
--    lprintf("mms: mms_choose_best_streams failed\n");
--    goto fail;
--  }
--
--  /* command 0x07 */
--  this->packet_id_type = ASF_MEDIA_PACKET_ID_TYPE;
--  {
--    mms_buffer_t command_buffer;
--    mms_buffer_init(&command_buffer, this->scmd_body);
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* 64 byte float timestamp */
--    mms_buffer_put_32 (&command_buffer, 0x00000000);                  
--    mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* ?? */
--    mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* first packet sequence */
--    mms_buffer_put_8  (&command_buffer, 0xFF);                        /* max stream time limit (3 bytes) */
--    mms_buffer_put_8  (&command_buffer, 0xFF);
--    mms_buffer_put_8  (&command_buffer, 0xFF);
--    mms_buffer_put_8  (&command_buffer, 0x00);                        /* stream time limit flag */
--    mms_buffer_put_32 (&command_buffer, this->packet_id_type);    /* asf media packet id type */
--    if (!send_command (io, this, 0x07, 1, 0x0001FFFF, command_buffer.pos)) {
--      lprintf("mms: failed to send command 0x07\n");
--      goto fail;
--    }
--  }
--
--  iconv_close(url_conv);
--  lprintf("mms: connect: passed\n");
-- 
--  return this;
--
--fail:
--  if (this->s != -1)
--    close (this->s);
--  if (this->url)
--    free(this->url);
--  if (this->guri)
--    gnet_uri_delete(this->guri);
--  if (this->uri)
--    free(this->uri);
--  if (url_conv != (iconv_t)-1)
--    iconv_close(url_conv);
--
--  free (this);
--  return NULL;
--}
--
--static int get_media_packet (mms_io_t *io, mms_t *this) {
--  mms_packet_header_t header;
--  off_t len;
--  
--  switch (get_packet_header (io, this, &header)) {
--    case MMS_PACKET_ERR:
--      return 0;
--    
--    case MMS_PACKET_COMMAND:
--      {
--        int command;
--        command = get_packet_command (io, this, header.packet_len);
--      
--        switch (command) {
--          case 0:
--            return 0;
--
--          case 0x1e:
--            {
--              uint32_t error_code;
--
--              /* Warning: sdp is incomplete. Do not stop if error_code==1 */
--              error_code = LE_32(this->buf + CMD_HEADER_LEN);
--              lprintf("mms: End of the current stream. Continue=%d\n", error_code);
--
--              if (error_code == 0) {
--                this->eos = 1;
--                return 0;
--              }
--              
--            }
--            break;
--  
--          case 0x20:
--            {
--              lprintf("mms: new stream.\n");
--              /* asf header */
--              if (!get_asf_header (io, this)) {
--                lprintf("mms: failed to read new ASF header\n");
--                return 0;
--              }
--
--              interp_asf_header (this);
--              if (!this->asf_packet_len || !this->num_stream_ids)
--                return 0;
--
--              if (!mms_choose_best_streams(io, this))
--                return 0;
--
--              /* send command 0x07 */
--              /* TODO: ugly */
--              /* command 0x07 */
--              {
--                mms_buffer_t command_buffer;
--                mms_buffer_init(&command_buffer, this->scmd_body);
--                mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* 64 byte float timestamp */
--                mms_buffer_put_32 (&command_buffer, 0x00000000);                  
--                mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* ?? */
--                mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* first packet sequence */
--                mms_buffer_put_8  (&command_buffer, 0xFF);                        /* max stream time limit (3 bytes) */
--                mms_buffer_put_8  (&command_buffer, 0xFF);
--                mms_buffer_put_8  (&command_buffer, 0xFF);
--                mms_buffer_put_8  (&command_buffer, 0x00);                        /* stream time limit flag */
--                mms_buffer_put_32 (&command_buffer, ASF_MEDIA_PACKET_ID_TYPE);    /* asf media packet id type */
--                if (!send_command (io, this, 0x07, 1, 0x0001FFFF, command_buffer.pos)) {
--                  lprintf("mms: failed to send command 0x07\n");
--                  return 0;
--                }
--              }
--              this->current_pos = 0;
--              
--              /* I don't know if this ever happens with none live (and thus
--                 seekable streams), but I do know that if it happens all bets
--                 with regards to seeking are off */
--              this->seekable = 0;
--            }
--            break;
--
--          case 0x1b:
--            {
--              if (!send_command (io, this, 0x1b, 0, 0, 0)) {
--                lprintf("mms: error sending ping reply\n");
--                return 0;
--              }
--            }
--            break;
--          
--          case 0x05:
--            break;
--  
--          default:
--            lprintf("mms: unexpected mms command %02x\n", command);
--        }
--        this->buf_size = 0;
--      }
--      break;
--
--    case MMS_PACKET_ASF_HEADER:
--      lprintf("mms: unexpected asf header packet\n");
--      this->buf_size = 0;
--      break;
--
--    case MMS_PACKET_ASF_PACKET:
--      {
--        /* media packet */
--
--        /* FIXME: probably needs some more sophisticated logic, but
--           until we do seeking, this should work */
--        if(this->need_discont &&
--           header.packet_id_type == ASF_MEDIA_PACKET_ID_TYPE)
--        {
--          this->need_discont = 0;
--          this->start_packet_seq = header.packet_seq;
--        }
--        
--        if (header.packet_len > this->asf_packet_len) {
--          lprintf("mms: invalid asf packet len: %d bytes\n", header.packet_len);
--          return 0;
--        }
--    
--        /* simulate a seek */
--        this->current_pos = (off_t)this->asf_header_len +
--          ((off_t)header.packet_seq - this->start_packet_seq) * (off_t)this->asf_packet_len;
--
--        len = io_read(io,  this->s, this->buf, header.packet_len);
--        if (len != header.packet_len) {
--          lprintf("mms: error reading asf packet\n");
--          return 0;
--        }
--
--        /* explicit padding with 0 */
--        memset(this->buf + header.packet_len, 0, this->asf_packet_len - header.packet_len);
--        if (header.packet_id_type == this->packet_id_type) {
--          this->buf_size = this->asf_packet_len;
--          this->buf_packet_seq_offset =
--            header.packet_seq - this->start_packet_seq;
--        } else {
--          this->buf_size = 0;
--          // Don't set this packet sequence for reuse in seek(), since the
--          // subsequence packet may be discontinued.
--          //this->buf_packet_seq_offset = header.packet_seq;
--          // already set to -1 in get_packet_header
--          //this->buf_packet_seq_offset = -1;
--        }
--      }
--      break;
--  }
--
--  return 1;
--}
--
--
--int mms_peek_header (mms_t *this, char *data, int maxsize) {
--
--  int len;
--
--  len = (this->asf_header_len < maxsize) ? this->asf_header_len : maxsize;
--
--  memcpy(data, this->asf_header, len);
--  return len;
--}
--
--int mms_read (mms_io_t *io, mms_t *this, char *data, int len) {
--  int total;
--
--  total = 0;
--  while (total < len && !this->eos) {
--
--    if (this->asf_header_read < this->asf_header_len) {
--      int n, bytes_left;
--
--      bytes_left = this->asf_header_len - this->asf_header_read ;
--
--      if ((len - total) < bytes_left)
--        n = len-total;
--      else
--        n = bytes_left;
--
--      memcpy (&data[total], &this->asf_header[this->asf_header_read], n);
--
--      this->asf_header_read += n;
--      total += n;
--      this->current_pos += n;
--    } else {
--
--      int n, bytes_left;
--
--      bytes_left = this->buf_size - this->buf_read;
--      if (bytes_left == 0) {
--        this->buf_size = this->buf_read = 0;
--        if (!get_media_packet (io, this)) {
--          lprintf("mms: get_media_packet failed\n");
--          return total;
--        }
--        bytes_left = this->buf_size;
--      }
--
--      if ((len - total) < bytes_left)
--        n = len - total;
--      else
--        n = bytes_left;
--
--      memcpy (&data[total], &this->buf[this->buf_read], n);
--
--      this->buf_read += n;
--      total += n;
--      this->current_pos += n;
--    }
--  }
--  return total;
--}
--
--// To be inline function?
--static int mms_request_data_packet (mms_io_t *io, mms_t *this,
--  double time_sec, unsigned long first_packet, unsigned long time_msec_limit) {
--  /* command 0x07 */
--  {
--    mms_buffer_t command_buffer;
--    //mms_buffer_init(&command_buffer, this->scmd_body);
--    //mms_buffer_put_32 (&command_buffer, 0x00000000);                  /* 64 byte float timestamp */
--    //mms_buffer_put_32 (&command_buffer, 0x00000000);                  
--    memcpy(this->scmd_body, &time_sec, 8);
--    mms_buffer_init(&command_buffer, this->scmd_body+8);
--    mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* ?? */
--    //mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF);                  /* first packet sequence */
--    mms_buffer_put_32 (&command_buffer, first_packet);                  /* first packet sequence */
--    //mms_buffer_put_8  (&command_buffer, 0xFF);                        /* max stream time limit (3 bytes) */
--    //mms_buffer_put_8  (&command_buffer, 0xFF);
--    //mms_buffer_put_8  (&command_buffer, 0xFF);
--    //mms_buffer_put_8  (&command_buffer, 0x00);                        /* stream time limit flag */
--    mms_buffer_put_32 (&command_buffer, time_msec_limit & 0x00FFFFFF);/* max stream time limit (3 bytes) */
--    mms_buffer_put_32 (&command_buffer, this->packet_id_type);    /* asf media packet id type */
--    if (!send_command (io, this, 0x07, 1, 0x0001FFFF, 8+command_buffer.pos)) {
--      lprintf("mms: failed to send command 0x07\n");
--      return 0;
--    }
--  }
--  /* TODO: adjust current_pos, considering asf_header_read */
--  return 1;
--}
--
--int mms_request_time_seek (mms_io_t *io, mms_t *this, double time_sec) {
--  if (++this->packet_id_type <= ASF_MEDIA_PACKET_ID_TYPE)
--    this->packet_id_type = ASF_MEDIA_PACKET_ID_TYPE+1;
--  //return mms_request_data_packet (io, this, time_sec, 0xFFFFFFFF, 0x00FFFFFF);
--  // also adjust time by preroll
--  return mms_request_data_packet (io, this,
--                                  time_sec+(double)(this->preroll)/1000,
--                                  0xFFFFFFFF, 0x00FFFFFF);
--}
--
--// set current_pos to the first byte of the requested packet by peeking at
--// the first packet.
--// To be inline function?
--static int peek_and_set_pos (mms_io_t *io, mms_t *this) {
--  uint8_t saved_buf[BUF_SIZE];
--  int     saved_buf_size;
--  off_t   saved_buf_packet_seq_offset;
--  // save buf and buf_size that may be changed in get_media_packet()
--  memcpy(saved_buf, this->buf, this->buf_size);
--  saved_buf_size = this->buf_size;
--  saved_buf_packet_seq_offset = this->buf_packet_seq_offset;
--  //this->buf_size = this->buf_read = 0; // reset buf, only if success peeking
--  this->buf_size = 0;
--  while (!this->eos) {
--    // get_media_packet() will set current_pos if data packet is read.
--    if (!get_media_packet (io, this)) {
--      lprintf("mms: get_media_packet failed\n");
--      // restore buf and buf_size that may be changed in get_media_packet()
--      memcpy(this->buf, saved_buf, saved_buf_size);
--      this->buf_size = saved_buf_size;
--      this->buf_packet_seq_offset = saved_buf_packet_seq_offset;
--      return 0;
--    }
--    if (this->buf_size > 0) break;
--  }
--  // flush header and reset buf_read, only if success peeking
--  this->asf_header_read = this->asf_header_len;
--  this->buf_read = 0;
--  return 1;
--  //return this->current_pos;
--}
--
--// send time seek request, and update current_pos corresponding to the next
--// requested packet
--// Note that, the current_pos will always does not less than asf_header_len
--int mms_time_seek (mms_io_t *io, mms_t *this, double time_sec) {
--  if (!this->seekable)
--    return 0;
--
--  if (!mms_request_time_seek (io, this, time_sec)) return 0;
--  return peek_and_set_pos (io, this);
--}
--
--// http://sdp.ppona.com/zipfiles/MMSprotocol_pdf.zip said that, this
--// packet_seq value make no difference in version 9 servers.
--// But from my experiment with
--// mms://202.142.200.130/tltk/56k/tltkD2006-08-08ID-7209.wmv and
--// mms://202.142.200.130/tltk/56k/tltkD2006-09-01ID-7467.wmv (the url may valid
--// in only 2-3 months) whose server is version 9, it does response and return
--// the requested packet.
--int mms_request_packet_seek (mms_io_t *io, mms_t *this,
--                             unsigned long packet_seq) {
--  if (++this->packet_id_type <= ASF_MEDIA_PACKET_ID_TYPE)
--    this->packet_id_type = ASF_MEDIA_PACKET_ID_TYPE+1;
--  return mms_request_data_packet (io, this, 0, packet_seq, 0x00FFFFFF);
--}
--
--// send packet seek request, and update current_pos corresponding to the next
--// requested packet
--// Note that, the current_pos will always does not less than asf_header_len
--// Not export this function.  Let user use mms_seek() instead?
--static int mms_packet_seek (mms_io_t *io, mms_t *this,
--                            unsigned long packet_seq) {
--  if (!mms_request_packet_seek (io, this, packet_seq)) return 0;
--  return peek_and_set_pos (io, this);
--}
--
--/*
--TODO: To use this table to calculate buf_packet_seq_offset rather than store
--and retrieve it from this->buf_packet_seq_offset?
--current_packet_seq == (current_pos - asf_header_len) / asf_packet_len
--current_packet_seq == -1 if current_pos < asf_header_len
--buf_packet_seq_offset indicating which packet sequence are residing in the buf.
--Possible status after read(), "last" means last value or unchange.
--current_packet_seq | buf_read       | buf_size  | buf_packet_seq_offset
---------------------+----------------+-----------+---------------
--<= 0               | 0 (last)       | 0 (last)  | none
--<= 0               | 0 (last)       | 0 (last)  | eos at #0
--<= 0               | 0 (last)       | 0 (last)  | eos at > #0
--<= 0               | 0 (last)       | > 0 (last)| #0
--<= 0               | buf_size (last)| > 0 (last)| > #0
--> 0                | 0              | 0         | eos at current_packet_seq
--> 0                | 0(never happen)| > 0       | (never happen)
--> 0                | buf_size       | > 0       | current_packet_seq-1
--*/
--// TODO: How to handle seek() in multi stream source?
--// The stream that follows 0x20 ("new stream") command.
--off_t mms_seek (mms_io_t *io, mms_t *this, off_t offset, int origin) {
--  off_t dest;
--  off_t dest_packet_seq;
--  //off_t buf_packet_seq_offset;
--  
--  if (!this->seekable)
--    return this->current_pos;
--  
--  switch (origin) {
--    case SEEK_SET:
--      dest = offset;
--      break;
--    case SEEK_CUR:
--      dest = this->current_pos + offset;
--      break;
--    case SEEK_END:
--      //if (this->asf_num_packets == 0) {
--      //  //printf ("input_mms: unknown end position in seek!\n");
--      //  return this->current_pos;
--      //}
--      dest = mms_get_length (this) + offset;
--    default:
--      printf ("input_mms: unknown origin in seek!\n");
--      return this->current_pos;
--  }
--
--  dest_packet_seq = dest - this->asf_header_len;
--  //if (dest_packet_seq > 0) dest_packet_seq /= this->asf_packet_len;
--  dest_packet_seq = dest_packet_seq >= 0 ?
--    dest_packet_seq / this->asf_packet_len : -1;
--#if 0
--  // buf_packet_seq_offset will identify which packet sequence are residing in
--  // the buf.
--#if 1 /* To show both of the alternate styles :D */
--  buf_packet_seq_offset = this->current_pos - this->asf_header_len;
--  //if (buf_packet_seq_offset > 0) buf_packet_seq_offset /= this->asf_packet_len;
--  buf_packet_seq_offset = buf_packet_seq_offset >= 0 ?
--    buf_packet_seq_offset / this->asf_packet_len : -1;
--  // Note: buf_read == buf_size == 0 may means that it is eos,
--  //       eos means that the packet has been peek'ed.
--  if (this->buf_read >= this->buf_size && this->buf_size > 0 &&
--      buf_packet_seq_offset >= 0 ||
--      // assuming packet not peek'ed in the following condition
--      /*this->buf_read >= this->buf_size && */this->buf_size == 0 &&
--      buf_packet_seq_offset == 0)
--    // The buf is all read but the packet has not been peek'ed.
--    --buf_packet_seq_offset;
--#else
--  buf_packet_seq_offset = this->current_pos - this->asf_header_len - 1;
--  //if (buf_packet_seq_offset > 0) buf_packet_seq_offset /= this->asf_packet_len;
--  buf_packet_seq_offset = buf_packet_seq_offset >= 0 ?
--    buf_packet_seq_offset / this->asf_packet_len : -1;
--  // Note: buf_read == buf_size == 0 may means that it is eos,
--  //       eos means that the packet has been peek'ed.
--  if (this->buf_read == 0/* && buf_packet_seq_offset >= 0*/)
--    // Since the packet has just been peek'ed.
--    ++buf_packet_seq_offset;
--#endif
--#endif
--
--  if (dest_packet_seq < 0) {
--    if (this->buf_packet_seq_offset > 0) {
--      if (!mms_request_packet_seek (io, this, 0xFFFFFFFF))
--        return this->current_pos;
--#if 1
--      // clear buf
--      this->buf_read = this->buf_size = 0;
--      this->buf_packet_seq_offset = -1;
--    } else {
--#else
--      // clear buf
--      this->buf_read = this->buf_size;
--      // Set this packet sequence not to be reused, since the subsequence
--      // packet may be discontinued.
--      this->buf_packet_seq_offset = -1;
--    // don't reset buf_read if buf_packet_seq_offset < 0, since the previous
--    // buf may not be cleared.
--    } else if (this->buf_packet_seq_offset == 0) {
--#endif
--      // reset buf_read
--      this->buf_read = 0;
--    }
--    this->asf_header_read = dest;
--    return this->current_pos = dest;
--  }
--  // dest_packet_seq >= 0
--  if (this->asf_num_packets && dest == this->asf_header_len +
--      this->asf_num_packets*this->asf_packet_len) {
--    // Requesting the packet beyond the last packet, can cause the server to
--    // not return any packet or any eos command.  This can cause
--    // mms_packet_seek() to hang.
--    // This is to allow seeking at end of stream, and avoid hanging.
--    --dest_packet_seq;
--  }
--  if (dest_packet_seq != this->buf_packet_seq_offset) {
--    if (this->asf_num_packets && dest_packet_seq >= this->asf_num_packets) {
--      // Do not seek beyond the last packet.
--      return this->current_pos;
--    }
--    if (!mms_packet_seek (io, this, this->start_packet_seq + dest_packet_seq))
--      return this->current_pos;
--    // Check if current_pos is correct.
--    // This can happen if the server ignore packet seek command.
--    // If so, just return unchanged current_pos, rather than trying to
--    // mms_read() to reach the destination pos.
--    // It should let the caller to decide to choose the alternate method, such
--    // as, mms_time_seek() and/or mms_read() until the destination pos is
--    // reached.
--    if (dest_packet_seq != this->buf_packet_seq_offset)
--      return this->current_pos;
--    // This has already been set in mms_packet_seek().
--    //if (current_packet_seq < 0)
--    //  this->asf_header_read = this->asf_header_len;
--    //this->asf_header_read = this->asf_header_len;
--  }
--  // eos is reached ?
--  //if (this->buf_size <= 0) return this->current_pos;
--  //this->buf_read = (dest - this->asf_header_len) % this->asf_packet_len;
--  this->buf_read = dest -
--    (this->asf_header_len + dest_packet_seq*this->asf_packet_len);
--  // will never happen ?
--  //if (this->buf_size <= this->buf_read) return this->current_pos;
--  return this->current_pos = dest;
--}
--
--
--void mms_close (mms_t *this) {
--
--  if (this->s != -1)
--    close (this->s);
--  if (this->url)
--    free(this->url);
--  if (this->guri)
--    gnet_uri_delete(this->guri);
--  if (this->uri)
--    free(this->uri);
--
--  free (this);
--}
--
--double mms_get_time_length (mms_t *this) {
--  return (double)(this->time_len) / 1e7;
--}
--
--uint64_t mms_get_raw_time_length (mms_t *this) {
--  return this->time_len;
--}
--
--uint32_t mms_get_length (mms_t *this) {
--  /* we could / should return this->file_len here, but usually this->file_len
--     is longer then the calculation below, as usually an asf file contains an
--     asf index object after the data stream. However since we do not have a
--     (known) way to get to this index object through mms, we return a
--     calculated size of what we can get to when we know. */
--  if (this->asf_num_packets)
--    return this->asf_header_len + this->asf_num_packets*this->asf_packet_len;
--  else
--    return this->file_len;
--}
--
--off_t mms_get_current_pos (mms_t *this) {
--  return this->current_pos;
--}
--
--uint32_t mms_get_asf_header_len (mms_t *this) {
--  return this->asf_header_len;
--}
--
--uint64_t mms_get_asf_packet_len (mms_t *this) {
--  return this->asf_packet_len;
--}
--
--int mms_get_seekable (mms_t *this) {
--  return this->seekable;
--}
-diff --git a/plugins/mms/libmms/mms.h b/plugins/mms/libmms/mms.h
-deleted file mode 100644
-index bce71d5..0000000
---- a/plugins/mms/libmms/mms.h
-+++ /dev/null
-@@ -1,80 +0,0 @@
--/*
-- * Copyright (C) 2002-2003 the xine project
-- *
-- * This file is part of xine, a free video player.
-- *
-- * xine is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * xine is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * $Id: mms.h,v 1.15 2007/12/11 20:24:48 jwrdegoede Exp $
-- *
-- * libmms public header
-- */
--
--#ifndef HAVE_MMS_H
--#define HAVE_MMS_H
--
--#include <inttypes.h>
--#include <stdio.h>
--#include <sys/types.h>
--
--#include "mmsio.h"
--
--#ifdef __cplusplus
--extern "C" {
--#endif /* __cplusplus */
--
--typedef struct mms_s mms_t;
--
--mms_t*   mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth);
--
--int      mms_read (mms_io_t *io, mms_t *instance, char *data, int len);
--int      mms_request_time_seek (mms_io_t *io, mms_t *instance, double time_sec);
--int      mms_time_seek (mms_io_t *io, mms_t *instance, double time_sec);
--int      mms_request_packet_seek (mms_io_t *io, mms_t *instance,
--                                  unsigned long packet_seq);
--/*
-- * mms_seek() will try to seek using mms_request_packet_seek(), if the server
-- * ignore the packet seek command, it will return unchanged current_pos, rather
-- * than trying to mms_read() until the destination pos is reached.  This is to
-- * let the caller, by itself, to decide to choose the alternate method, such
-- * as, mms_time_seek() and/or mms_read() until the destination pos is reached.
-- * One can do binary search using time offset (mms_time_seek()) as a search
-- * index, to approach the desired byte offset.  It is to systematically guess
-- * the time offset to reach for the byte offset.
-- */
--mms_off_t mms_seek (mms_io_t *io, mms_t *instance, mms_off_t offset, int origin);
--/* return total playback time in seconds */
--double   mms_get_time_length (mms_t *instance);
--/* return raw total playback time in 100 nanosecs (10^-7) */
--uint64_t mms_get_raw_time_length (mms_t *instance);
--uint32_t mms_get_length (mms_t *instance);
--void     mms_close (mms_t *instance);
--
--int      mms_peek_header (mms_t *instance, char *data, int maxsize);
--
--mms_off_t mms_get_current_pos (mms_t *instance);
--
--uint32_t mms_get_asf_header_len (mms_t *instance);
--
--uint64_t mms_get_asf_packet_len (mms_t *instance);
--
--int      mms_get_seekable (mms_t *instance);
--
--#ifdef __cplusplus
--}
--#endif /* __cplusplus */
--
--#endif
--
-diff --git a/plugins/mms/libmms/mmsh.c b/plugins/mms/libmms/mmsh.c
-deleted file mode 100644
-index 9a7b119..0000000
---- a/plugins/mms/libmms/mmsh.c
-+++ /dev/null
-@@ -1,1534 +0,0 @@
--/*
-- * Copyright (C) 2002-2003 the xine project
-- *
-- * This file is part of xine, a free video player.
-- *
-- * xine is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * xine is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * $Id: mmsh.c,v 1.16 2007/12/11 20:50:43 jwrdegoede Exp $
-- *
-- * MMS over HTTP protocol
-- *   written by Thibaut Mattern
-- *   based on mms.c and specs from avifile
-- *   (http://avifile.sourceforge.net/asf-1.0.htm)
-- *
-- * TODO:
-- *   error messages
-- *   http support cleanup, find a way to share code with input_http.c (http.h|c)
-- *   http proxy support
-- */
--
--#ifdef HAVE_CONFIG_H
--#include "config.h"
--#endif
--
--#include <unistd.h>
--#include <stdio.h>
--#include <stdlib.h>
--#include <sys/socket.h>
--#include <netinet/in.h>
--#include <netdb.h>
--#include <string.h>
--#include <sys/types.h>
--#include <sys/stat.h>
--#include <fcntl.h>
--#include <errno.h>
--#include <stdlib.h>
--#include <time.h>
--#include <assert.h>
--
--#define lprintf(...) if (getenv("LIBMMS_DEBUG")) fprintf(stderr, __VA_ARGS__)
--
--/* cheat a bit and call ourselves mms.c to keep the code in mmsio.h clean */
--#define __MMS_C__
--
--#include "bswap.h"
--#include "mmsh.h"
--#include "asfheader.h"
--#include "uri.h"
--#include "mms-common.h"
--
--/* #define USERAGENT "User-Agent: NSPlayer/7.1.0.3055\r\n" */
--#define USERAGENT "User-Agent: NSPlayer/4.1.0.3856\r\n"
--#define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n"
--
--
--#define MMSH_PORT                  80
--#define MMSH_UNKNOWN                0
--#define MMSH_SEEKABLE               1
--#define MMSH_LIVE                   2
--
--#define CHUNK_HEADER_LENGTH         4
--#define EXT_HEADER_LENGTH           8
--#define CHUNK_TYPE_RESET       0x4324
--#define CHUNK_TYPE_DATA        0x4424
--#define CHUNK_TYPE_END         0x4524
--#define CHUNK_TYPE_ASF_HEADER  0x4824
--#define CHUNK_SIZE              65536  /* max chunk size */
--#define ASF_HEADER_SIZE     (8192 * 2)  /* max header size */
--
--#define SCRATCH_SIZE             1024
--
--#define SUCCESS 0
--#define ERROR 1
--#define EOS 2
--#define GOT_HEADER_N_DATA 3
--
--static const char* mmsh_FirstRequest =
--    "GET %s HTTP/1.0\r\n"
--    "Accept: */*\r\n"
--    USERAGENT
--    "Host: %s:%d\r\n"
--    "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%u,max-duration=0\r\n"
--    CLIENTGUID
--    "Connection: Close\r\n\r\n";
--
--static const char* mmsh_SeekableRequest =
--    "GET %s HTTP/1.0\r\n"
--    "Accept: */*\r\n"
--    USERAGENT
--    "Host: %s:%d\r\n"
--    "Pragma: no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=%u,max-duration=%u\r\n"
--    CLIENTGUID
--    "Pragma: xPlayStrm=1\r\n"
--    "Pragma: stream-switch-count=%d\r\n"
--    "Pragma: stream-switch-entry=%s\r\n" /*  ffff:1:0 ffff:2:0 */
--    "Connection: Close\r\n\r\n";
--
--static const char* mmsh_LiveRequest =
--    "GET %s HTTP/1.0\r\n"
--    "Accept: */*\r\n"
--    USERAGENT
--    "Host: %s:%d\r\n"
--    "Pragma: no-cache,rate=1.000000,request-context=%u\r\n"
--    "Pragma: xPlayStrm=1\r\n"
--    CLIENTGUID
--    "Pragma: stream-switch-count=%d\r\n"
--    "Pragma: stream-switch-entry=%s\r\n"
--    "Connection: Close\r\n\r\n";
--
--
--#if 0
--/* Unused requests */
--static const char* mmsh_PostRequest =
--    "POST %s HTTP/1.0\r\n"
--    "Accept: */*\r\n"
--    USERAGENT
--    "Host: %s\r\n"
--    "Pragma: client-id=%u\r\n"
--/*    "Pragma: log-line=no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=2,max-duration=%u\r\n" */
--    "Pragma: Content-Length: 0\r\n"
--    CLIENTGUID
--    "\r\n";
--
--static const char* mmsh_RangeRequest =
--    "GET %s HTTP/1.0\r\n"
--    "Accept: */*\r\n"
--    USERAGENT
--    "Host: %s:%d\r\n"
--    "Range: bytes=%Lu-\r\n"
--    CLIENTGUID
--    "Connection: Close\r\n\r\n";
--#endif
--
--
--
--/* 
-- * mmsh specific types 
-- */
--
--
--struct mmsh_s {
--
--  int           s;
--
--  /* url parsing */
--  char         *url;
--  char         *proxy_url;
--  char         *proto;
--  char         *connect_host;
--  int           connect_port;
--  char         *http_host;
--  int           http_port;
--  int           http_request_number;
--  char         *proxy_user;
--  char         *proxy_password;
--  char         *host_user;
--  char         *host_password;
--  char         *uri;
--
--  char          str[SCRATCH_SIZE]; /* scratch buffer to built strings */
--
--  int           stream_type;  /* seekable or broadcast */
--  
--  /* receive buffer */
--  
--  /* chunk */
--  uint16_t      chunk_type;
--  uint16_t      chunk_length;
--  uint32_t      chunk_seq_number;
--  uint8_t       buf[CHUNK_SIZE];
--
--  int           buf_size;
--  int           buf_read;
--
--  uint8_t       asf_header[ASF_HEADER_SIZE];
--  uint32_t      asf_header_len;
--  uint32_t      asf_header_read;
--  int           num_stream_ids;
--  mms_stream_t  streams[ASF_MAX_NUM_STREAMS];
--  uint32_t      packet_length;
--  int64_t       file_length;
--  uint64_t      time_len; /* playback time in 100 nanosecs (10^-7) */
--  uint64_t      preroll;
--  uint64_t      asf_num_packets;
--  char          guid[37];
--
--  int           has_audio;
--  int           has_video;
--  int           seekable;
--
--  off_t         current_pos;
--  int           user_bandwidth;
--};
--
--static int fallback_io_select(void *data, int socket, int state, int timeout_msec)
--{
--  fd_set set;
--  struct timeval tv = { timeout_msec / 1000, (timeout_msec % 1000) * 1000};
--  FD_ZERO(&set);
--  FD_SET(socket, &set);
--  return select(1, (state == MMS_IO_READ_READY) ? &set : NULL,
--                   (state == MMS_IO_WRITE_READY) ? &set : NULL, NULL, &tv);
--}
--
--static off_t fallback_io_read(void *data, int socket, char *buf, off_t num)
--{
--  off_t len = 0, ret;
--/*   lprintf("%d\n", fallback_io_select(data, socket, MMS_IO_READ_READY, 1000)); */
--  errno = 0;
--  while (len < num)
--  {
--    ret = (off_t)read(socket, buf + len, num - len);
--    if(ret == 0)
--      break; /* EOS */
--    if(ret < 0) {
--      lprintf("mmsh: read error @ len = %lld: %s\n", (long long int) len,
--              strerror(errno));
--      switch(errno)
--      {
--          case EAGAIN:
--            continue;
--          default:
--            /* if already read something, return it, we will fail next time */
--            return len ? len : ret; 
--      }
--    }
--    len += ret;
--  }
--  return len;
--}
--
--static off_t fallback_io_write(void *data, int socket, char *buf, off_t num)
--{
--  return (off_t)write(socket, buf, num);
--}
--
--static int fallback_io_tcp_connect(void *data, const char *host, int port)
--{
--  
--  struct hostent *h;
--  int i, s;
--  
--  h = gethostbyname(host);
--  if (h == NULL) {
--    lprintf("mmsh: unable to resolve host: %s\n", host);
--    return -1;
--  }
--
--  s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);  
--  if (s == -1) {
--    lprintf("mmsh: failed to create socket: %s\n", strerror(errno));
--    return -1;
--  }
--
--  if (fcntl (s, F_SETFL, fcntl (s, F_GETFL) & ~O_NONBLOCK) == -1) {
--    lprintf("mmsh: failed to set socket flags: %s\n", strerror(errno));
--    return -1;
--  }
--
--  for (i = 0; h->h_addr_list[i]; i++) {
--    struct in_addr ia;
--    struct sockaddr_in sin;
-- 
--    memcpy (&ia, h->h_addr_list[i], 4);
--    sin.sin_family = AF_INET;
--    sin.sin_addr   = ia;
--    sin.sin_port   = htons(port);
--    
--    if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) ==-1 && errno != EINPROGRESS) {
--      continue;
--    }
--    
--    return s;
--  }
--  close(s);
--  return -1;
--}
--
--
--static mms_io_t fallback_io =
--  {
--    &fallback_io_select,
--    NULL,
--    &fallback_io_read,
--    NULL,
--    &fallback_io_write,
--    NULL,
--    &fallback_io_tcp_connect,
--    NULL,
--  };
--
--static mms_io_t default_io =   {
--    &fallback_io_select,
--    NULL,
--    &fallback_io_read,
--    NULL,
--    &fallback_io_write,
--    NULL,
--    &fallback_io_tcp_connect,
--    NULL,
--  };
--
--
--#define io_read(io, args...) ((io) ? (io)->read(io->read_data , ## args) : default_io.read(NULL , ## args))
--#define io_write(io, args...) ((io) ? (io)->write(io->write_data , ## args) : default_io.write(NULL , ## args))
--#define io_select(io, args...) ((io) ? (io)->select(io->select_data , ## args) : default_io.select(NULL , ## args))
--#define io_connect(io, args...) ((io) ? (io)->connect(io->connect_data , ## args) : default_io.connect(NULL , ## args))
--  
--static int get_guid (unsigned char *buffer, int offset) {
--  int i;
--  GUID g;
--  
--  g.Data1 = LE_32(buffer + offset);
--  g.Data2 = LE_16(buffer + offset + 4);
--  g.Data3 = LE_16(buffer + offset + 6);
--  for(i = 0; i < 8; i++) {
--    g.Data4[i] = buffer[offset + 8 + i];
--  }
--  
--  for (i = 1; i < GUID_END; i++) {
--    if (!memcmp(&g, &guids[i].guid, sizeof(GUID))) {
--      lprintf("mmsh: GUID: %s\n", guids[i].name);
--      return i;
--    }
--  }
--
--  lprintf("mmsh: unknown GUID: 0x%x, 0x%x, 0x%x, "
--          "{ 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx }\n",
--          g.Data1, g.Data2, g.Data3,
--          g.Data4[0], g.Data4[1], g.Data4[2], g.Data4[3], 
--          g.Data4[4], g.Data4[5], g.Data4[6], g.Data4[7]);
--  return GUID_ERROR;
--}
--
--static int send_command (mms_io_t *io, mmsh_t *this, char *cmd)  {
--  int length;
--
--  lprintf("mmsh: send_command:\n%s\n", cmd);
--
--  length = strlen(cmd);
--  if (io_write(io, this->s, cmd, length) != length) {
--    lprintf ("mmsh: send error.\n");
--    return 0;
--  }
--  return 1;
--}
--
--static int get_answer (mms_io_t *io, mmsh_t *this) {
-- 
--  int done, len, linenum;
--  char *features;
--
--  done = 0; len = 0; linenum = 0;
--  this->stream_type = MMSH_UNKNOWN;
--
--  while (!done) {
--
--    if (io_read(io, this->s, &(this->buf[len]), 1) != 1) {
--      lprintf ("mmsh: alart: end of stream\n");
--      return 0;
--    }
--
--    if (this->buf[len] == '\012') {
--
--      this->buf[len] = '\0';
--      len--;
--      
--      if ((len >= 0) && (this->buf[len] == '\015')) {
--        this->buf[len] = '\0';
--        len--;
--      }
--
--      linenum++;
--      
--      lprintf("mmsh: answer: >%s<\n", this->buf);
--
--      if (linenum == 1) {
--        int httpver, httpsub, httpcode;
--        char httpstatus[51];
--
--        if (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub,
--            &httpcode, httpstatus) != 4) {
--          lprintf ("mmsh: bad response format\n");
--          return 0;
--        }
--
--        if (httpcode >= 300 && httpcode < 400) {
--          lprintf ("mmsh: 3xx redirection not implemented: >%d %s<\n", httpcode, httpstatus);
--          return 0;
--        }
--
--        if (httpcode < 200 || httpcode >= 300) {
--          lprintf ("mmsh: http status not 2xx: >%d %s<\n", httpcode, httpstatus);
--          return 0;
--        }
--      } else {
--
--        if (!strncasecmp(this->buf, "Location: ", 10)) {
--          lprintf ("mmsh: Location redirection not implemented.\n");
--          return 0;
--        }
--        
--        if (!strncasecmp(this->buf, "Pragma:", 7)) {
--          features = strstr(this->buf + 7, "features=");
--          if (features) {
--            if (strstr(features, "seekable")) {
--              lprintf("mmsh: seekable stream\n");
--              this->stream_type = MMSH_SEEKABLE;
--              this->seekable = 1;
--            } else {
--              if (strstr(features, "broadcast")) {
--                lprintf("mmsh: live stream\n");
--                this->stream_type = MMSH_LIVE;
--                this->seekable = 0;
--              }
--            }
--          }
--        }
--      }
--      
--      if (len == -1) {
--        done = 1;
--      } else {
--        len = 0;
--      }
--    } else {
--      len ++;
--    }
--  }
--  if (this->stream_type == MMSH_UNKNOWN) {
--    lprintf ("mmsh: unknown stream type\n");
--    this->stream_type = MMSH_SEEKABLE; /* FIXME ? */
--    this->seekable = 1;
--  }
--  return 1;
--}
--
--static int get_chunk_header (mms_io_t *io, mmsh_t *this) {
--  uint8_t chunk_header[CHUNK_HEADER_LENGTH];
--  uint8_t ext_header[EXT_HEADER_LENGTH];
--  int read_len;
--  int ext_header_len;
--
--  /* read chunk header */
--  read_len = io_read(io, this->s, chunk_header, CHUNK_HEADER_LENGTH);
--  if (read_len != CHUNK_HEADER_LENGTH) {
--    if (read_len == 0)
--      return EOS;
--    lprintf("mmsh: chunk header read failed, %d != %d\n", read_len, CHUNK_HEADER_LENGTH);
--    return ERROR;
--  }
--  this->chunk_type       = LE_16 (&chunk_header[0]);
--  this->chunk_length     = LE_16 (&chunk_header[2]);
--
--  switch (this->chunk_type) {
--    case CHUNK_TYPE_DATA:
--      ext_header_len = 8;
--      break;
--    case CHUNK_TYPE_END:
--      ext_header_len = 4;
--      break;
--    case CHUNK_TYPE_ASF_HEADER:
--      ext_header_len = 8;
--      break;
--    case CHUNK_TYPE_RESET:
--      ext_header_len = 4;
--      break;
--    default:
--      ext_header_len = 0;
--  }
--  /* read extended header */
--  if (ext_header_len > 0) {
--    read_len = io_read (io, this->s, ext_header, ext_header_len);
--    if (read_len != ext_header_len) {
--      lprintf("mmsh: extended header read failed. %d != %d\n", read_len, ext_header_len);
--      return ERROR;
--    }
--  }
--  
--  if (this->chunk_type == CHUNK_TYPE_DATA || this->chunk_type == CHUNK_TYPE_END)
--    this->chunk_seq_number = LE_32 (&ext_header[0]);
--
--  /* display debug infos */
--#ifdef DEBUG
--  switch (this->chunk_type) {
--    case CHUNK_TYPE_DATA:
--      lprintf ("chunk type:       CHUNK_TYPE_DATA\n");
--      lprintf ("chunk length:     %d\n", this->chunk_length);
--      lprintf ("chunk seq:        %d\n", this->chunk_seq_number);
--      lprintf ("unknown:          %d\n", ext_header[4]);
--      lprintf ("mmsh seq:         %d\n", ext_header[5]);
--      lprintf ("len2:             %d\n", LE_16(&ext_header[6]));
--      break;
--    case CHUNK_TYPE_END:
--      lprintf ("chunk type:       CHUNK_TYPE_END\n");
--      lprintf ("continue: %d\n", this->chunk_seq_number);
--      break;
--    case CHUNK_TYPE_ASF_HEADER:
--      lprintf ("chunk type:       CHUNK_TYPE_ASF_HEADER\n");
--      lprintf ("chunk length:     %d\n", this->chunk_length);
--      lprintf ("unknown:          %2X %2X %2X %2X %2X %2X\n",
--               ext_header[0], ext_header[1], ext_header[2], ext_header[3],
--               ext_header[4], ext_header[5]);
--      lprintf ("len2:             %d\n", LE_16(&ext_header[6]));
--      break;
--    case CHUNK_TYPE_RESET:
--      lprintf ("chunk type:       CHUNK_TYPE_RESET\n");
--      lprintf ("chunk seq:        %d\n", this->chunk_seq_number);
--      lprintf ("unknown:          %2X %2X %2X %2X\n",
--               ext_header[0], ext_header[1], ext_header[2], ext_header[3]);
--      break;
--    default:
--      lprintf ("unknown chunk:    %4X\n", this->chunk_type);
--  }
--#endif
--
--  this->chunk_length -= ext_header_len;
--  return SUCCESS;
--}
--
--static int get_header (mms_io_t *io, mmsh_t *this) {
--  int ret, len = 0;
--
--  this->asf_header_len = 0;
--  this->asf_header_read = 0;
--  this->buf_size = 0;
--
--  /* read chunk */
--  while (1) {
--    if ((ret = get_chunk_header(io, this)) == SUCCESS) {
--      if (this->chunk_type == CHUNK_TYPE_ASF_HEADER) {
--        if ((this->asf_header_len + this->chunk_length) > ASF_HEADER_SIZE) {
--          lprintf ("mmsh: the asf header exceed %d bytes\n", ASF_HEADER_SIZE);
--          return ERROR;
--        } else {
--          len = io_read(io, this->s, this->asf_header + this->asf_header_len,
--                        this->chunk_length);
--          if (len > 0)
--            this->asf_header_len += len;
--          if (len != this->chunk_length) {
--            lprintf ("mmsh: asf header chunk read failed, %d != %d\n", len,
--                     this->chunk_length);
--            return ERROR;
--          }
--        }
--      } else {
--        break;
--      }
--    } else {
--      if (this->asf_header_len == 0 || ret != EOS)
--        lprintf("mmsh: get_header failed to get chunk header\n");
--      return ret;
--    }
--  }
--
--  if (this->chunk_type == CHUNK_TYPE_DATA) {
--    /* read the first data chunk */
--    len = io_read (io, this->s, this->buf, this->chunk_length);
--
--    if (len != this->chunk_length) {
--      lprintf ("mmsh: asf data chunk read failed, %d != %d\n", len,
--               this->chunk_length);
--      return ERROR;
--    } else {
--      /* check and 0 pad the first data chunk */
--      if (this->chunk_length > this->packet_length) {
--        lprintf ("mmsh: chunk_length(%d) > packet_length(%d)\n",
--                 this->chunk_length, this->packet_length);
--        return ERROR;
--      }
--
--      /* explicit padding with 0 */
--      if (this->chunk_length < this->packet_length)
--        memset(this->buf + this->chunk_length, 0,
--               this->packet_length - this->chunk_length);
--
--      this->buf_size = this->packet_length;
--
--      return SUCCESS;
--    }
--  } else {
--    /* unexpected packet type */
--    lprintf ("mmsh: unexpected chunk_type(0x%04x)\n", this->chunk_type);
--    return ERROR;
--  }
--}
--
--static void interp_stream_properties(mmsh_t *this, int i) {
--  uint16_t flags;
--  uint16_t stream_id;
--  int      type;
--  int      encrypted;
--  int      guid;
--
--  guid = get_guid(this->asf_header, i);
--  switch (guid) {
--    case GUID_ASF_AUDIO_MEDIA:
--      type = ASF_STREAM_TYPE_AUDIO;
--      this->has_audio = 1;
--      break;
--
--    case GUID_ASF_VIDEO_MEDIA:
--    case GUID_ASF_JFIF_MEDIA:
--    case GUID_ASF_DEGRADABLE_JPEG_MEDIA:
--      type = ASF_STREAM_TYPE_VIDEO;
--      this->has_video = 1;
--      break;
--
--    case GUID_ASF_COMMAND_MEDIA:
--      type = ASF_STREAM_TYPE_CONTROL;
--      break;
--
--    default:
--      type = ASF_STREAM_TYPE_UNKNOWN;
--  }
--
--  flags = LE_16(this->asf_header + i + 48);
--  stream_id = flags & 0x7F;
--  encrypted = flags >> 15;
--
--  lprintf("mmsh: stream object, stream id: %d, type: %d, encrypted: %d\n",
--          stream_id, type, encrypted);
--
--  if (this->num_stream_ids >= ASF_MAX_NUM_STREAMS) {
--    lprintf("mmsh: too many streams, skipping\n");
--    return;
--  }
--
--  this->streams[this->num_stream_ids].stream_type = type;
--  this->streams[this->num_stream_ids].stream_id = stream_id;
--  this->num_stream_ids++;
--}
--
--static void interp_header (mms_io_t *io, mmsh_t *this) {
--
--  int i;
--
--  this->packet_length = 0;
--  this->num_stream_ids = 0;
--  this->asf_num_packets = 0;
--
--  /*
--   * parse asf header
--   */
--
--  i = 30;
--  while ((i + 24) <= this->asf_header_len) {
--
--    int guid;
--    uint64_t length;
--
--    guid = get_guid(this->asf_header, i);
--    length = LE_64(this->asf_header + i + 16);
--
--    if ((i + length) > this->asf_header_len) return;
--
--    switch (guid) {
--
--      case GUID_ASF_FILE_PROPERTIES:
--
--        this->packet_length = LE_32(this->asf_header + i + 92);
--        if (this->packet_length > CHUNK_SIZE) {
--          this->packet_length = 0;
--          break;
--        }
--        this->file_length   = LE_64(this->asf_header + i + 40);
--        this->time_len       = LE_64(this->asf_header + i + 64);
--        //this->time_len       = LE_64(this->asf_header + i + 72);
--        this->preroll        = LE_64(this->asf_header + i + 80);
--        lprintf("mmsh: file object, packet length = %d (%d)\n",
--                this->packet_length, LE_32(this->asf_header + i + 96));
--        break;
--
--      case GUID_ASF_STREAM_PROPERTIES:
--        interp_stream_properties(this, i + 24);
--        break;
--
--      case GUID_ASF_STREAM_BITRATE_PROPERTIES:
--        {
--          uint16_t streams = LE_16(this->asf_header + i + 24);
--          uint16_t stream_id;
--          int j, stream_index;
--
--          for(j = 0; j < streams; j++) {
--            stream_id = LE_16(this->asf_header + i + 24 + 2 + j * 6);
--
--            for(stream_index = 0; stream_index < this->num_stream_ids; stream_index++) {
--              if (this->streams[stream_index].stream_id == stream_id)
--                break;
--            }
--            if (stream_index < this->num_stream_ids) {
--              this->streams[stream_index].bitrate = LE_32(this->asf_header + i + 24 + 4 + j * 6);
--              this->streams[stream_index].bitrate_pos = i + 24 + 4 + j * 6;
--              lprintf ("mmsh: stream id %d, bitrate %d\n", stream_id, 
--                       this->streams[stream_index].bitrate);
--            } else
--              lprintf ("mmsh: unknown stream id %d in bitrate properties\n",
--                       stream_id);
--          }
--        }
--        break;
--
--      case GUID_ASF_HEADER_EXTENSION:
--        {
--          if ((24 + 18 + 4) > length)
--            break;
--
--          int size = LE_32(this->asf_header + i + 24 + 18);
--          int j = 24 + 18 + 4;
--          int l;
--          lprintf("mmsh: Extension header data size: %d\n", size);
--
--          while ((j + 24) <= length) {
--            guid = get_guid(this->asf_header, i + j);
--            l = LE_64(this->asf_header + i + j + 16);
--
--            if ((j + l) > length)
--              break;
--
--            if (guid == GUID_ASF_EXTENDED_STREAM_PROPERTIES &&
--                (24 + 64) <= l) {
--                  int stream_no = LE_16(this->asf_header + i + j + 24 + 48);
--                  int name_count = LE_16(this->asf_header + i + j + 24 + 60);
--                  int ext_count = LE_16(this->asf_header + i + j + 24 + 62);
--                  int ext_j = 24 + 64;
--                  int x;
--
--                  lprintf("mmsh: l: %d\n", l);
--                  lprintf("mmsh: Stream No: %d\n", stream_no);
--                  lprintf("mmsh: ext_count: %d\n", ext_count);
--
--                  // Loop through the number of stream names
--                  for (x = 0; x < name_count && (ext_j + 4) <= l; x++) {
--                    int lang_id_index;
--                    int stream_name_len;
--
--                    lang_id_index = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += 2;
--
--                    stream_name_len = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += stream_name_len + 2;
--
--                    lprintf("mmsh: Language id index: %d\n", lang_id_index);
--                    lprintf("mmsh: Stream name Len: %d\n", stream_name_len);
--                  }
--
--                  // Loop through the number of extension system info
--                  for (x = 0; x < ext_count && (ext_j + 22) <= l; x++) {
--                    ext_j += 18;
--                    int len = LE_16(this->asf_header + i + j + ext_j);
--                    ext_j += 4 + len;
--                  }
--
--                  lprintf("mmsh: ext_j: %d\n", ext_j);
--                  // Finally, we arrive at the interesting point: The optional Stream Property Object
--                  if ((ext_j + 24) <= l) {
--                    guid = get_guid(this->asf_header, i + j + ext_j);
--                    int len = LE_64(this->asf_header + i + j + ext_j + 16);
--                    if (guid == GUID_ASF_STREAM_PROPERTIES &&
--                        (ext_j + len) <= l) {
--                      interp_stream_properties(this, i + j + ext_j + 24);
--                    }
--                  } else {
--                    lprintf("mmsh: Sorry, field not long enough\n");
--                  }
--            }
--            j += l;
--          }
--        }
--        break;
--
--      case GUID_ASF_DATA:
--        this->asf_num_packets = LE_64(this->asf_header + i + 40 - 24);
--        lprintf("mmsh: num_packets: %d\n", (int)this->asf_num_packets);
--        break;
--    }
--
--    lprintf("mmsh: length: %llu\n", (unsigned long long)length);
--    i += length;
--  }
--}
--
--const static char *const mmsh_proto_s[] = { "mms", "mmsh", NULL };
--
--static int mmsh_valid_proto (char *proto) {
--  int i = 0;
--
--  if (!proto)
--    return 0;
--
--  while(mmsh_proto_s[i]) {
--    if (!strcasecmp(proto, mmsh_proto_s[i])) {
--      return 1;
--    }
--    i++;
--  }
--  return 0;
--}
--
--/*
-- * returns 1 on error
-- */
--static int mmsh_tcp_connect(mms_io_t *io, mmsh_t *this) {
--  if (!this->connect_port) this->connect_port = MMSH_PORT;
--  
--  /* 
--   * try to connect 
--   */
--  lprintf("mmsh: try to connect to %s on port %d \n", this->connect_host, this->connect_port);
--
--  this->s = io_connect (io, this->connect_host, this->connect_port);
--
--  if (this->s == -1) {
--    lprintf("mmsh: failed to connect '%s'\n", this->connect_host);
--    return 1;
--  }
--
--  lprintf("mmsh: connected\n");
--
--  return 0;
--}
--
--static int mmsh_connect_int (mms_io_t *io, mmsh_t *this, off_t seek, uint32_t time_seek) {
--  int    i;
--  int    video_stream = -1;
--  int    audio_stream = -1;
--  int    max_arate    = -1;
--  int    min_vrate    = -1;
--  int    min_bw_left  = 0;
--  int    bandwitdh_left;
--  char   stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */
--  int    offset;
--  
--  /* Close exisiting connection (if any) and connect */
--  if (this->s != -1)
--    close(this->s);
--
--  if (mmsh_tcp_connect(io, this)) {
--    return 0;
--  }
--
--  /*
--   * let the negotiations begin...
--   */
--  this->num_stream_ids = 0;
--
--  /* first request */
--  lprintf("mmsh: first http request\n");
--  
--  snprintf (this->str, SCRATCH_SIZE, mmsh_FirstRequest, this->uri,
--            this->http_host, this->http_port, this->http_request_number++);
--
--  if (!send_command (io, this, this->str))
--    goto fail;
--
--  if (!get_answer (io, this))
--    goto fail;
--
--  /* Don't check for != SUCCESS as EOS is normal here too */    
--  if (get_header(io, this) == ERROR)
--    goto fail;
--
--  interp_header(io, this);
--  if (!this->packet_length || !this->num_stream_ids)
--    goto fail;
--  
--  close(this->s);
--  
--  /* choose the best quality for the audio stream */
--  /* i've never seen more than one audio stream */
--  for (i = 0; i < this->num_stream_ids; i++) {
--    switch (this->streams[i].stream_type) {
--      case ASF_STREAM_TYPE_AUDIO:
--        if ((audio_stream == -1) || (this->streams[i].bitrate > max_arate)) {
--          audio_stream = this->streams[i].stream_id;
--          max_arate = this->streams[i].bitrate;
--        }
--        break;
--      default:
--        break;
--    }
--  }
--
--  /* choose a video stream adapted to the user bandwidth */
--  bandwitdh_left = this->user_bandwidth - max_arate;
--  if (bandwitdh_left < 0) {
--    bandwitdh_left = 0;
--  }
--  lprintf("mmsh: bandwitdh %d, left %d\n", this->user_bandwidth, bandwitdh_left);
--
--  min_bw_left = bandwitdh_left;
--  for (i = 0; i < this->num_stream_ids; i++) {
--    switch (this->streams[i].stream_type) {
--      case ASF_STREAM_TYPE_VIDEO:
--        if (((bandwitdh_left - this->streams[i].bitrate) < min_bw_left) &&
--            (bandwitdh_left >= this->streams[i].bitrate)) {
--          video_stream = this->streams[i].stream_id;
--          min_bw_left = bandwitdh_left - this->streams[i].bitrate;
--        }
--        break;
--      default:
--        break;
--    }
--  }  
--
--  /* choose the stream with the lower bitrate */
--  if ((video_stream == -1) && this->has_video) {
--    for (i = 0; i < this->num_stream_ids; i++) {
--    switch (this->streams[i].stream_type) {
--        case ASF_STREAM_TYPE_VIDEO:
--          if ((video_stream == -1) || 
--              (this->streams[i].bitrate < min_vrate) ||
--              (!min_vrate)) {
--            video_stream = this->streams[i].stream_id;
--            min_vrate = this->streams[i].bitrate;
--          }
--          break;
--        default:
--          break;
--      }
--    }
--  }
--
--  lprintf("mmsh: audio stream %d, video stream %d\n", audio_stream, video_stream);
--  
--  /* second request */
--  lprintf("mmsh: second http request\n");
--
--  if (mmsh_tcp_connect(io, this)) {
--    return 0;
--  }
--
--  /* stream selection string */
--  /* The same selection is done with mmst */
--  /* 0 means selected */
--  /* 2 means disabled */
--  offset = 0;
--  for (i = 0; i < this->num_stream_ids; i++) {
--    int size;
--    if ((this->streams[i].stream_id == audio_stream) ||
--        (this->streams[i].stream_id == video_stream)) {
--      size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset,
--                      "ffff:%d:0 ", this->streams[i].stream_id);
--    } else {
--      lprintf("mmsh: disabling stream %d\n", this->streams[i].stream_id);
--      size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset,
--                      "ffff:%d:2 ", this->streams[i].stream_id);
--    }
--    if (size < 0) goto fail;
--    offset += size;
--  }
--
--  switch (this->stream_type) {
--    case MMSH_SEEKABLE:
--      snprintf (this->str, SCRATCH_SIZE, mmsh_SeekableRequest, this->uri,
--                this->http_host, this->http_port, time_seek,
--                (unsigned int)(seek >> 32),
--                (unsigned int)seek, this->http_request_number++, 0,
--                this->num_stream_ids, stream_selection);
--      break;
--    case MMSH_LIVE:
--      snprintf (this->str, SCRATCH_SIZE, mmsh_LiveRequest, this->uri,
--                this->http_host, this->http_port, this->http_request_number++,
--                this->num_stream_ids, stream_selection);
--      break;
--  }
--  
--  if (!send_command (io, this, this->str))
--    goto fail;
--  
--  if (!get_answer (io, this))
--    goto fail;
--
--  if (get_header(io, this) != SUCCESS)
--    goto fail;
--
--  interp_header(io, this);
--  if (!this->packet_length || !this->num_stream_ids)
--    goto fail;
--  
--  for (i = 0; i < this->num_stream_ids; i++) {
--    if ((this->streams[i].stream_id != audio_stream) &&
--        (this->streams[i].stream_id != video_stream)) {
--      lprintf("disabling stream %d\n", this->streams[i].stream_id);
--
--      /* forces the asf demuxer to not choose this stream */
--      if (this->streams[i].bitrate_pos) {
--        if (this->streams[i].bitrate_pos + 3 < ASF_HEADER_SIZE) {
--          this->asf_header[this->streams[i].bitrate_pos]     = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 1] = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 2] = 0;
--          this->asf_header[this->streams[i].bitrate_pos + 3] = 0;
--        } else {
--          lprintf("mmsh: attempt to write beyond asf header limit");
--        }
--      }
--    }
--  }
--  return 1;
--fail:
--  close(this->s);
--  this->s = -1;
--  return 0;
--}
--
--mmsh_t *mmsh_connect (mms_io_t *io, void *data, const char *url, int bandwidth) {
--  mmsh_t *this;
--  GURI  *uri = NULL;
--  GURI  *proxy_uri = NULL;
--  char  *proxy_env;
--  if (!url)
--    return NULL;
--
--  /*
--   * initializatoin is essential here.  the fail: label depends
--   * on the various char * in our this structure to be
--   * NULL if they haven't been assigned yet.
--   */
--  this = (mmsh_t*) malloc (sizeof (mmsh_t));
--  this->url=NULL;
--  this->proxy_url = NULL;
--  this->proto = NULL;
--  this->connect_host = NULL;
--  this->http_host = NULL;
--  this->proxy_user = NULL;
--  this->proxy_password = NULL;
--  this->host_user = NULL;
--  this->host_password = NULL;
--  this->uri = NULL;
--
--  this->url             = strdup(url);
--  if ((proxy_env = getenv("http_proxy")) != NULL)
--    this->proxy_url = strdup(proxy_env);
--  else
--    this->proxy_url = NULL;
--  this->s               = -1;
--  this->asf_header_len  = 0;
--  this->asf_header_read = 0;
--  this->num_stream_ids  = 0;
--  this->packet_length   = 0;
--  this->buf_size        = 0;
--  this->buf_read        = 0;
--  this->has_audio       = 0;
--  this->has_video       = 0;
--  this->current_pos     = 0;
--  this->user_bandwidth  = bandwidth;
--  this->http_request_number = 1;
--
--  if (this->proxy_url) {
--    proxy_uri = gnet_uri_new(this->proxy_url);
--    if (!proxy_uri) {
--      lprintf("mmsh: invalid proxy url\n");
--      goto fail;
--    }
--    if (! proxy_uri->port ) {
--      proxy_uri->port = 3128; //default squid port
--    }
--  }
--  uri = gnet_uri_new(this->url);
--  if (!uri) {
--    lprintf("mmsh: invalid url\n");
--    goto fail;
--  }
--  if (! uri->port ) {
--    //checked in tcp_connect, but it's better to initialize it here
--    uri->port = MMSH_PORT;
--  }
--  if (this->proxy_url) {
--    this->proto = (uri->scheme) ? strdup(uri->scheme) : NULL;
--    this->connect_host = (proxy_uri->hostname) ? strdup(proxy_uri->hostname) : NULL;
--    this->connect_port = proxy_uri->port;
--    this->http_host = (uri->scheme) ? strdup(uri->hostname) : NULL;
--    this->http_port = uri->port;
--    this->proxy_user = (proxy_uri->user) ? strdup(proxy_uri->user) : NULL;
--    this->proxy_password = (proxy_uri->passwd) ? strdup(proxy_uri->passwd) : NULL;
--    this->host_user = (uri->user) ? strdup(uri->user) : NULL;
--    this->host_password = (uri->passwd) ? strdup(uri->passwd) : NULL;
--    gnet_uri_set_scheme(uri,"http");
--    this->uri = gnet_mms_helper(uri, 1);
--  } else {
--    this->proto = (uri->scheme) ? strdup(uri->scheme) : NULL;
--    this->connect_host = (uri->hostname) ? strdup(uri->hostname) : NULL;
--    this->connect_port = uri->port;
--    this->http_host = (uri->hostname) ? strdup(uri->hostname) : NULL;
--    this->http_port = uri->port;
--    this->proxy_user = NULL;
--    this->proxy_password = NULL;
--    this->host_user =(uri->user) ?  strdup(uri->user) : NULL;
--    this->host_password = (uri->passwd) ? strdup(uri->passwd) : NULL;
--    this->uri = gnet_mms_helper(uri, 1);
--  }
--
--  if(!this->uri)
--        goto fail;
--
--  if (proxy_uri) {
--    gnet_uri_delete(proxy_uri);
--    proxy_uri = NULL;
--  }
--  if (uri) {
--    gnet_uri_delete(uri);
--    uri = NULL;
--  }
--  if (!mmsh_valid_proto(this->proto)) {
--    lprintf("mmsh: unsupported protocol\n");
--    goto fail;
--  }
--
--  if (!mmsh_connect_int(io, this, 0, 0))
--    goto fail;
--
--  return this;
--
--fail:
--  lprintf("mmsh: connect failed\n");
--  if (proxy_uri)
--    gnet_uri_delete(proxy_uri);
--  if (uri)
--    gnet_uri_delete(uri);
--  if (this->s != -1)
--    close(this->s);
--  if (this->url)
--    free(this->url);
--  if (this->proxy_url)
--    free(this->proxy_url);
--  if (this->proto)
--    free(this->proto);
--  if (this->connect_host)
--    free(this->connect_host);
--  if (this->http_host)
--    free(this->http_host);
--  if (this->proxy_user)
--    free(this->proxy_user);
--  if (this->proxy_password)
--    free(this->proxy_password);
--  if (this->host_user)
--    free(this->host_user);
--  if (this->host_password)
--    free(this->host_password);
--  if (this->uri)
--    free(this->uri);
--
--  free(this);
--  return NULL;
--}
--
--static int get_media_packet (mms_io_t *io, mmsh_t *this) {
--  int ret, len = 0;
--
--  if (get_chunk_header(io, this) == SUCCESS) {
--    switch (this->chunk_type) {
--      case CHUNK_TYPE_END:
--        /* this->chunk_seq_number:
--         *     0: stop
--         *     1: a new stream follows
--         */
--        if (this->chunk_seq_number == 0)
--          return EOS;
--
--        this->http_request_number = 1;
--        if (!mmsh_connect_int (io, this, 0, 0))
--          return ERROR;
--
--        /* What todo with: current_pos ??
--           Also our chunk_seq_numbers will probably restart from 0!
--           If this happens with a seekable stream (does it ever?)
--           and we get a seek request after this were fscked! */
--        this->seekable = 0;
--
--        /* mmsh_connect_int reads the first data packet */
--        /* this->buf_size is set by mmsh_connect_int */
--        return GOT_HEADER_N_DATA;
--
--      case CHUNK_TYPE_DATA:
--        /* nothing to do */
--        break;
--
--      case CHUNK_TYPE_RESET:
--        /* next chunk is an ASF header */
--
--        if (this->chunk_length != 0) {
--          /* that's strange, don't know what to do */
--          lprintf("mmsh: non 0 sized reset chunk");
--          return ERROR;
--        }
--        if ((ret = get_header (io, this)) != SUCCESS) {
--          lprintf("mmsh: failed to get header after reset chunk\n");
--          return ret;
--        }
--        interp_header(io, this);
--
--        /* What todo with: current_pos ??
--           Also our chunk_seq_numbers might restart from 0!
--           If this happens with a seekable stream (does it ever?) 
--           and we get a seek request after this were fscked! */
--        this->seekable = 0;
--
--        /* get_header reads the first data packet */
--        /* this->buf_size is set by get_header */
--        return GOT_HEADER_N_DATA;
--
--      default:
--        lprintf("mmsh: unexpected chunk_type(0x%04x)\n", this->chunk_type);
--        return ERROR;
--    }
--
--    len = io_read (io, this->s, this->buf, this->chunk_length);
--      
--    if (len == this->chunk_length) {
--      /* explicit padding with 0 */
--      if (this->chunk_length > this->packet_length) {
--        lprintf("mmsh: chunk_length(%d) > packet_length(%d)\n",
--                this->chunk_length, this->packet_length);
--        return ERROR;
--      }
--
--      memset(this->buf + this->chunk_length, 0,
--             this->packet_length - this->chunk_length);
--      this->buf_size = this->packet_length;
--
--      return SUCCESS;
--    } else {
--      lprintf("mmsh: media packet read error, %d != %d\n", len,
--              this->chunk_length);
--      return ERROR;
--    }
--  } else if (ret == EOS) {
--    return EOS;
--  } else {
--    lprintf("mmsh: get_media_packet failed to get chunk header\n");
--    return ret;
--  }
--}
--
--int mmsh_peek_header (mmsh_t *this, char *data, int maxsize) {
--  int len;
--
--  len = (this->asf_header_len < maxsize) ? this->asf_header_len : maxsize;
--
--  memcpy(data, this->asf_header, len);
--  return len;
--}
--
--int mmsh_read (mms_io_t *io, mmsh_t *this, char *data, int len) {
--  int total;
--
--  total = 0;
--
--  /* Check if the stream didn't get closed because of previous errors */
--  if (this->s == -1)
--    return total;
--
--  while (total < len) {
--
--    if (this->asf_header_read < this->asf_header_len) {
--      int n, bytes_left ;
--
--      bytes_left = this->asf_header_len - this->asf_header_read ;
--
--      if ((len-total) < bytes_left)
--        n = len-total;
--      else
--        n = bytes_left;
--
--      memcpy (&data[total], &this->asf_header[this->asf_header_read], n);
--
--      this->asf_header_read += n;
--      total += n;
--      this->current_pos += n;
--    } else {
--
--      int n, bytes_left ;
--
--      bytes_left = this->buf_size - this->buf_read;
--
--      if (bytes_left == 0) {
--        int ret;
--
--        this->buf_size=this ->buf_read = 0;
--        ret = get_media_packet (io, this);
--
--        switch (ret) {
--        case SUCCESS:
--          break;
--        case ERROR:
--          lprintf ("mmsh: get_media_packet failed\n");
--          return total;
--        case EOS:
--          return total;
--        case GOT_HEADER_N_DATA:
--          continue;
--        }
--        bytes_left = this->buf_size;
--      }
--
--      if ((len-total) < bytes_left)
--        n = len-total;
--      else
--        n = bytes_left;
--
--      memcpy (&data[total], &this->buf[this->buf_read], n);
--
--      this->buf_read += n;
--      total += n;
--      this->current_pos += n;
--    }
--  }
--  return total;
--}
--
--off_t mmsh_seek (mms_io_t *io, mmsh_t *this, off_t offset, int origin) {
--  off_t dest;
--  off_t dest_packet_seq;
--  uint32_t orig_asf_header_len = this->asf_header_len;
--  uint32_t orig_asf_packet_len = this->packet_length;
--  
--  if (!this->seekable)
--    return this->current_pos;
--  
--  switch (origin) {
--    case SEEK_SET:
--      dest = offset;
--      break;
--    case SEEK_CUR:
--      dest = this->current_pos + offset;
--      break;
--    case SEEK_END:
--      dest = mmsh_get_length (this) + offset;
--    default:
--      return this->current_pos;
--  }
--
--  dest_packet_seq = dest - this->asf_header_len;
--  dest_packet_seq = dest_packet_seq >= 0 ?
--    dest_packet_seq / this->packet_length : -1;
--
--  if (dest_packet_seq < 0) {
--    if (this->chunk_seq_number > 0) {
--      lprintf("mmsh: seek within header, already read beyond first packet, resetting connection\n");
--      if (!mmsh_connect_int(io, this, 0, 0)) {
--        /* Oops no more connection let our caller know things are fscked up */
--        return this->current_pos = -1;
--      }
--      /* Some what simple / naive check to check for changed headers
--         if the header was changed we are once more fscked up */
--      if (this->asf_header_len != orig_asf_header_len ||
--          this->packet_length  != orig_asf_packet_len) {
--        lprintf("mmsh: AIIEEE asf header or packet length changed on re-open for seek\n");
--        /* Its a different stream, so its useless! */
--        close (this->s);
--        this->s = -1;
--        return this->current_pos = -1;
--      }
--    } else
--      lprintf("mmsh: seek within header, resetting buf_read\n");
--
--    // reset buf_read
--    this->buf_read = 0;
--    this->asf_header_read = dest;
--    return this->current_pos = dest;
--  }
--
--  // dest_packet_seq >= 0
--  if (this->asf_num_packets && dest == this->asf_header_len +
--      this->asf_num_packets*this->packet_length) {
--    // Requesting the packet beyond the last packet, can cause the server to
--    // not return any packet or any eos command.  This can cause
--    // mms_packet_seek() to hang.
--    // This is to allow seeking at end of stream, and avoid hanging.
--    --dest_packet_seq;
--    lprintf("mmsh: seek to eos!\n");
--  }
--
--  if (dest_packet_seq != this->chunk_seq_number) {
--
--    if (this->asf_num_packets && dest_packet_seq >= this->asf_num_packets) {
--      // Do not seek beyond the last packet.
--      return this->current_pos;
--    }
--    
--    lprintf("mmsh: seek to %d, packet: %d\n", (int)dest, (int)dest_packet_seq);
--    if (!mmsh_connect_int(io, this, (dest_packet_seq+1) * this->packet_length, 0)) {
--      /* Oops no more connection let our caller know things are fscked up */
--      return this->current_pos = -1;
--    }
--    /* Some what simple / naive check to check for changed headers
--       if the header was changed we are once more fscked up */
--    if (this->asf_header_len != orig_asf_header_len ||
--        this->packet_length  != orig_asf_packet_len) {
--      lprintf("mmsh: AIIEEE asf header or packet length changed on re-open for seek\n");
--      /* Its a different stream, so its useless! */
--      close (this->s);
--      this->s = -1;
--      return this->current_pos = -1;
--    }
--  }
--  else
--    lprintf("mmsh: seek within current packet, dest: %d, current pos: %d\n",
--       (int)dest, (int)this->current_pos);
--
--  /* make sure asf_header is seen as fully read by mmsh_read() this is needed
--     in case our caller tries to seek over part of the header, or when we've
--     done an actual packet seek as get_header() resets asf_header_read then. */
--  this->asf_header_read = this->asf_header_len;
--
--  /* check we got what we want */
--  if (dest_packet_seq == this->chunk_seq_number) {
--    this->buf_read = dest -
--      (this->asf_header_len + dest_packet_seq*this->packet_length);
--    this->current_pos = dest;
--  } else {
--    lprintf("mmsh: Seek failed, wanted packet: %d, got packet: %d\n",
--      (int)dest_packet_seq, (int)this->chunk_seq_number);
--    this->buf_read = 0;
--    this->current_pos = this->asf_header_len + this->chunk_seq_number *
--      this->packet_length;
--  }
--
--  lprintf("mmsh: current_pos after seek to %d: %d (buf_read %d)\n",
--    (int)dest, (int)this->current_pos, (int)this->buf_read);
--
--  return this->current_pos;
--}
--
--int mmsh_time_seek (mms_io_t *io, mmsh_t *this, double time_sec) {
--  uint32_t orig_asf_header_len = this->asf_header_len;
--  uint32_t orig_asf_packet_len = this->packet_length;
--
--  if (!this->seekable)
--    return 0;
--
--  lprintf("mmsh: time seek to %f secs\n", time_sec);
--  if (!mmsh_connect_int(io, this, 0, time_sec * 1000 + this->preroll)) {
--    /* Oops no more connection let our caller know things are fscked up */
--    this->current_pos = -1;
--    return 0;
--  }
--  /* Some what simple / naive check to check for changed headers
--     if the header was changed we are once more fscked up */
--  if (this->asf_header_len != orig_asf_header_len ||
--      this->packet_length  != orig_asf_packet_len) {
--    lprintf("mmsh: AIIEEE asf header or packet length changed on re-open for seek\n");
--    /* Its a different stream, so its useless! */
--    close (this->s);
--    this->s = -1;
--    this->current_pos = -1;
--    return 0;
--  }
--
--  this->asf_header_read = this->asf_header_len;
--  this->buf_read = 0;
--  this->current_pos = this->asf_header_len + this->chunk_seq_number *
--    this->packet_length;
--  
--  lprintf("mmsh, current_pos after time_seek:%d\n", (int)this->current_pos);
--
--  return 1;
--}
--
--void mmsh_close (mmsh_t *this) {
--  if (this->s != -1)
--    close(this->s);
--  if (this->url)
--    free(this->url);
--  if (this->proxy_url)
--    free(this->proxy_url);
--  if (this->proto)
--    free(this->proto);
--  if (this->connect_host)
--    free(this->connect_host);
--  if (this->http_host)
--    free(this->http_host);
--  if (this->proxy_user)
--    free(this->proxy_user);
--  if (this->proxy_password)
--    free(this->proxy_password);
--  if (this->host_user)
--    free(this->host_user);
--  if (this->host_password)
--    free(this->host_password);
--  if (this->uri)
--    free(this->uri);
--  if (this)
--    free (this);
--}
--
--
--uint32_t mmsh_get_length (mmsh_t *this) {
--  /* we could / should return this->file_len here, but usually this->file_len
--     is longer then the calculation below, as usually an asf file contains an
--     asf index object after the data stream. However since we do not have a
--     (known) way to get to this index object through mms, we return a
--     calculated size of what we can get to when we know. */
--  if (this->asf_num_packets)
--    return this->asf_header_len + this->asf_num_packets*this->packet_length;
--  else
--    return this->file_length;
--}
--
--double mmsh_get_time_length (mmsh_t *this) {
--  return (double)(this->time_len) / 1e7;
--}
--
--uint64_t mmsh_get_raw_time_length (mmsh_t *this) {
--  return this->time_len;
--}
--
--off_t mmsh_get_current_pos (mmsh_t *this) {
--  return this->current_pos;
--}
--
--uint32_t mmsh_get_asf_header_len (mmsh_t *this) {
--  return this->asf_header_len;
--}
--
--uint32_t mmsh_get_asf_packet_len (mmsh_t *this) {
--  return this->packet_length;
--}
--
--int mmsh_get_seekable (mmsh_t *this) {
--  return this->seekable;
--}
-diff --git a/plugins/mms/libmms/mmsh.h b/plugins/mms/libmms/mmsh.h
-deleted file mode 100644
-index b222eea..0000000
---- a/plugins/mms/libmms/mmsh.h
-+++ /dev/null
-@@ -1,63 +0,0 @@
--/*
-- * Copyright (C) 2002-2003 the xine project
-- * 
-- * This file is part of xine, a free video player.
-- * 
-- * xine is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- * 
-- * xine is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- * 
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * $Id: mmsh.h,v 1.8 2007/12/11 20:24:48 jwrdegoede Exp $
-- *
-- * libmmsh public header
-- */
--
--#ifndef HAVE_MMSH_H
--#define HAVE_MMSH_H
--
--#include <inttypes.h>
--#include <stdio.h>
--#include <sys/types.h>
--#include "mmsio.h"
--
--#ifdef __cplusplus
--extern "C" {
--#endif /* __cplusplus */
--
--typedef struct mmsh_s mmsh_t;
--
--char*    mmsh_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file);
--mmsh_t*   mmsh_connect (mms_io_t *io, void *data, const char *url_, int bandwidth);
--
--int      mmsh_read (mms_io_t *io, mmsh_t *instance, char *data, int len);
--int      mmsh_time_seek (mms_io_t *io, mmsh_t *instance, double time_sec);
--mms_off_t mmsh_seek (mms_io_t *io, mmsh_t *instance, mms_off_t offset, int origin);
--uint32_t mmsh_get_length (mmsh_t *instance);
--double   mmsh_get_time_length (mmsh_t *instance);
--uint64_t mmsh_get_raw_time_length (mmsh_t *instance);
--mms_off_t mmsh_get_current_pos (mmsh_t *instance);
--void     mmsh_close (mmsh_t *instance);
--
--int      mmsh_peek_header (mmsh_t *instance, char *data, int maxsize);
--
--uint32_t mmsh_get_asf_header_len (mmsh_t *instance);
--
--uint32_t mmsh_get_asf_packet_len (mmsh_t *instance);
--
--int      mmsh_get_seekable (mmsh_t *instance);
--
--#ifdef __cplusplus
--}
--#endif /* __cplusplus */
--
--#endif
-diff --git a/plugins/mms/libmms/mmsio.h b/plugins/mms/libmms/mmsio.h
-deleted file mode 100644
-index 8e4304d..0000000
---- a/plugins/mms/libmms/mmsio.h
-+++ /dev/null
-@@ -1,93 +0,0 @@
--#ifndef __MMS_IO_H__
--#define __MMS_IO_H__
--
--#define LIBMMS_HAVE_64BIT_OFF_T 1
--
--/* On 64 bit file offset capable systems, libmms' configure script adds
--   -D_FILE_OFFSET_BITS=64 to the CFLAGS. This causes off_t to be 64 bit,
--   When an app which includes this header file gets compiled without
--   -D_FILE_OFFSET_BITS=64, it should still expect / pass 64 bit ints for
--   off_t, this acomplishes this: */
--#if defined LIBMMS_HAVE_64BIT_OFF_T && !defined __MMS_C__
--#define mms_off_t int64_t
--#else
--#define mms_off_t off_t
--#endif
--
--#ifdef __cplusplus
--extern "C" {
--#endif /* __cplusplus */
--
--typedef mms_off_t (*mms_io_write_func)(void *data, int socket, char *buf, mms_off_t num);
--typedef mms_off_t (*mms_io_read_func)(void *data, int socket, char *buf, mms_off_t num);
--
--/* select states */
--#define MMS_IO_READ_READY    1
--#define MMS_IO_WRITE_READY   2
--
--enum
--  {
--    MMS_IO_STATUS_READY, 		/* IO can be safely performed */
--    MMS_IO_STATUS_ERROR,		/* There was IO error */
--    MMS_IO_STATUS_ABORTED,		/* IO command was (somehow)
--	   aborted. This is not error, but invalidates IO for further operations*/
--    MMS_IO_STATUS_TIMEOUT		/* Timeout was exceeded */
--  };
--
--/*
-- * Waits for a file descriptor/socket to change status.
-- *
-- * users can use this handler to provide their own implementations,
-- * for example abortable ones
-- *
-- * params :
-- *   data          whatever parameter may be needed by implementation
-- *   fd            file/socket descriptor
-- *   state         MMS_IO_READ_READY, MMS_IO_WRITE_READY
-- *   timeout_sec   timeout in seconds
-- *
-- *
-- * return value :
-- *   MMS_IO_READY     the file descriptor is ready for cmd
-- *   MMS_IO_ERROR     an i/o error occured
-- *   MMS_IO_ABORTED   command aborted
-- *   MMS_IO_TIMEOUT   the file descriptor is not ready after timeout_msec milliseconds
-- * every other return value is interpreted same as MMS_IO_ABORTED
-- */
--typedef int (*mms_io_select_func)(void *data, int fd, int state, int timeout_msec);
--
--/*
-- * open a tcp connection
-- *
-- * params :
-- *   stream        needed for reporting errors but may be NULL
-- *   host          address of target
-- *   port          port on target
-- *
-- * returns a socket descriptor or -1 if an error occured
-- */
--typedef int (*mms_io_tcp_connect_func)(void *data, const char *host, int port);
--
--typedef struct
--{
--  mms_io_select_func select;
--  void *select_data;
--  mms_io_read_func read;
--  void *read_data;
--  mms_io_write_func write;
--  void *write_data;
--  mms_io_tcp_connect_func connect;
--  void *connect_data;
--} mms_io_t;
--
--/* set default IO implementation, it will be used in absence of specific IO
--   parameter. Structure is referenced, not copied, must remain valid for entire
--   usage period. Passing NULL reverts to default, POSIX based implementation */
--void mms_set_default_io_impl(const mms_io_t *io);
--const mms_io_t* mms_get_default_io_impl();
--
--#ifdef __cplusplus
--}
--#endif /* __cplusplus */
--
--#endif /* __MMS_IO_H__ */
-diff --git a/plugins/mms/libmms/mmsx.c b/plugins/mms/libmms/mmsx.c
-deleted file mode 100644
-index fc95de8..0000000
---- a/plugins/mms/libmms/mmsx.c
-+++ /dev/null
-@@ -1,168 +0,0 @@
--/*
-- * Copyright (C) 2007 Hans de Goede <j.w.r.degoede at hhs.nl>
-- *
-- * This file is part of libmms a free mms protocol library
-- *
-- * libmms is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU Library General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * libmss is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- */
--
--/*
-- * mmsx is a small wrapper around the mms and mmsh protocol implementations
-- * in libmms. The mmsx functions provide transparent access to both protocols
-- * so that programs who wish to support both can do so with a single code path
-- * if desired.
-- */
--
--#include <stdlib.h>
--#include "mmsx.h"
--#include "mms.h"
--#include "mmsh.h"
--
--struct mmsx_s {
--  mms_t *connection;
--  mmsh_t *connection_h;
--};
--
--mmsx_t *mmsx_connect(mms_io_t *io, void *data, const char *url, int bandwidth)
--{
--  mmsx_t *mmsx = calloc(1, sizeof(mmsx_t));
--  char *try_mms_first = getenv("LIBMMS_TRY_MMS_FIRST");
--  
--  if (!mmsx)
--    return mmsx;
--
--  /* Normally we try mmsh first, as mms: is a rollover protocol identifier
--     according to microsoft and recent mediaplayer versions will try
--     mmsh before mms for mms:// uris. Note that in case of a mmst:// or a
--     mmsh:// url the mms[h]_connect function will directly exit if it cannot
--     handle it. The LIBMMS_TRY_MMS_FIRST environment variable is there for
--     testing the mms code against servers which accept both mmsh and mms. */
--  if (try_mms_first, 1) {
--    mmsx->connection = mms_connect(io, data, url, bandwidth);
--    if (mmsx->connection)
--      return mmsx;
--  }
--
--  mmsx->connection_h = mmsh_connect(io, data, url, bandwidth);
--  if (mmsx->connection_h)
--    return mmsx;
--
--  if (!try_mms_first, 0) {
--    mmsx->connection = mms_connect(io, data, url, bandwidth);
--    if (mmsx->connection)
--      return mmsx;
--  }
--
--  free(mmsx);
--  return NULL;
--}
--
--int mmsx_read (mms_io_t *io, mmsx_t *mmsx, char *data, int len)
--{
--  if(mmsx->connection)
--    return mms_read(io, mmsx->connection, data, len);
--  else
--    return mmsh_read(io, mmsx->connection_h, data, len);
--}
--
--int mmsx_time_seek (mms_io_t *io, mmsx_t *mmsx, double time_sec)
--{
--  if(mmsx->connection)
--    return mms_time_seek(io, mmsx->connection, time_sec);
--  else
--    return mmsh_time_seek(io, mmsx->connection_h, time_sec);
--}
--
--mms_off_t mmsx_seek (mms_io_t *io, mmsx_t *mmsx, mms_off_t offset, int origin)
--{
--  if(mmsx->connection)
--    return mms_seek(io, mmsx->connection, offset, origin);
--  else
--    return mmsh_seek(io, mmsx->connection_h, offset, origin);
--}
--
--double mmsx_get_time_length (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_time_length(mmsx->connection);
--  else
--    return mmsh_get_time_length(mmsx->connection_h);
--}
--
--uint64_t mmsx_get_raw_time_length (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_raw_time_length(mmsx->connection);
--  else
--    return mmsh_get_raw_time_length(mmsx->connection_h);
--}
--
--uint32_t mmsx_get_length (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_length(mmsx->connection);
--  else
--    return mmsh_get_length(mmsx->connection_h);
--}
--
--void mmsx_close (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    mms_close(mmsx->connection);
--  else
--    mmsh_close(mmsx->connection_h);
--
--  free(mmsx);
--}
--
--int mmsx_peek_header (mmsx_t *mmsx, char *data, int maxsize)
--{
--  if(mmsx->connection)
--    return mms_peek_header(mmsx->connection, data, maxsize);
--  else
--    return mmsh_peek_header(mmsx->connection_h, data, maxsize);
--}
--
--mms_off_t mmsx_get_current_pos (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_current_pos(mmsx->connection);
--  else
--    return mmsh_get_current_pos(mmsx->connection_h);
--}
--
--uint32_t mmsx_get_asf_header_len(mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_asf_header_len(mmsx->connection);
--  else
--    return mmsh_get_asf_header_len(mmsx->connection_h);
--}
--
--uint64_t mmsx_get_asf_packet_len (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_asf_packet_len(mmsx->connection);
--  else
--    return mmsh_get_asf_packet_len(mmsx->connection_h);
--}
--
--int mmsx_get_seekable (mmsx_t *mmsx)
--{
--  if(mmsx->connection)
--    return mms_get_seekable(mmsx->connection);
--  else
--    return mmsh_get_seekable(mmsx->connection_h);
--}
-diff --git a/plugins/mms/libmms/mmsx.h b/plugins/mms/libmms/mmsx.h
-deleted file mode 100644
-index df4adfc..0000000
---- a/plugins/mms/libmms/mmsx.h
-+++ /dev/null
-@@ -1,69 +0,0 @@
--/*
-- * Copyright (C) 2007 Hans de Goede <j.w.r.degoede at hhs.nl>
-- *
-- * This file is part of libmms a free mms protocol library
-- *
-- * libmms is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU Library General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * libmss is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-- *
-- * libmms public header
-- */
--
--/*
-- * mmsx is a small wrapper around the mms and mmsh protocol implementations
-- * in libmms. The mmsx functions provide transparent access to both protocols
-- * so that programs who wish to support both can do so with a single code path
-- * if desired.
-- */
-- 
--#ifndef HAVE_MMSX_H
--#define HAVE_MMSX_H
--
--#include <inttypes.h>
--#include "mmsio.h"
--
--#ifdef __cplusplus
--extern "C" {
--#endif /* __cplusplus */
--
--typedef struct mmsx_s mmsx_t;
--
--mmsx_t*   mmsx_connect (mms_io_t *io, void *data, const char *url, int bandwidth);
--
--int       mmsx_read (mms_io_t *io, mmsx_t *instance, char *data, int len);
--int       mmsx_time_seek (mms_io_t *io, mmsx_t *instance, double time_sec);
--mms_off_t mmsx_seek (mms_io_t *io, mmsx_t *instance, mms_off_t offset, int origin);
--/* return total playback time in seconds */
--double    mmsx_get_time_length (mmsx_t *instance);
--/* return raw total playback time in 100 nanosecs (10^-7) */
--uint64_t  mmsx_get_raw_time_length (mmsx_t *instance);
--uint32_t  mmsx_get_length (mmsx_t *instance);
--void      mmsx_close (mmsx_t *instance);
--
--int       mmsx_peek_header (mmsx_t *instance, char *data, int maxsize);
--
--mms_off_t mmsx_get_current_pos (mmsx_t *instance);
--
--uint32_t  mmsx_get_asf_header_len (mmsx_t *instance);
--
--uint64_t  mmsx_get_asf_packet_len (mmsx_t *instance);
--
--int       mmsx_get_seekable (mmsx_t *instance);
--
--#ifdef __cplusplus
--}
--#endif /* __cplusplus */
--
--#endif
-- 
-diff --git a/plugins/mms/libmms/uri.c b/plugins/mms/libmms/uri.c
-deleted file mode 100644
-index 6b6475e..0000000
---- a/plugins/mms/libmms/uri.c
-+++ /dev/null
-@@ -1,1033 +0,0 @@
--/* GNet - Networking library
-- * Copyright (C) 2000-2003  David Helder, David Bolcsfoldi, Eric Williams
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the 
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA  02111-1307, USA.
-- */
--
--/* FIXME: #include "gnet-private.h" */
--#include <string.h>
--#include <stdlib.h>
--#include <ctype.h>
--#include <stdio.h>
--
--#include "uri.h"
--#include <string.h>
--
--static void   field_unescape (char *str);
--static char* field_escape (char* str, unsigned char mask);
--
--#define USERINFO_ESCAPE_MASK	0x01
--#define PATH_ESCAPE_MASK	0x02
--#define QUERY_ESCAPE_MASK	0x04
--#define FRAGMENT_ESCAPE_MASK	0x08
--
--/* #define FALSE 0 */
--/* #define TRUE  (!FALSE) */
--
--static unsigned char neednt_escape_table[] = 
--{
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x0f, 0x00, 0x0c, 
--  0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x00, 0x0f, 0x00, 0x00, 0x0f, 
--  0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 
--  0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
--  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
--};
--
--
--/*
--Perl code to generate above table:
--
--#!/usr/bin/perl
--
--$ok = "abcdefghijklmnopqrstuvwxyz" . 
--      "ABCDEFGHIJKLMNOPQRSTUVWXYZ" .
--      "0123456789" .
--      "-_.!~*'()";
--$userinfo_ok = ';:&=+\$,';
--$path_ok     = ':\@&=+\$,;/';
--$query_ok    = ';/?:\@&=+\$,';
--$fragment_ok = ';/?:\@&=+\$,';
--
--for ($i = 0; $i < 32; $i++)
--{
--    print "  ";
--    for ($j = 0; $j < 8; $j++)
--    {
--	$num = 0;
--	$letter = chr(($i * 8) + $j);
--
--	$num |= 0b0001  if (index($userinfo_ok, $letter) != -1);
--	$num |= 0b0010  if (index($path_ok,     $letter) != -1);
--	$num |= 0b0100  if (index($query_ok,    $letter) != -1);
--	$num |= 0b1000  if (index($fragment_ok, $letter) != -1);
--	$num |= 0b1111  if (index($ok,          $letter) != -1);
--
--	printf "0x%02x, ", $num;
--    }
--    print "\n";
--}
--*/
--
--
--/* our own ISSPACE.  ANSI isspace is local dependent */
--#define ISSPACE(C) (((C) >= 9 && (C) <= 13) || (C) == ' ')
--
--
--static int split_user_passwd(const char* in, char** user, char** passwd)
--{
--  char *tmp = strdup(in);
--
--  if(!tmp)
--    return 0;
--  *passwd = strchr(tmp, ':');
--  if(!(*passwd))
--  {
--    free(tmp);
--    return 0;
--  }
--  *((*passwd)++) = '\0'; // don't you love C? :)
--
--  *user = strdup(tmp);
--  if(!*user)
--    return 0;
--  *passwd = strdup(*passwd);
--  if(!*passwd)
--    return 0;
--
--  free(tmp);
--  return 1;
--}
--
--/**
-- *  gnet_uri_new
-- *  @uri: URI string
-- *
-- *  Creates a #GURI from a string.  Empty fields are set to NULL.  The
-- *  parser does not validate the URI -- it will accept some malformed
-- *  URI.  URIs are usually in the form
-- *  scheme://userinfo@hostname:port/path?query#fragment
-- *
-- *  URIs created from user input are typically unescaped.  URIs
-- *  created from machine input (e.g. received over the internet) are
-- *  typically escaped.
-- *  
-- *  Returns: a new #GURI, or NULL if there was a failure.
-- *
-- **/
--GURI* 
--gnet_uri_new (const char* uri)
--{
--  GURI* guri = NULL;
--  const char* p;
--  const char* temp;
--
--  if (!uri) {
--      return NULL;
--  }
--
--  /* Skip initial whitespace */
--  p = uri;
--  while (*p && ISSPACE((int)*p))
--    ++p;
--  if (!*p)        /* Error if it's just a string of space */
--    return NULL;
--
--  guri = malloc (sizeof (GURI));
--  memset (guri, 0, sizeof (GURI));
--
--  /* Scheme */
--  temp = p;
--  while (*p && *p != ':' && *p != '/' && *p != '?' && *p != '#')
--    ++p;
--  if (*p == ':')
--    {
--      guri->scheme = strndup (temp, p - temp);
--      ++p;
--    }
--  else        /* This char is NUL, /, ?, or # */
--    p = temp;
--
--  /* Authority */
--  if (*p == '/' && p[1] == '/')
--    {
--      char *userinfo;
--      p += 2;
--
--      /* Userinfo */
--      temp = p;
--      while (*p && *p != '@' && *p != '/' ) /* Look for @ or / */
--        ++p;
--      if (*p == '@') /* Found userinfo */
--        {
--          userinfo = strndup (temp, p - temp);
--          if(!split_user_passwd(userinfo, &guri->user, &guri->passwd))
--          {
--            free(userinfo);
--            goto error;
--          }
--          free(userinfo);
--          ++p;
--        }
--      else
--        p = temp;
--
--      /* Hostname */
--
--      /* Check for IPv6 canonical hostname in brackets */
--      if (*p == '[')
--        {
--          p++;  /* Skip [ */
--          temp = p;
--          while (*p && *p != ']') ++p;
--          if ((p - temp) == 0)
--            goto error;
--          guri->hostname = strndup (temp, p - temp);
--          if (*p)
--            p++;        /* Skip ] (if there) */
--        }
--      else
--        {
--          temp = p;
--          while (*p && *p != '/' && *p != '?' && *p != '#' && *p != ':') ++p;
--          if ((p - temp) == 0) 
--            goto error;
--          guri->hostname = strndup (temp, p - temp);
--        }
--
--      /* Port */
--      if (*p == ':')
--        {
--          for (++p; isdigit((int)*p); ++p)
--            guri->port = guri->port * 10 + (*p - '0');
--        }
--
--    }
--
--  /* Path (we are liberal and won't check if it starts with /) */
--  temp = p;
--  while (*p && *p != '?' && *p != '#')
--    ++p;
--  if (p != temp)
--    guri->path = strndup(temp, p - temp);
--
--  /* Query */
--  if (*p == '?')
--    {
--      temp = p + 1;
--      while (*p && *p != '#')
--        ++p;
--      guri->query = strndup (temp, p - temp);
--    }
--
--  /* Fragment */
--  if (*p == '#')
--    {
--      ++p;
--      guri->fragment = strdup (p);
--    }
--
--  return guri;
--
-- error:
--  gnet_uri_delete (guri);
--  return NULL;
--}
--
--
--/**
-- *  gnet_uri_new_fields
-- *  @scheme: scheme
-- *  @hostname: host name
-- *  @port: port
-- *  @path: path
-- *
-- *  Creates a #GURI from the fields.  This function uses the most
-- *  common fields.  Use gnet_uri_new_fields_all() to specify all
-- *  fields.
-- *
-- *  Returns: a new #GURI.
-- *
-- **/
--GURI*     
--gnet_uri_new_fields (const char* scheme, const char* hostname, 
--                     const int port, const char* path)
--{
--  GURI* uri = NULL;
--
--  uri = malloc (sizeof (GURI));
--  memset (uri, 0, sizeof (GURI));
--  if (scheme)		uri->scheme = strdup (scheme);
--  if (hostname)		uri->hostname = strdup (hostname);
--  uri->port = port;
--  if (path)		uri->path = strdup (path);
--
--  return uri;
--}
--
--
--/**
-- *  gnet_uri_new_fields_all
-- *  @scheme: scheme
-- *  @userinfo: user info
-- *  @hostname: host name
-- *  @port: port
-- *  @path: path
-- *  @query: query
-- *  @fragment: fragment
-- *
-- *  Creates a #GURI from all fields.
-- *
-- *  Returns: a new #GURI.
-- *
-- **/
--GURI*
--gnet_uri_new_fields_all (const char* scheme, const char* user, 
--                         const char* passwd, const char* hostname,
--                         const int port, const char* path, 
--                         const char* query, const char* fragment)
--{
--  GURI* uri = NULL;
--
--  uri = malloc (sizeof (GURI));
--  memset (uri, 0, sizeof (GURI));
--  if (scheme)		uri->scheme   = strdup (scheme);
--  if (user)		uri->user     = strdup (user);
--  if (passwd)		uri->passwd   = strdup (passwd);
--  if (hostname)		uri->hostname = strdup (hostname);
--  uri->port = port;
--  if (path)		uri->path     = strdup (path);
--  if (query)		uri->query    = strdup (query);
--  if (fragment)		uri->fragment = strdup (fragment);
--
--  return uri;
--}
--
--
--/**
-- *  gnet_uri_clone:
-- *  @uri: a #GURI
-- * 
-- *  Copies a #GURI.
-- *
-- *  Returns: a copy of @uri.
-- *
-- **/
--GURI*     
--gnet_uri_clone (const GURI* uri)
--{
--  GURI* uri2;
--
--  if (!uri) {
--      return NULL;
--  }
--
--  uri2 = malloc (sizeof (GURI));
--  memset (uri2, 0, sizeof (GURI));
--  uri2->scheme   = strdup (uri->scheme);
--  uri2->user     = strdup (uri->user);
--  uri2->passwd   = strdup (uri->passwd);
--  uri2->hostname = strdup (uri->hostname);
--  uri2->port     = uri->port;
--  uri2->path 	 = strdup (uri->path);
--  uri2->query    = strdup (uri->query);
--  uri2->fragment = strdup (uri->fragment);
--
--  return uri2;
--}
--
--
--/** 
-- *  gnet_uri_delete:
-- *  @uri: a #GURI
-- *
-- *  Deletes a #GURI.
-- *
-- **/
--void
--gnet_uri_delete (GURI* uri)
--{
--  if (uri)
--    {
--      free (uri->scheme);
--      free (uri->user);
--      free (uri->passwd);
--      free (uri->hostname);
--      free (uri->path);
--      free (uri->query);
--      free (uri->fragment);
--      free (uri);
--    }
--}
--
--
--
--
--#define SAFESTRCMP(A,B) (((A)&&(B))?(strcmp((A),(B))):((A)||(B)))
--
--/**
-- *  gnet_uri_equal
-- *  @p1: a #GURI
-- *  @p2: another #GURI
-- *
-- *  Compares two #GURI's for equality.
-- *
-- *  Returns: TRUE if they are equal; FALSE otherwise.
-- *
-- **/
--int
--gnet_uri_equal (const char * p1, const char * p2)
--{
--  const GURI* uri1 = (const GURI*) p1;
--  const GURI* uri2 = (const GURI*) p2;
--
--  if (!uri1) {
--      return 0;
--  }
--  if (!uri2) {
--      return 0;
--  }
--
--  if (uri1->port == uri2->port &&
--      !SAFESTRCMP(uri1->scheme, uri2->scheme) &&
--      !SAFESTRCMP(uri1->user, uri2->user) &&
--      !SAFESTRCMP(uri1->passwd, uri2->passwd) &&
--      !SAFESTRCMP(uri1->hostname, uri2->hostname) &&
--      !SAFESTRCMP(uri1->path, uri2->path) &&
--      !SAFESTRCMP(uri1->query, uri2->query) &&
--      !SAFESTRCMP(uri1->fragment, uri2->fragment))
--    return 1;
--
--  return 0;
--}
--
--
--/**
-- *  gnet_uri_hash
-- *  @p: a #GURI
-- *
-- *  Creates a hash code for @p for use with GHashTable. 
-- *
-- *  Returns: hash code for @p.
-- *
-- **/
--#if 0
--unsigned int
--gnet_uri_hash (const char * p)
--{
--  const GURI* uri = (const GURI*) p;
--  unsigned int h = 0;
--
--  if (!uri) {
--      return 0;
--  }
--
--  if (uri->scheme)	h =  g_str_hash (uri->scheme);
--  if (uri->user)	h ^= g_str_hash (uri->user);
--  if (uri->passwd)	h ^= g_str_hash (uri->passwd);
--  if (uri->hostname)	h ^= g_str_hash (uri->hostname);
--  h ^= uri->port;
--  if (uri->path)	h ^= g_str_hash (uri->path);
--  if (uri->query)	h ^= g_str_hash (uri->query);
--  if (uri->fragment)	h ^= g_str_hash (uri->fragment);
--  
--  return h;
--}
--#endif
--
--
--/**
-- *  gnet_uri_escape
-- *  @uri: a #GURI
-- *
-- *  Escapes the fields in a #GURI.  Network protocols use escaped
-- *  URIs.  People use unescaped URIs.
-- *
-- **/
--void
--gnet_uri_escape (GURI* uri)
--{
--  if (!uri) {
--      return;
--  }
--  
--  uri->user = field_escape (uri->user, USERINFO_ESCAPE_MASK);
--  uri->passwd = field_escape (uri->passwd, USERINFO_ESCAPE_MASK);
--  uri->path     = field_escape (uri->path,     PATH_ESCAPE_MASK);
--  uri->query    = field_escape (uri->query,    QUERY_ESCAPE_MASK);
--  uri->fragment = field_escape (uri->fragment, FRAGMENT_ESCAPE_MASK);
--}
--
--
--/**
-- *  gnet_uri_unescape
-- *  @uri: a #GURI
-- *
-- *  Unescapes the fields in the URI.  Network protocols use escaped
-- *  URIs.  People use unescaped URIs.
-- *
-- **/
--void
--gnet_uri_unescape (GURI* uri)
--{
--  if (!uri) {
--      return;
--  }
--
--  if (uri->user)
--    field_unescape (uri->user);
--  if (uri->passwd)
--    field_unescape (uri->passwd);
--  if (uri->path)
--    field_unescape (uri->path);
--  if (uri->query)
--    field_unescape (uri->query);
--  if (uri->fragment)
--    field_unescape (uri->fragment);
--}
--
--
--static char*
--field_escape (char* str, unsigned char mask)
--{
--  int len;
--  int i;
--  int must_escape = 0;
--  char* dst;
--  int j;
--
--  if (str == NULL)
--    return NULL;
--
--  /* Roughly calculate buffer size */
--  len = 0;
--  for (i = 0; str[i]; i++)
--    {
--      if (neednt_escape_table[(unsigned int) str[i]] & mask)
--        len++;
--      else
--        {
--          len += 3;
--          must_escape = 1;
--        }
--    }
--
--  /* Don't escape if unnecessary */
--  if (must_escape == 0)
--    return str;
--
--  /* Allocate buffer */
--  dst = (char*) malloc(len + 1);
--  memset (dst, 0, len+1);
--
--  /* Copy */
--  for (i = j = 0; str[i]; i++, j++)
--    {
--      /* Unescaped character */
--      if (neednt_escape_table[(unsigned int) str[i]] & mask)
--        {
--          dst[j] = str[i];
--        }
--
--      /* Escaped character */
--      else
--        {
--          dst[j] = '%';
--
--          if (((str[i] & 0xf0) >> 4) < 10)
--            dst[j+1] = ((str[i] & 0xf0) >> 4) + '0';
--          else
--            dst[j+1] = ((str[i] & 0xf0) >> 4) + 'a' - 10;
--
--          if ((str[i] & 0x0f) < 10)
--            dst[j+2] = (str[i] & 0x0f) + '0';
--          else
--            dst[j+2] = (str[i] & 0x0f) + 'a' - 10;
--
--          j += 2;  /* and j is incremented in loop too */
--        }
--    }
--  dst[j] = '\0';
--
--  free (str);
--  return dst;
--}
--
--
--
--static void
--field_unescape (char* s)
--{
--  char* src;
--  char* dst;
--
--  for (src = dst = s; *src; ++src, ++dst)
--    {
--      if (src[0] == '%' && src[1] != '\0' && src[2] != '\0')
--        {
--          int high, low;
--
--          if ('a' <= src[1] && src[1] <= 'f')
--            high = src[1] - 'a' + 10;
--          else if ('A' <= src[1] && src[1] <= 'F')
--            high = src[1] - 'A' + 10;
--          else if ('0' <= src[1] && src[1] <= '9')
--            high = src[1] - '0';
--          else  /* malformed */
--            goto regular_copy;
--
--          if ('a' <= src[2] && src[2] <= 'f')
--            low = src[2] - 'a' + 10;
--          else if ('A' <= src[2] && src[2] <= 'F')
--            low = src[2] - 'A' + 10;
--          else if ('0' <= src[2] && src[2] <= '9')
--            low = src[2] - '0';
--          else  /* malformed */
--            goto regular_copy;
--
--          *dst = (char)((high << 4) + low);
--          src += 2;
--        }
--      else
--        {
--        regular_copy:
--          *dst = *src;
--        }
--    }
--
--  *dst = '\0';
--}
--
--
--
--/**
-- *  gnet_uri_get_string
-- *  @uri: a #GURI
-- *
-- *  Gets a string representation of a #GURI.  This function does not
-- *  escape or unescape the fields first.  Call gnet_uri_escape() or
-- *  gnet_uri_unescape first if necessary.
-- *
-- *  Returns: a string.
-- *
-- **/
--char*
--gnet_uri_get_string (const GURI* uri)
--{
--  char* rv = NULL;
--  char *buffer = malloc (1024);
--  memset (buffer, 0, 1024);
--  char *b = buffer;
--  int remaining = 1024;
--  
--  if (!uri) {
--      return NULL;
--  }
--
--  if (uri->scheme) {
--      int n = snprintf (buffer, n, "%s:", uri->scheme);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--  }
--
--  if (uri->user || uri->passwd || uri->hostname || uri->port) {
--      strcpy (buffer, "//");
--      buffer += 2;
--      remaining -= 2;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--  }
--
--  if (uri->user)
--    {
--      int n = strlen (uri->user);
--      memcpy (buffer, uri->user, n+1);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--      strcpy (buffer, "@");
--      buffer += 1;
--      remaining -= 1;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--    }
--  if (uri->passwd)
--    {
--      int n = strlen (uri->passwd);
--      memcpy (buffer, uri->passwd, n+1);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--      strcpy (buffer, "@");
--      buffer += 1;
--      remaining -= 1;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--    }
--
--  /* Add brackets around the hostname if it's IPv6 */
--  if (uri->hostname)
--    {
--      if (strchr(uri->hostname, ':') == NULL) {
--          int n = strlen (uri->hostname);
--          memcpy (buffer, uri->hostname, n+1);
--          buffer += n;
--          remaining -= n;
--          if (remaining < 10) {
--              free (buffer);
--              return NULL;
--          }
--      }
--      else {
--          int n = snprintf (buffer, remaining, "[%s]", uri->hostname);
--          buffer += n;
--          remaining -= n;
--          if (remaining < 10) {
--              free (buffer);
--              return NULL;
--          }
--      }
--    }
--
--  if (uri->port) {
--      int n = snprintf (buffer, remaining, ":%d", uri->port);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--  }
--
--  if (uri->path)
--    {
--      if (*uri->path == '/' ||
--          !(uri->user || uri->passwd || uri->hostname || uri->port)) {
--          int n = strlen (uri->path);
--          memcpy (buffer, uri->path, n+1);
--          buffer += n;
--          remaining -= n;
--          if (remaining < 10) {
--              free (buffer);
--              return NULL;
--          }
--      }
--      else {
--          int n = snprintf (buffer, remaining, "/%s", uri->path);
--          buffer += n;
--          remaining -= n;
--          if (remaining < 10) {
--              free (buffer);
--              return NULL;
--          }
--      }
--    }
--
--  if (uri->query) {
--      int n = snprintf (buffer, remaining, "?%s", uri->query);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--  }
--
--  if (uri->fragment) {
--      int n = snprintf (buffer, remaining, "#%s", uri->fragment);
--      buffer += n;
--      remaining -= n;
--      if (remaining < 10) {
--          free (buffer);
--          return NULL;
--      }
--  }
--  
--  /* Free only GString not data contained, return the data instead */
--  return b;
--}
--
--
--/**
-- *  gnet_uri_set_scheme
-- *  @uri: a #GURI
-- *  @scheme: scheme
-- *
-- *  Sets a #GURI's scheme.
-- *
-- **/
--void
--gnet_uri_set_scheme (GURI* uri, const char* scheme)
--{
--  if (!uri) {
--      return;
--  }
--
--  if (uri->scheme)
--    {
--      free (uri->scheme);
--      uri->scheme = NULL;
--    }
--
--  if (scheme)
--    uri->scheme = strdup (scheme);
--}
--
--
--/**
-- *  gnet_uri_set_userinfo
-- *  @uri: a #GURI
-- *  @userinfo: user info
-- *
-- *  Sets a #GURI's user info.
-- *
-- **/
--void
--gnet_uri_set_userinfo (GURI* uri, const char* user, const char* passwd)
--{
--  if (!uri) {
--      return;
--  }
--
--  if (uri->user)
--    {
--      free (uri->user);
--      uri->user = NULL;
--    }
--  if (uri->passwd)
--    {
--      free (uri->passwd);
--      uri->passwd = NULL;
--    }
--
--  if (user)
--    uri->user = strdup (user);
--  if (passwd)
--    uri->passwd = strdup (passwd);
--}
--
--
--/**
-- *  gnet_uri_set_hostname
-- *  @uri: a #GURI
-- *  @hostname: host name
-- *
-- *  Sets a #GURI's host name.
-- *
-- **/
--void
--gnet_uri_set_hostname (GURI* uri, const char* hostname)
--{
--  if (!uri) {
--    return;
--  }
--
--  if (uri->hostname)
--    {
--      free (uri->hostname);
--      uri->hostname = NULL;
--    }
--
--  if (hostname)
--    uri->hostname = strdup (hostname);
--}
--
--
--/**
-- *  gnet_uri_set_port
-- *  @uri: a #GURI
-- *  @port: port
-- *
-- *  Set a #GURI's port.
-- *
-- **/
--void
--gnet_uri_set_port (GURI* uri, int port)
--{
--  uri->port = port;
--}
--
--
--/**
-- *  gnet_uri_set_path
-- *  @uri: a #GURI
-- *  @path: path
-- *
-- *  Set a #GURI's path.
-- *
-- **/
--void
--gnet_uri_set_path (GURI* uri, const char* path)
--{
--  if (!uri) {
--      return;
--  }
--
--  if (uri->path)
--    {
--      free (uri->path);
--      uri->path = NULL;
--    }
--
--  if (path)
--    uri->path = strdup (path);
--}
--
--
--
--/**
-- *  gnet_uri_set_query
-- *  @uri: a #GURI
-- *  @query: query
-- *
-- *  Set a #GURI's query.
-- *
-- **/
--void
--gnet_uri_set_query (GURI* uri, const char* query)
--{
--    if (!uri) {
--        return;
--    }
--
--  if (uri->query)
--    {
--      free (uri->query);
--      uri->query = NULL;
--    }
--
--  if (query)
--    uri->query = strdup (query);
--}
--
--
--/**
-- *  gnet_uri_set_fragment
-- *  @uri: a #GURI
-- *  @fragment: fragment
-- *
-- *  Set a #GURI's fragment.
-- *
-- **/
--void
--gnet_uri_set_fragment (GURI* uri, const char* fragment)
--{
--  if (!uri) {
--      return;
--  }
--
--  if (uri->fragment)
--    {
--      free (uri->fragment);
--      uri->fragment = NULL;
--    }
--
--  if (fragment)
--    uri->fragment = strdup (fragment);
--}
--
--
--/**
-- *  gnet_mms_helper
-- *  @uri: a #GURI
-- *
-- *  returns char* representation of an uri that is sutable for
-- *  using in mms protocol.
-- *  '/path?query'
-- *
-- **/
--
--char* gnet_mms_helper(const GURI* uri, int make_absolute)
--{
--      size_t len = 0;
--      char *ret, *tmp = NULL;
--
--
--      /* Strip leading slashes and calculate the length of the path
--       * which might not be present in the URI */
--      if (uri->path) {
--          tmp = uri->path;
--          while (*tmp == '/')
--              ++tmp;
--          len += strlen(tmp);
--      }
--      /* Append length of the query part */
--      if (uri->query)
--          len += strlen(uri->query) + 1; /* + '?' */
--
--      if (!(ret = (char *) malloc(len + 2)))
--          return NULL;
--      memset (ret, 0, len + 2);
--
--      if (make_absolute)
--          strcpy(ret, "/");
--      else
--          ret[0] = 0;
--
--      /* Copy the optional path */
--      if (tmp)
--          strcat(ret, tmp);
--
--      /* Copy the optional query */
--      if (uri->query) {
--          strcat(ret, "?");
--          strcat(ret, uri->query);
--      }
--
--      return ret;
--}
-diff --git a/plugins/mms/libmms/uri.h b/plugins/mms/libmms/uri.h
-deleted file mode 100644
-index 75c9677..0000000
---- a/plugins/mms/libmms/uri.h
-+++ /dev/null
-@@ -1,92 +0,0 @@
--/* GNet - Networking library
-- * Copyright (C) 2000-2001  David Helder, David Bolcsfoldi
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the 
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA  02111-1307, USA.
-- */
--
--
--#ifndef _GNET_URI_H
--#define _GNET_URI_H
--
--#ifdef __cplusplus
--extern "C" {
--#endif /* __cplusplus */
--
--
--/**
-- *  GURI:
-- *  @scheme: Scheme (or protocol)
-- *  @userinfo: User info
-- *  @hostname: Host name
-- *  @port: Port number
-- *  @path: Path
-- *  @query: Query
-- *  @fragment: Fragment
-- *
-- *  The #GURI structure represents a URI.  All fields in this
-- *  structure are publicly readable.
-- *
-- **/
--typedef struct _GURI GURI;
--
--struct _GURI
--{
--  char* scheme;
--  char* user;
--  char* passwd;
--  char* hostname;
--  int   port;
--  char* path;
--  char* query;
--  char* fragment;
--};
--
--
--
--GURI*     gnet_uri_new (const char* uri);
--GURI*     gnet_uri_new_fields (const char* scheme, const char* hostname, 
--			       const int port, const char* path);
--GURI*
--gnet_uri_new_fields_all (const char* scheme, const char* user, 
--			 const char* passwd, const char* hostname,
--			 const int port, const char* path, 
--			 const char* query, const char* fragment);
--GURI*     gnet_uri_clone (const GURI* uri);
--void      gnet_uri_delete (GURI* uri);
--	       
--int  gnet_uri_equal (const char * p1, const char * p2);
--unsigned int     gnet_uri_hash (const char * p);
--
--void	  gnet_uri_escape (GURI* uri);
--void	  gnet_uri_unescape (GURI* uri);
--
--char* 	  gnet_uri_get_string (const GURI* uri);
--
--void 	  gnet_uri_set_scheme   (GURI* uri, const char* scheme);
--void 	  gnet_uri_set_userinfo (GURI* uri, const char* user, const char* passwd);
--void 	  gnet_uri_set_hostname (GURI* uri, const char* hostname);
--void 	  gnet_uri_set_port     (GURI* uri, int port);
--void 	  gnet_uri_set_path	(GURI* uri, const char* path);
--void 	  gnet_uri_set_query 	(GURI* uri, const char* query);
--void 	  gnet_uri_set_fragment (GURI* uri, const char* fragment);
--
--char*     gnet_mms_helper(const GURI* uri, int make_absolute);
--
--#ifdef __cplusplus
--}
--#endif				/* __cplusplus */
--
--#endif /* _GNET_URI_H */
--- 
diff --git a/debian/patches/series b/debian/patches/series
index 6d823cf..af179c5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,5 @@
 0001-remove-encoding-from-desktop-file.patch
-0003-remove-deadbeef.desktop-file.patch
-0004-add-quilt-file-to-POTFILES-skip.patch
-0005-remove-bundled-libmpcdec.patch
-0006-remove-bundled-libmms.patch
+0002-remove-deadbeef.desktop-file.patch
+0003-add-quilt-file-to-POTFILES-skip.patch
+0004-use-system-libmpcdec.patch
+0005-use-system-libmms.patch

-- 
deadbeef packaging



More information about the pkg-multimedia-commits mailing list