summaryrefslogtreecommitdiff
path: root/ext/wavpack
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wavpack')
-rw-r--r--ext/wavpack/Makefile.am22
-rwxr-xr-xext/wavpack/Makefile.in943
-rw-r--r--ext/wavpack/gstwavpack.c54
-rwxr-xr-xext/wavpack/gstwavpackcommon.c268
-rw-r--r--ext/wavpack/gstwavpackcommon.h75
-rwxr-xr-xext/wavpack/gstwavpackdec.c483
-rw-r--r--ext/wavpack/gstwavpackdec.h78
-rw-r--r--ext/wavpack/gstwavpackenc.c1010
-rw-r--r--ext/wavpack/gstwavpackenc.h105
-rwxr-xr-xext/wavpack/gstwavpackstreamreader.c125
-rw-r--r--ext/wavpack/gstwavpackstreamreader.h36
11 files changed, 3199 insertions, 0 deletions
diff --git a/ext/wavpack/Makefile.am b/ext/wavpack/Makefile.am
new file mode 100644
index 0000000..83163fc
--- /dev/null
+++ b/ext/wavpack/Makefile.am
@@ -0,0 +1,22 @@
+plugin_LTLIBRARIES = libgstwavpack.la
+
+libgstwavpack_la_SOURCES = \
+ gstwavpack.c \
+ gstwavpackcommon.c \
+ gstwavpackdec.c \
+ gstwavpackenc.c \
+ gstwavpackstreamreader.c
+
+libgstwavpack_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(WAVPACK_CFLAGS)
+libgstwavpack_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
+ $(GST_BASE_LIBS) $(GST_LIBS) $(WAVPACK_LIBS)
+libgstwavpack_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstwavpack_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = \
+ gstwavpackdec.h \
+ gstwavpackenc.h \
+ gstwavpackcommon.h \
+ gstwavpackstreamreader.h
+
diff --git a/ext/wavpack/Makefile.in b/ext/wavpack/Makefile.in
new file mode 100755
index 0000000..31482e4
--- /dev/null
+++ b/ext/wavpack/Makefile.in
@@ -0,0 +1,943 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 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.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+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@
+target_triplet = @target@
+subdir = ext/wavpack
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp $(noinst_HEADERS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
+ $(top_srcdir)/common/m4/as-auto-alt.m4 \
+ $(top_srcdir)/common/m4/as-compiler-flag.m4 \
+ $(top_srcdir)/common/m4/as-gcc-inline-assembly.m4 \
+ $(top_srcdir)/common/m4/as-libtool.m4 \
+ $(top_srcdir)/common/m4/as-version.m4 \
+ $(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/common/m4/gst-arch.m4 \
+ $(top_srcdir)/common/m4/gst-args.m4 \
+ $(top_srcdir)/common/m4/gst-check.m4 \
+ $(top_srcdir)/common/m4/gst-default.m4 \
+ $(top_srcdir)/common/m4/gst-dowhile.m4 \
+ $(top_srcdir)/common/m4/gst-error.m4 \
+ $(top_srcdir)/common/m4/gst-feature.m4 \
+ $(top_srcdir)/common/m4/gst-gettext.m4 \
+ $(top_srcdir)/common/m4/gst-glib2.m4 \
+ $(top_srcdir)/common/m4/gst-package-release-datetime.m4 \
+ $(top_srcdir)/common/m4/gst-platform.m4 \
+ $(top_srcdir)/common/m4/gst-plugin-docs.m4 \
+ $(top_srcdir)/common/m4/gst-plugindir.m4 \
+ $(top_srcdir)/common/m4/gst-x11.m4 \
+ $(top_srcdir)/common/m4/gst.m4 \
+ $(top_srcdir)/common/m4/gtk-doc.m4 \
+ $(top_srcdir)/common/m4/orc.m4 $(top_srcdir)/common/m4/pkg.m4 \
+ $(top_srcdir)/m4/aalib.m4 $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/gst-fionread.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.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__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libgstwavpack_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_libgstwavpack_la_OBJECTS = libgstwavpack_la-gstwavpack.lo \
+ libgstwavpack_la-gstwavpackcommon.lo \
+ libgstwavpack_la-gstwavpackdec.lo \
+ libgstwavpack_la-gstwavpackenc.lo \
+ libgstwavpack_la-gstwavpackstreamreader.lo
+libgstwavpack_la_OBJECTS = $(am_libgstwavpack_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libgstwavpack_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(libgstwavpack_la_CFLAGS) $(CFLAGS) \
+ $(libgstwavpack_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@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) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libgstwavpack_la_SOURCES)
+DIST_SOURCES = $(libgstwavpack_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+AALIB_CFLAGS = @AALIB_CFLAGS@
+AALIB_CONFIG = @AALIB_CONFIG@
+AALIB_LIBS = @AALIB_LIBS@
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BZ2_LIBS = @BZ2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_AUDIOSINK = @DEFAULT_AUDIOSINK@
+DEFAULT_AUDIOSRC = @DEFAULT_AUDIOSRC@
+DEFAULT_VIDEOSINK = @DEFAULT_VIDEOSINK@
+DEFAULT_VIDEOSRC = @DEFAULT_VIDEOSRC@
+DEFAULT_VISUALIZER = @DEFAULT_VISUALIZER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
+DIRECTSOUND_CFLAGS = @DIRECTSOUND_CFLAGS@
+DIRECTSOUND_LDFLAGS = @DIRECTSOUND_LDFLAGS@
+DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DV1394_CFLAGS = @DV1394_CFLAGS@
+DV1394_LIBS = @DV1394_LIBS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+ERROR_CXXFLAGS = @ERROR_CXXFLAGS@
+ERROR_OBJCFLAGS = @ERROR_OBJCFLAGS@
+EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LDFLAGS = @GIO_LDFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GLIB_PREFIX = @GLIB_PREFIX@
+GLIB_REQ = @GLIB_REQ@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
+GSTPB_PREFIX = @GSTPB_PREFIX@
+GST_AGE = @GST_AGE@
+GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@
+GST_API_VERSION = @GST_API_VERSION@
+GST_BASE_CFLAGS = @GST_BASE_CFLAGS@
+GST_BASE_LIBS = @GST_BASE_LIBS@
+GST_CFLAGS = @GST_CFLAGS@
+GST_CHECK_CFLAGS = @GST_CHECK_CFLAGS@
+GST_CHECK_LIBS = @GST_CHECK_LIBS@
+GST_CONTROLLER_CFLAGS = @GST_CONTROLLER_CFLAGS@
+GST_CONTROLLER_LIBS = @GST_CONTROLLER_LIBS@
+GST_CURRENT = @GST_CURRENT@
+GST_CXXFLAGS = @GST_CXXFLAGS@
+GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@
+GST_LIBS = @GST_LIBS@
+GST_LIBVERSION = @GST_LIBVERSION@
+GST_LICENSE = @GST_LICENSE@
+GST_LT_LDFLAGS = @GST_LT_LDFLAGS@
+GST_NET_CFLAGS = @GST_NET_CFLAGS@
+GST_NET_LIBS = @GST_NET_LIBS@
+GST_OBJCFLAGS = @GST_OBJCFLAGS@
+GST_OPTION_CFLAGS = @GST_OPTION_CFLAGS@
+GST_OPTION_CXXFLAGS = @GST_OPTION_CXXFLAGS@
+GST_OPTION_OBJCFLAGS = @GST_OPTION_OBJCFLAGS@
+GST_PACKAGE_NAME = @GST_PACKAGE_NAME@
+GST_PACKAGE_ORIGIN = @GST_PACKAGE_ORIGIN@
+GST_PLUGINS_ALL = @GST_PLUGINS_ALL@
+GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@
+GST_PLUGINS_BASE_DIR = @GST_PLUGINS_BASE_DIR@
+GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@
+GST_PLUGINS_DIR = @GST_PLUGINS_DIR@
+GST_PLUGINS_NONPORTED = @GST_PLUGINS_NONPORTED@
+GST_PLUGINS_SELECTED = @GST_PLUGINS_SELECTED@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
+GST_PLUGIN_LIBTOOLFLAGS = @GST_PLUGIN_LIBTOOLFLAGS@
+GST_PREFIX = @GST_PREFIX@
+GST_REVISION = @GST_REVISION@
+GST_TOOLS_DIR = @GST_TOOLS_DIR@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_X11_CFLAGS = @GTK_X11_CFLAGS@
+GTK_X11_LIBS = @GTK_X11_LIBS@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HAVE_AVC1394 = @HAVE_AVC1394@
+HAVE_CXX = @HAVE_CXX@
+HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
+HAVE_ROM1394 = @HAVE_ROM1394@
+HAVE_SPEEX = @HAVE_SPEEX@
+HAVE_X = @HAVE_X@
+HAVE_XSHM = @HAVE_XSHM@
+HAVE_ZLIB = @HAVE_ZLIB@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+JACK_0_120_1_CFLAGS = @JACK_0_120_1_CFLAGS@
+JACK_0_120_1_LIBS = @JACK_0_120_1_LIBS@
+JACK_1_9_7_CFLAGS = @JACK_1_9_7_CFLAGS@
+JACK_1_9_7_LIBS = @JACK_1_9_7_LIBS@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+JPEG_LIBS = @JPEG_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCACA_CFLAGS = @LIBCACA_CFLAGS@
+LIBCACA_LIBS = @LIBCACA_LIBS@
+LIBDV_CFLAGS = @LIBDV_CFLAGS@
+LIBDV_LIBS = @LIBDV_LIBS@
+LIBICONV = @LIBICONV@
+LIBIEC61883_CFLAGS = @LIBIEC61883_CFLAGS@
+LIBIEC61883_LIBS = @LIBIEC61883_LIBS@
+LIBINTL = @LIBINTL@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBPNG_CFLAGS = @LIBPNG_CFLAGS@
+LIBPNG_LIBS = @LIBPNG_LIBS@
+LIBRT = @LIBRT@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBV4L2_CFLAGS = @LIBV4L2_CFLAGS@
+LIBV4L2_LIBS = @LIBV4L2_LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LOCALEDIR = @LOCALEDIR@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+ORCC = @ORCC@
+ORCC_FLAGS = @ORCC_FLAGS@
+ORC_CFLAGS = @ORC_CFLAGS@
+ORC_LIBS = @ORC_LIBS@
+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@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MICRO = @PACKAGE_VERSION_MICRO@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_NANO = @PACKAGE_VERSION_NANO@
+PACKAGE_VERSION_RELEASE = @PACKAGE_VERSION_RELEASE@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGINDIR = @PLUGINDIR@
+POSUB = @POSUB@
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PULSE_CFLAGS = @PULSE_CFLAGS@
+PULSE_LIBS = @PULSE_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RAW1394_CFLAGS = @RAW1394_CFLAGS@
+RAW1394_LIBS = @RAW1394_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOUT2_CFLAGS = @SHOUT2_CFLAGS@
+SHOUT2_LIBS = @SHOUT2_LIBS@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+SPEEX_CFLAGS = @SPEEX_CFLAGS@
+SPEEX_LIBS = @SPEEX_LIBS@
+STRIP = @STRIP@
+TAGLIB_CFLAGS = @TAGLIB_CFLAGS@
+TAGLIB_CXXFLAGS = @TAGLIB_CXXFLAGS@
+TAGLIB_LIBS = @TAGLIB_LIBS@
+USE_NLS = @USE_NLS@
+VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
+VALGRIND_LIBS = @VALGRIND_LIBS@
+VALGRIND_PATH = @VALGRIND_PATH@
+VERSION = @VERSION@
+VPX_130_CFLAGS = @VPX_130_CFLAGS@
+VPX_130_LIBS = @VPX_130_LIBS@
+VPX_CFLAGS = @VPX_CFLAGS@
+VPX_LIBS = @VPX_LIBS@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
+WARNING_OBJCFLAGS = @WARNING_OBJCFLAGS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
+XDAMAGE_LIBS = @XDAMAGE_LIBS@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMKMF = @XMKMF@
+XSHM_LIBS = @XSHM_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+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@
+ac_ct_OBJC = @ac_ct_OBJC@
+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@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+plugindir = @plugindir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+plugin_LTLIBRARIES = libgstwavpack.la
+libgstwavpack_la_SOURCES = \
+ gstwavpack.c \
+ gstwavpackcommon.c \
+ gstwavpackdec.c \
+ gstwavpackenc.c \
+ gstwavpackstreamreader.c
+
+libgstwavpack_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(WAVPACK_CFLAGS)
+
+libgstwavpack_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
+ $(GST_BASE_LIBS) $(GST_LIBS) $(WAVPACK_LIBS)
+
+libgstwavpack_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstwavpack_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+noinst_HEADERS = \
+ gstwavpackdec.h \
+ gstwavpackenc.h \
+ gstwavpackcommon.h \
+ gstwavpackstreamreader.h
+
+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 ext/wavpack/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu ext/wavpack/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-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libgstwavpack.la: $(libgstwavpack_la_OBJECTS) $(libgstwavpack_la_DEPENDENCIES) $(EXTRA_libgstwavpack_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgstwavpack_la_LINK) -rpath $(plugindir) $(libgstwavpack_la_OBJECTS) $(libgstwavpack_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwavpack_la-gstwavpack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwavpack_la-gstwavpackcommon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwavpack_la-gstwavpackdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwavpack_la-gstwavpackenc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwavpack_la-gstwavpackstreamreader.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libgstwavpack_la-gstwavpack.lo: gstwavpack.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -MT libgstwavpack_la-gstwavpack.lo -MD -MP -MF $(DEPDIR)/libgstwavpack_la-gstwavpack.Tpo -c -o libgstwavpack_la-gstwavpack.lo `test -f 'gstwavpack.c' || echo '$(srcdir)/'`gstwavpack.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstwavpack_la-gstwavpack.Tpo $(DEPDIR)/libgstwavpack_la-gstwavpack.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstwavpack.c' object='libgstwavpack_la-gstwavpack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -c -o libgstwavpack_la-gstwavpack.lo `test -f 'gstwavpack.c' || echo '$(srcdir)/'`gstwavpack.c
+
+libgstwavpack_la-gstwavpackcommon.lo: gstwavpackcommon.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -MT libgstwavpack_la-gstwavpackcommon.lo -MD -MP -MF $(DEPDIR)/libgstwavpack_la-gstwavpackcommon.Tpo -c -o libgstwavpack_la-gstwavpackcommon.lo `test -f 'gstwavpackcommon.c' || echo '$(srcdir)/'`gstwavpackcommon.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstwavpack_la-gstwavpackcommon.Tpo $(DEPDIR)/libgstwavpack_la-gstwavpackcommon.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstwavpackcommon.c' object='libgstwavpack_la-gstwavpackcommon.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -c -o libgstwavpack_la-gstwavpackcommon.lo `test -f 'gstwavpackcommon.c' || echo '$(srcdir)/'`gstwavpackcommon.c
+
+libgstwavpack_la-gstwavpackdec.lo: gstwavpackdec.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -MT libgstwavpack_la-gstwavpackdec.lo -MD -MP -MF $(DEPDIR)/libgstwavpack_la-gstwavpackdec.Tpo -c -o libgstwavpack_la-gstwavpackdec.lo `test -f 'gstwavpackdec.c' || echo '$(srcdir)/'`gstwavpackdec.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstwavpack_la-gstwavpackdec.Tpo $(DEPDIR)/libgstwavpack_la-gstwavpackdec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstwavpackdec.c' object='libgstwavpack_la-gstwavpackdec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -c -o libgstwavpack_la-gstwavpackdec.lo `test -f 'gstwavpackdec.c' || echo '$(srcdir)/'`gstwavpackdec.c
+
+libgstwavpack_la-gstwavpackenc.lo: gstwavpackenc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -MT libgstwavpack_la-gstwavpackenc.lo -MD -MP -MF $(DEPDIR)/libgstwavpack_la-gstwavpackenc.Tpo -c -o libgstwavpack_la-gstwavpackenc.lo `test -f 'gstwavpackenc.c' || echo '$(srcdir)/'`gstwavpackenc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstwavpack_la-gstwavpackenc.Tpo $(DEPDIR)/libgstwavpack_la-gstwavpackenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstwavpackenc.c' object='libgstwavpack_la-gstwavpackenc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -c -o libgstwavpack_la-gstwavpackenc.lo `test -f 'gstwavpackenc.c' || echo '$(srcdir)/'`gstwavpackenc.c
+
+libgstwavpack_la-gstwavpackstreamreader.lo: gstwavpackstreamreader.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -MT libgstwavpack_la-gstwavpackstreamreader.lo -MD -MP -MF $(DEPDIR)/libgstwavpack_la-gstwavpackstreamreader.Tpo -c -o libgstwavpack_la-gstwavpackstreamreader.lo `test -f 'gstwavpackstreamreader.c' || echo '$(srcdir)/'`gstwavpackstreamreader.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstwavpack_la-gstwavpackstreamreader.Tpo $(DEPDIR)/libgstwavpack_la-gstwavpackstreamreader.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstwavpackstreamreader.c' object='libgstwavpack_la-gstwavpackstreamreader.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwavpack_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwavpack_la_CFLAGS) $(CFLAGS) -c -o libgstwavpack_la-gstwavpackstreamreader.lo `test -f 'gstwavpackstreamreader.c' || echo '$(srcdir)/'`gstwavpackstreamreader.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ 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-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ 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"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; 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:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+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-pluginLTLIBRARIES \
+ 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-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+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-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
+ ctags-am 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-pluginLTLIBRARIES 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 tags-am uninstall uninstall-am \
+ uninstall-pluginLTLIBRARIES
+
+
+# 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/ext/wavpack/gstwavpack.c b/ext/wavpack/gstwavpack.c
new file mode 100644
index 0000000..1609aa2
--- /dev/null
+++ b/ext/wavpack/gstwavpack.c
@@ -0,0 +1,54 @@
+/* GStreamer wavpack plugin
+ * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
+ *
+ * gstwavpack.c: plugin loader
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst-i18n-plugin.h>
+
+#include "gstwavpackdec.h"
+#include "gstwavpackenc.h"
+
+/* debug category for common code */
+GST_DEBUG_CATEGORY (wavpack_debug);
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ GST_DEBUG_CATEGORY_INIT (wavpack_debug, "wavpack", 0, "Wavpack elements");
+
+#ifdef ENABLE_NLS
+ GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
+ LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
+ return (gst_wavpack_dec_plugin_init (plugin)
+ && gst_wavpack_enc_plugin_init (plugin));
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ wavpack,
+ "Wavpack lossless/lossy audio format handling",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/wavpack/gstwavpackcommon.c b/ext/wavpack/gstwavpackcommon.c
new file mode 100755
index 0000000..7e3e492
--- /dev/null
+++ b/ext/wavpack/gstwavpackcommon.c
@@ -0,0 +1,268 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
+ * Copyright (c) 1998 - 2005 Conifer Software
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackcommon.c: common helper functions
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstwavpackcommon.h"
+#include <string.h>
+
+#include <gst/gst.h>
+
+GST_DEBUG_CATEGORY_EXTERN (wavpack_debug);
+#define GST_CAT_DEFAULT wavpack_debug
+
+gboolean
+gst_wavpack_read_header (WavpackHeader * header, guint8 * buf)
+{
+ memmove (header, buf, sizeof (WavpackHeader));
+
+#ifndef WAVPACK_OLD_API
+ WavpackLittleEndianToNative (header, (char *) WavpackHeaderFormat);
+#else
+ little_endian_to_native (header, WavpackHeaderFormat);
+#endif
+
+ return (memcmp (header->ckID, "wvpk", 4) == 0);
+}
+
+/* inspired by the original one in wavpack */
+gboolean
+gst_wavpack_read_metadata (GstWavpackMetadata * wpmd, guint8 * header_data,
+ guint8 ** p_data)
+{
+ WavpackHeader hdr;
+ guint8 *end;
+
+ gst_wavpack_read_header (&hdr, header_data);
+ end = header_data + hdr.ckSize + 8;
+
+ if (end - *p_data < 2)
+ return FALSE;
+
+ wpmd->id = GST_READ_UINT8 (*p_data);
+ wpmd->byte_length = 2 * (guint) GST_READ_UINT8 (*p_data + 1);
+
+ *p_data += 2;
+
+ if ((wpmd->id & ID_LARGE) == ID_LARGE) {
+ guint extra;
+
+ wpmd->id &= ~ID_LARGE;
+
+ if (end - *p_data < 2)
+ return FALSE;
+
+ extra = GST_READ_UINT16_LE (*p_data);
+ wpmd->byte_length += (extra << 9);
+ *p_data += 2;
+ }
+
+ if ((wpmd->id & ID_ODD_SIZE) == ID_ODD_SIZE) {
+ wpmd->id &= ~ID_ODD_SIZE;
+ --wpmd->byte_length;
+ }
+
+ if (wpmd->byte_length > 0) {
+ if (end - *p_data < wpmd->byte_length + (wpmd->byte_length & 1)) {
+ wpmd->data = NULL;
+ return FALSE;
+ }
+
+ wpmd->data = *p_data;
+ *p_data += wpmd->byte_length + (wpmd->byte_length & 1);
+ } else {
+ wpmd->data = NULL;
+ }
+
+ return TRUE;
+}
+
+gint
+gst_wavpack_get_default_channel_mask (gint nchannels)
+{
+ gint channel_mask = 0;
+
+ /* Set the default channel mask for the given number of channels.
+ * It's the same as for WAVE_FORMAT_EXTENDED:
+ * http://www.microsoft.com/whdc/device/audio/multichaud.mspx
+ */
+ switch (nchannels) {
+ case 11:
+ channel_mask |= 0x00400;
+ channel_mask |= 0x00200;
+ case 9:
+ channel_mask |= 0x00100;
+ case 8:
+ channel_mask |= 0x00080;
+ channel_mask |= 0x00040;
+ case 6:
+ channel_mask |= 0x00020;
+ channel_mask |= 0x00010;
+ case 4:
+ channel_mask |= 0x00008;
+ case 3:
+ channel_mask |= 0x00004;
+ case 2:
+ channel_mask |= 0x00002;
+ channel_mask |= 0x00001;
+ break;
+ case 1:
+ /* For mono use front center */
+ channel_mask |= 0x00004;
+ break;
+ }
+
+ return channel_mask;
+}
+
+static const struct
+{
+ const guint32 ms_mask;
+ const GstAudioChannelPosition gst_pos;
+} layout_mapping[] = {
+ {
+ 0x00001, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
+ 0x00002, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
+ 0x00004, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
+ 0x00008, GST_AUDIO_CHANNEL_POSITION_LFE1}, {
+ 0x00010, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, {
+ 0x00020, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
+ 0x00040, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, {
+ 0x00080, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
+ 0x00100, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
+ 0x00200, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, {
+ 0x00400, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
+ 0x00800, GST_AUDIO_CHANNEL_POSITION_TOP_CENTER}, {
+ 0x01000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT}, {
+ 0x02000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER}, {
+ 0x04000, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT}, {
+ 0x08000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT}, {
+ 0x10000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER}, {
+ 0x20000, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT}
+};
+
+#define MAX_CHANNEL_POSITIONS G_N_ELEMENTS (layout_mapping)
+
+gboolean
+gst_wavpack_get_channel_positions (gint num_channels, gint layout,
+ GstAudioChannelPosition * pos)
+{
+ gint i, p;
+
+ if (num_channels == 1 && layout == 0x00004) {
+ pos[0] = GST_AUDIO_CHANNEL_POSITION_MONO;
+ return TRUE;
+ }
+
+ p = 0;
+ for (i = 0; i < MAX_CHANNEL_POSITIONS; ++i) {
+ if ((layout & layout_mapping[i].ms_mask) != 0) {
+ if (p >= num_channels) {
+ GST_WARNING ("More bits set in the channel layout map than there "
+ "are channels! Broken file");
+ return FALSE;
+ }
+ if (layout_mapping[i].gst_pos == GST_AUDIO_CHANNEL_POSITION_INVALID) {
+ GST_WARNING ("Unsupported channel position (mask 0x%08x) in channel "
+ "layout map - ignoring those channels", layout_mapping[i].ms_mask);
+ /* what to do? just ignore it and let downstream deal with a channel
+ * layout that has INVALID positions in it for now ... */
+ }
+ pos[p] = layout_mapping[i].gst_pos;
+ ++p;
+ }
+ }
+
+ if (p != num_channels) {
+ GST_WARNING ("Only %d bits set in the channel layout map, but there are "
+ "supposed to be %d channels! Broken file", p, num_channels);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+GstAudioChannelPosition *
+gst_wavpack_get_default_channel_positions (gint nchannels)
+{
+ GstAudioChannelPosition *pos = g_new (GstAudioChannelPosition, nchannels);
+ gint i;
+
+ if (nchannels == 1) {
+ pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
+ return pos;
+ }
+
+ for (i = 0; i < nchannels; i++)
+ pos[i] = layout_mapping[i].gst_pos;
+
+ return pos;
+}
+
+gint
+gst_wavpack_get_channel_mask_from_positions (GstAudioChannelPosition * pos,
+ gint nchannels)
+{
+ gint channel_mask = 0;
+ gint i, j;
+
+ if (nchannels == 1 && pos[0] == GST_AUDIO_CHANNEL_POSITION_MONO) {
+ channel_mask = 0x00000004;
+ return channel_mask;
+ }
+
+ /* FIXME: not exactly efficient but otherwise we need an inverse
+ * mapping table too */
+ for (i = 0; i < nchannels; i++) {
+ for (j = 0; j < MAX_CHANNEL_POSITIONS; j++) {
+ if (pos[i] == layout_mapping[j].gst_pos) {
+ channel_mask |= layout_mapping[j].ms_mask;
+ break;
+ }
+ }
+ }
+
+ return channel_mask;
+}
+
+gboolean
+gst_wavpack_set_channel_mapping (GstAudioChannelPosition * pos, gint nchannels,
+ gint8 * channel_mapping)
+{
+ gint i, j;
+ gboolean ret = TRUE;
+
+ for (i = 0; i < nchannels; i++) {
+ for (j = 0; j < MAX_CHANNEL_POSITIONS; j++) {
+ if (pos[i] == layout_mapping[j].gst_pos) {
+ channel_mapping[i] = j;
+ ret &= (i == j);
+ break;
+ }
+ }
+ }
+
+ return !ret;
+}
diff --git a/ext/wavpack/gstwavpackcommon.h b/ext/wavpack/gstwavpackcommon.h
new file mode 100644
index 0000000..f4a81bf
--- /dev/null
+++ b/ext/wavpack/gstwavpackcommon.h
@@ -0,0 +1,75 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackcommon.h: common helper functions
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WAVPACK_COMMON_H__
+#define __GST_WAVPACK_COMMON_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include <wavpack/wavpack.h>
+
+typedef struct
+{
+ guint32 byte_length;
+ guint8 *data;
+ guint8 id;
+} GstWavpackMetadata;
+
+#define ID_UNIQUE 0x3f
+#define ID_OPTIONAL_DATA 0x20
+#define ID_ODD_SIZE 0x40
+#define ID_LARGE 0x80
+
+#define ID_DUMMY 0x0
+#define ID_ENCODER_INFO 0x1
+#define ID_DECORR_TERMS 0x2
+#define ID_DECORR_WEIGHTS 0x3
+#define ID_DECORR_SAMPLES 0x4
+#define ID_ENTROPY_VARS 0x5
+#define ID_HYBRID_PROFILE 0x6
+#define ID_SHAPING_WEIGHTS 0x7
+#define ID_FLOAT_INFO 0x8
+#define ID_INT32_INFO 0x9
+#define ID_WV_BITSTREAM 0xa
+#define ID_WVC_BITSTREAM 0xb
+#define ID_WVX_BITSTREAM 0xc
+#define ID_CHANNEL_INFO 0xd
+
+#define ID_RIFF_HEADER (ID_OPTIONAL_DATA | 0x1)
+#define ID_RIFF_TRAILER (ID_OPTIONAL_DATA | 0x2)
+#define ID_REPLAY_GAIN (ID_OPTIONAL_DATA | 0x3)
+#define ID_CUESHEET (ID_OPTIONAL_DATA | 0x4)
+#define ID_CONFIG_BLOCK (ID_OPTIONAL_DATA | 0x5)
+#define ID_MD5_CHECKSUM (ID_OPTIONAL_DATA | 0x6)
+#define ID_SAMPLE_RATE (ID_OPTIONAL_DATA | 0x7)
+
+
+gboolean gst_wavpack_read_header (WavpackHeader * header, guint8 * buf);
+gboolean gst_wavpack_read_metadata (GstWavpackMetadata * meta,
+ guint8 * header_data, guint8 ** p_data);
+gint gst_wavpack_get_default_channel_mask (gint nchannels);
+gboolean gst_wavpack_get_channel_positions (gint nchannels, gint layout, GstAudioChannelPosition *pos);
+GstAudioChannelPosition *gst_wavpack_get_default_channel_positions (gint nchannels);
+gint gst_wavpack_get_channel_mask_from_positions (GstAudioChannelPosition *pos, gint nchannels);
+gboolean gst_wavpack_set_channel_mapping (GstAudioChannelPosition *pos, gint nchannels, gint8 *channel_mapping);
+
+#endif
diff --git a/ext/wavpack/gstwavpackdec.c b/ext/wavpack/gstwavpackdec.c
new file mode 100755
index 0000000..10659ec
--- /dev/null
+++ b/ext/wavpack/gstwavpackdec.c
@@ -0,0 +1,483 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
+ * Copyright (c) 2006 Edward Hervey <bilboed@gmail.com>
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackdec.c: raw Wavpack bitstream decoder
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-wavpackdec
+ *
+ * WavpackDec decodes framed (for example by the WavpackParse element)
+ * Wavpack streams and decodes them to raw audio.
+ * <ulink url="http://www.wavpack.com/">Wavpack</ulink> is an open-source
+ * audio codec that features both lossless and lossy encoding.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch-1.0 filesrc location=test.wv ! wavpackparse ! wavpackdec ! audioconvert ! audioresample ! autoaudiosink
+ * ]| This pipeline decodes the Wavpack file test.wv into raw audio buffers and
+ * tries to play it back using an automatically found audio sink.
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+#include <math.h>
+#include <string.h>
+
+#include <wavpack/wavpack.h>
+#include "gstwavpackdec.h"
+#include "gstwavpackcommon.h"
+#include "gstwavpackstreamreader.h"
+
+
+GST_DEBUG_CATEGORY_STATIC (gst_wavpack_dec_debug);
+#define GST_CAT_DEFAULT gst_wavpack_dec_debug
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-wavpack, "
+ "depth = (int) [ 1, 32 ], "
+ "channels = (int) [ 1, 8 ], "
+ "rate = (int) [ 6000, 192000 ], " "framed = (boolean) true")
+ );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw, "
+ "format = (string) S8, "
+ "layout = (string) interleaved, "
+ "channels = (int) [ 1, 8 ], "
+ "rate = (int) [ 6000, 192000 ]; "
+ "audio/x-raw, "
+ "format = (string) " GST_AUDIO_NE (S16) ", "
+ "layout = (string) interleaved, "
+ "channels = (int) [ 1, 8 ], "
+ "rate = (int) [ 6000, 192000 ]; "
+ "audio/x-raw, "
+ "format = (string) " GST_AUDIO_NE (S32) ", "
+ "layout = (string) interleaved, "
+ "channels = (int) [ 1, 8 ], " "rate = (int) [ 6000, 192000 ]")
+ );
+
+static gboolean gst_wavpack_dec_start (GstAudioDecoder * dec);
+static gboolean gst_wavpack_dec_stop (GstAudioDecoder * dec);
+static gboolean gst_wavpack_dec_set_format (GstAudioDecoder * dec,
+ GstCaps * caps);
+static GstFlowReturn gst_wavpack_dec_handle_frame (GstAudioDecoder * dec,
+ GstBuffer * buffer);
+
+static void gst_wavpack_dec_finalize (GObject * object);
+static void gst_wavpack_dec_post_tags (GstWavpackDec * dec);
+
+#define gst_wavpack_dec_parent_class parent_class
+G_DEFINE_TYPE (GstWavpackDec, gst_wavpack_dec, GST_TYPE_AUDIO_DECODER);
+
+static void
+gst_wavpack_dec_class_init (GstWavpackDecClass * klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) (klass);
+ GstAudioDecoderClass *base_class = (GstAudioDecoderClass *) (klass);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
+ gst_element_class_set_static_metadata (element_class, "Wavpack audio decoder",
+ "Codec/Decoder/Audio",
+ "Decodes Wavpack audio data",
+ "Arwed v. Merkatz <v.merkatz@gmx.net>, "
+ "Sebastian Dröge <slomo@circular-chaos.org>");
+
+ gobject_class->finalize = gst_wavpack_dec_finalize;
+
+ base_class->start = GST_DEBUG_FUNCPTR (gst_wavpack_dec_start);
+ base_class->stop = GST_DEBUG_FUNCPTR (gst_wavpack_dec_stop);
+ base_class->set_format = GST_DEBUG_FUNCPTR (gst_wavpack_dec_set_format);
+ base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_wavpack_dec_handle_frame);
+}
+
+static void
+gst_wavpack_dec_reset (GstWavpackDec * dec)
+{
+ dec->wv_id.buffer = NULL;
+ dec->wv_id.position = dec->wv_id.length = 0;
+
+ dec->channels = 0;
+ dec->channel_mask = 0;
+ dec->sample_rate = 0;
+ dec->depth = 0;
+}
+
+static void
+gst_wavpack_dec_init (GstWavpackDec * dec)
+{
+ dec->context = NULL;
+ dec->stream_reader = gst_wavpack_stream_reader_new ();
+
+ gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (dec), TRUE);
+
+ gst_wavpack_dec_reset (dec);
+}
+
+static void
+gst_wavpack_dec_finalize (GObject * object)
+{
+ GstWavpackDec *dec = GST_WAVPACK_DEC (object);
+
+ g_free (dec->stream_reader);
+ dec->stream_reader = NULL;
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_wavpack_dec_start (GstAudioDecoder * dec)
+{
+ GST_DEBUG_OBJECT (dec, "start");
+
+ /* never mind a few errors */
+ gst_audio_decoder_set_max_errors (dec, 16);
+ /* don't bother us with flushing */
+ gst_audio_decoder_set_drainable (dec, FALSE);
+ /* aim for some perfect timestamping */
+ gst_audio_decoder_set_tolerance (dec, 10 * GST_MSECOND);
+
+ return TRUE;
+}
+
+static gboolean
+gst_wavpack_dec_stop (GstAudioDecoder * dec)
+{
+ GstWavpackDec *wpdec = GST_WAVPACK_DEC (dec);
+
+ GST_DEBUG_OBJECT (dec, "stop");
+
+ if (wpdec->context) {
+ WavpackCloseFile (wpdec->context);
+ wpdec->context = NULL;
+ }
+
+ gst_wavpack_dec_reset (wpdec);
+
+ return TRUE;
+}
+
+static void
+gst_wavpack_dec_negotiate (GstWavpackDec * dec)
+{
+ GstAudioInfo info;
+ GstAudioFormat fmt;
+ GstAudioChannelPosition pos[64] = { GST_AUDIO_CHANNEL_POSITION_INVALID, };
+
+ /* arrange for 1, 2 or 4-byte width == depth output */
+ dec->width = dec->depth;
+ switch (dec->depth) {
+ case 8:
+ fmt = GST_AUDIO_FORMAT_S8;
+ break;
+ case 16:
+ fmt = _GST_AUDIO_FORMAT_NE (S16);
+ break;
+ case 24:
+ case 32:
+ fmt = _GST_AUDIO_FORMAT_NE (S32);
+ dec->width = 32;
+ break;
+ default:
+ fmt = GST_AUDIO_FORMAT_UNKNOWN;
+ g_assert_not_reached ();
+ break;
+ }
+
+ g_assert (dec->channel_mask != 0);
+
+ if (!gst_wavpack_get_channel_positions (dec->channels,
+ dec->channel_mask, pos))
+ GST_WARNING_OBJECT (dec, "Failed to set channel layout");
+
+ gst_audio_info_init (&info);
+ gst_audio_info_set_format (&info, fmt, dec->sample_rate, dec->channels, pos);
+
+ gst_audio_channel_positions_to_valid_order (info.position, info.channels);
+ gst_audio_get_channel_reorder_map (info.channels,
+ info.position, pos, dec->channel_reorder_map);
+
+ /* should always succeed */
+ gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (dec), &info);
+}
+
+static gboolean
+gst_wavpack_dec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
+{
+ /* pretty much nothing to do here,
+ * we'll parse it all from the stream and setup then */
+
+ return TRUE;
+}
+
+static void
+gst_wavpack_dec_post_tags (GstWavpackDec * dec)
+{
+ GstTagList *list;
+ GstFormat format_time = GST_FORMAT_TIME, format_bytes = GST_FORMAT_BYTES;
+ gint64 duration, size;
+
+ /* try to estimate the average bitrate */
+ if (gst_pad_peer_query_duration (GST_AUDIO_DECODER_SINK_PAD (dec),
+ format_bytes, &size) &&
+ gst_pad_peer_query_duration (GST_AUDIO_DECODER_SINK_PAD (dec),
+ format_time, &duration) && size > 0 && duration > 0) {
+ guint64 bitrate;
+
+ list = gst_tag_list_new_empty ();
+
+ bitrate = gst_util_uint64_scale (size, 8 * GST_SECOND, duration);
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE,
+ (guint) bitrate, NULL);
+ gst_audio_decoder_merge_tags (GST_AUDIO_DECODER (dec), list,
+ GST_TAG_MERGE_REPLACE);
+ }
+}
+
+static GstFlowReturn
+gst_wavpack_dec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buf)
+{
+ GstWavpackDec *dec;
+ GstBuffer *outbuf = NULL;
+ GstFlowReturn ret = GST_FLOW_OK;
+ WavpackHeader wph;
+ int32_t decoded, unpacked_size;
+ gboolean format_changed;
+ gint width, depth, i, j, max;
+ gint32 *dec_data = NULL;
+ guint8 *out_data;
+ GstMapInfo map, omap;
+
+ dec = GST_WAVPACK_DEC (bdec);
+
+ g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
+
+ gst_buffer_map (buf, &map, GST_MAP_READ);
+
+ /* check input, we only accept framed input with complete chunks */
+ if (map.size < sizeof (WavpackHeader))
+ goto input_not_framed;
+
+ if (!gst_wavpack_read_header (&wph, map.data))
+ goto invalid_header;
+
+ if (map.size < wph.ckSize + 4 * 1 + 4)
+ goto input_not_framed;
+
+ if (!(wph.flags & INITIAL_BLOCK))
+ goto input_not_framed;
+
+ dec->wv_id.buffer = map.data;
+ dec->wv_id.length = map.size;
+ dec->wv_id.position = 0;
+
+ /* create a new wavpack context if there is none yet but if there
+ * was already one (i.e. caps were set on the srcpad) check whether
+ * the new one has the same caps */
+ if (!dec->context) {
+ gchar error_msg[80];
+
+ dec->context = WavpackOpenFileInputEx (dec->stream_reader,
+ &dec->wv_id, NULL, error_msg, OPEN_STREAMING, 0);
+
+ /* expect this to work */
+ if (!dec->context) {
+ GST_WARNING_OBJECT (dec, "Couldn't decode buffer: %s", error_msg);
+ goto context_failed;
+ }
+ }
+
+ g_assert (dec->context != NULL);
+
+ format_changed =
+ (dec->sample_rate != WavpackGetSampleRate (dec->context)) ||
+ (dec->channels != WavpackGetNumChannels (dec->context)) ||
+ (dec->depth != WavpackGetBytesPerSample (dec->context) * 8) ||
+#ifdef WAVPACK_OLD_API
+ (dec->channel_mask != dec->context->config.channel_mask);
+#else
+ (dec->channel_mask != WavpackGetChannelMask (dec->context));
+#endif
+
+ if (!gst_pad_has_current_caps (GST_AUDIO_DECODER_SRC_PAD (dec)) ||
+ format_changed) {
+ gint channel_mask;
+
+ dec->sample_rate = WavpackGetSampleRate (dec->context);
+ dec->channels = WavpackGetNumChannels (dec->context);
+ dec->depth = WavpackGetBytesPerSample (dec->context) * 8;
+
+#ifdef WAVPACK_OLD_API
+ channel_mask = dec->context->config.channel_mask;
+#else
+ channel_mask = WavpackGetChannelMask (dec->context);
+#endif
+ if (channel_mask == 0)
+ channel_mask = gst_wavpack_get_default_channel_mask (dec->channels);
+
+ dec->channel_mask = channel_mask;
+
+ gst_wavpack_dec_negotiate (dec);
+
+ /* send GST_TAG_AUDIO_CODEC and GST_TAG_BITRATE tags before something
+ * is decoded or after the format has changed */
+ gst_wavpack_dec_post_tags (dec);
+ }
+
+ /* alloc output buffer */
+ dec_data = g_malloc (4 * wph.block_samples * dec->channels);
+
+ /* decode */
+ decoded = WavpackUnpackSamples (dec->context, dec_data, wph.block_samples);
+ if (decoded != wph.block_samples)
+ goto decode_error;
+
+ unpacked_size = (dec->width / 8) * wph.block_samples * dec->channels;
+ outbuf = gst_buffer_new_and_alloc (unpacked_size);
+
+ /* legacy; pass along offset, whatever that might entail */
+ GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf);
+
+ gst_buffer_map (outbuf, &omap, GST_MAP_WRITE);
+ out_data = omap.data;
+
+ width = dec->width;
+ depth = dec->depth;
+ max = dec->channels * wph.block_samples;
+ if (width == 8) {
+ gint8 *outbuffer = (gint8 *) out_data;
+ gint *reorder_map = dec->channel_reorder_map;
+
+ for (i = 0; i < max; i += dec->channels) {
+ for (j = 0; j < dec->channels; j++)
+ *outbuffer++ = (gint8) (dec_data[i + reorder_map[j]]);
+ }
+ } else if (width == 16) {
+ gint16 *outbuffer = (gint16 *) out_data;
+ gint *reorder_map = dec->channel_reorder_map;
+
+ for (i = 0; i < max; i += dec->channels) {
+ for (j = 0; j < dec->channels; j++)
+ *outbuffer++ = (gint16) (dec_data[i + reorder_map[j]]);
+ }
+ } else if (dec->width == 32) {
+ gint32 *outbuffer = (gint32 *) out_data;
+ gint *reorder_map = dec->channel_reorder_map;
+
+ if (width != depth) {
+ for (i = 0; i < max; i += dec->channels) {
+ for (j = 0; j < dec->channels; j++)
+ *outbuffer++ =
+ (gint32) (dec_data[i + reorder_map[j]] << (width - depth));
+ }
+ } else {
+ for (i = 0; i < max; i += dec->channels) {
+ for (j = 0; j < dec->channels; j++)
+ *outbuffer++ = (gint32) (dec_data[i + reorder_map[j]]);
+ }
+ }
+ } else {
+ g_assert_not_reached ();
+ }
+
+ gst_buffer_unmap (outbuf, &omap);
+ gst_buffer_unmap (buf, &map);
+ buf = NULL;
+
+ g_free (dec_data);
+
+ ret = gst_audio_decoder_finish_frame (bdec, outbuf, 1);
+
+out:
+ if (buf)
+ gst_buffer_unmap (buf, &map);
+
+ if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+ GST_DEBUG_OBJECT (dec, "flow: %s", gst_flow_get_name (ret));
+ }
+
+ return ret;
+
+/* ERRORS */
+input_not_framed:
+ {
+ GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), ("Expected framed input"));
+ ret = GST_FLOW_ERROR;
+ goto out;
+ }
+invalid_header:
+ {
+ GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), ("Invalid wavpack header"));
+ ret = GST_FLOW_ERROR;
+ goto out;
+ }
+context_failed:
+ {
+ GST_AUDIO_DECODER_ERROR (bdec, 1, LIBRARY, INIT, (NULL),
+ ("error creating Wavpack context"), ret);
+ goto out;
+ }
+decode_error:
+ {
+ const gchar *reason = "unknown";
+
+ if (dec->context) {
+#ifdef WAVPACK_OLD_API
+ reason = dec->context->error_message;
+#else
+ reason = WavpackGetErrorMessage (dec->context);
+#endif
+ } else {
+ reason = "couldn't create decoder context";
+ }
+ GST_AUDIO_DECODER_ERROR (bdec, 1, STREAM, DECODE, (NULL),
+ ("decoding error: %s", reason), ret);
+ g_free (dec_data);
+ if (ret == GST_FLOW_OK)
+ gst_audio_decoder_finish_frame (bdec, NULL, 1);
+ goto out;
+ }
+}
+
+gboolean
+gst_wavpack_dec_plugin_init (GstPlugin * plugin)
+{
+ if (!gst_element_register (plugin, "wavpackdec",
+ GST_RANK_PRIMARY, GST_TYPE_WAVPACK_DEC))
+ return FALSE;
+ GST_DEBUG_CATEGORY_INIT (gst_wavpack_dec_debug, "wavpackdec", 0,
+ "Wavpack decoder");
+ return TRUE;
+}
diff --git a/ext/wavpack/gstwavpackdec.h b/ext/wavpack/gstwavpackdec.h
new file mode 100644
index 0000000..8a002b4
--- /dev/null
+++ b/ext/wavpack/gstwavpackdec.h
@@ -0,0 +1,78 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackdec.h: raw Wavpack bitstream decoder
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WAVPACK_DEC_H__
+#define __GST_WAVPACK_DEC_H__
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiodecoder.h>
+
+#include <wavpack/wavpack.h>
+
+#include "gstwavpackstreamreader.h"
+
+G_BEGIN_DECLS
+#define GST_TYPE_WAVPACK_DEC \
+ (gst_wavpack_dec_get_type())
+#define GST_WAVPACK_DEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVPACK_DEC,GstWavpackDec))
+#define GST_WAVPACK_DEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVPACK_DEC,GstWavpackDecClass))
+#define GST_IS_WAVPACK_DEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVPACK_DEC))
+#define GST_IS_WAVPACK_DEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVPACK_DEC))
+typedef struct _GstWavpackDec GstWavpackDec;
+typedef struct _GstWavpackDecClass GstWavpackDecClass;
+
+struct _GstWavpackDec
+{
+ GstAudioDecoder element;
+
+ /*< private > */
+
+ WavpackContext *context;
+ WavpackStreamReader *stream_reader;
+
+ read_id wv_id;
+
+ gint sample_rate;
+ gint depth;
+ gint width;
+ gint channels;
+ gint channel_mask;
+
+ gint channel_reorder_map[64];
+
+};
+
+struct _GstWavpackDecClass
+{
+ GstAudioDecoderClass parent;
+};
+
+GType gst_wavpack_dec_get_type (void);
+
+gboolean gst_wavpack_dec_plugin_init (GstPlugin * plugin);
+
+G_END_DECLS
+#endif /* __GST_WAVPACK_DEC_H__ */
diff --git a/ext/wavpack/gstwavpackenc.c b/ext/wavpack/gstwavpackenc.c
new file mode 100644
index 0000000..cb69739
--- /dev/null
+++ b/ext/wavpack/gstwavpackenc.c
@@ -0,0 +1,1010 @@
+/* GStreamer Wavpack encoder plugin
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackdec.c: Wavpack audio encoder
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-wavpackenc
+ *
+ * WavpackEnc encodes raw audio into a framed Wavpack stream.
+ * <ulink url="http://www.wavpack.com/">Wavpack</ulink> is an open-source
+ * audio codec that features both lossless and lossy encoding.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch-1.0 audiotestsrc num-buffers=500 ! audioconvert ! wavpackenc ! filesink location=sinewave.wv
+ * ]| This pipeline encodes audio from audiotestsrc into a Wavpack file. The audioconvert element is needed
+ * as the Wavpack encoder only accepts input with 32 bit width.
+ * |[
+ * gst-launch-1.0 cdda://1 ! audioconvert ! wavpackenc ! filesink location=track1.wv
+ * ]| This pipeline encodes audio from an audio CD into a Wavpack file using
+ * lossless encoding (the file output will be fairly large).
+ * |[
+ * gst-launch-1.0 cdda://1 ! audioconvert ! wavpackenc bitrate=128000 ! filesink location=track1.wv
+ * ]| This pipeline encodes audio from an audio CD into a Wavpack file using
+ * lossy encoding at a certain bitrate (the file will be fairly small).
+ * </refsect2>
+ */
+
+/*
+ * TODO: - add 32 bit float mode. CONFIG_FLOAT_DATA
+ */
+
+#include <string.h>
+#include <gst/gst.h>
+#include <glib/gprintf.h>
+
+#include <wavpack/wavpack.h>
+#include "gstwavpackenc.h"
+#include "gstwavpackcommon.h"
+
+static gboolean gst_wavpack_enc_start (GstAudioEncoder * enc);
+static gboolean gst_wavpack_enc_stop (GstAudioEncoder * enc);
+static gboolean gst_wavpack_enc_set_format (GstAudioEncoder * enc,
+ GstAudioInfo * info);
+static GstFlowReturn gst_wavpack_enc_handle_frame (GstAudioEncoder * enc,
+ GstBuffer * in_buf);
+static gboolean gst_wavpack_enc_sink_event (GstAudioEncoder * enc,
+ GstEvent * event);
+
+static int gst_wavpack_enc_push_block (void *id, void *data, int32_t count);
+static GstFlowReturn gst_wavpack_enc_drain (GstWavpackEnc * enc);
+
+static void gst_wavpack_enc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_wavpack_enc_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+
+enum
+{
+ ARG_0,
+ ARG_MODE,
+ ARG_BITRATE,
+ ARG_BITSPERSAMPLE,
+ ARG_CORRECTION_MODE,
+ ARG_MD5,
+ ARG_EXTRA_PROCESSING,
+ ARG_JOINT_STEREO_MODE
+};
+
+GST_DEBUG_CATEGORY_STATIC (gst_wavpack_enc_debug);
+#define GST_CAT_DEFAULT gst_wavpack_enc_debug
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw, "
+ "format = (string) " GST_AUDIO_NE (S32) ", "
+ "layout = (string) interleaved, "
+ "channels = (int) [ 1, 8 ], " "rate = (int) [ 6000, 192000 ]")
+ );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-wavpack, "
+ "depth = (int) [ 1, 32 ], "
+ "channels = (int) [ 1, 8 ], "
+ "rate = (int) [ 6000, 192000 ], " "framed = (boolean) TRUE")
+ );
+
+static GstStaticPadTemplate wvcsrc_factory = GST_STATIC_PAD_TEMPLATE ("wvcsrc",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS ("audio/x-wavpack-correction, " "framed = (boolean) TRUE")
+ );
+
+enum
+{
+ GST_WAVPACK_ENC_MODE_VERY_FAST = 0,
+ GST_WAVPACK_ENC_MODE_FAST,
+ GST_WAVPACK_ENC_MODE_DEFAULT,
+ GST_WAVPACK_ENC_MODE_HIGH,
+ GST_WAVPACK_ENC_MODE_VERY_HIGH
+};
+
+#define GST_TYPE_WAVPACK_ENC_MODE (gst_wavpack_enc_mode_get_type ())
+static GType
+gst_wavpack_enc_mode_get_type (void)
+{
+ static GType qtype = 0;
+
+ if (qtype == 0) {
+ static const GEnumValue values[] = {
+#if 0
+ /* Very Fast Compression is not supported yet, but will be supported
+ * in future wavpack versions */
+ {GST_WAVPACK_ENC_MODE_VERY_FAST, "Very Fast Compression", "veryfast"},
+#endif
+ {GST_WAVPACK_ENC_MODE_FAST, "Fast Compression", "fast"},
+ {GST_WAVPACK_ENC_MODE_DEFAULT, "Normal Compression", "normal"},
+ {GST_WAVPACK_ENC_MODE_HIGH, "High Compression", "high"},
+#ifndef WAVPACK_OLD_API
+ {GST_WAVPACK_ENC_MODE_VERY_HIGH, "Very High Compression", "veryhigh"},
+#endif
+ {0, NULL, NULL}
+ };
+
+ qtype = g_enum_register_static ("GstWavpackEncMode", values);
+ }
+ return qtype;
+}
+
+enum
+{
+ GST_WAVPACK_CORRECTION_MODE_OFF = 0,
+ GST_WAVPACK_CORRECTION_MODE_ON,
+ GST_WAVPACK_CORRECTION_MODE_OPTIMIZED
+};
+
+#define GST_TYPE_WAVPACK_ENC_CORRECTION_MODE (gst_wavpack_enc_correction_mode_get_type ())
+static GType
+gst_wavpack_enc_correction_mode_get_type (void)
+{
+ static GType qtype = 0;
+
+ if (qtype == 0) {
+ static const GEnumValue values[] = {
+ {GST_WAVPACK_CORRECTION_MODE_OFF, "Create no correction file", "off"},
+ {GST_WAVPACK_CORRECTION_MODE_ON, "Create correction file", "on"},
+ {GST_WAVPACK_CORRECTION_MODE_OPTIMIZED,
+ "Create optimized correction file", "optimized"},
+ {0, NULL, NULL}
+ };
+
+ qtype = g_enum_register_static ("GstWavpackEncCorrectionMode", values);
+ }
+ return qtype;
+}
+
+enum
+{
+ GST_WAVPACK_JS_MODE_AUTO = 0,
+ GST_WAVPACK_JS_MODE_LEFT_RIGHT,
+ GST_WAVPACK_JS_MODE_MID_SIDE
+};
+
+#define GST_TYPE_WAVPACK_ENC_JOINT_STEREO_MODE (gst_wavpack_enc_joint_stereo_mode_get_type ())
+static GType
+gst_wavpack_enc_joint_stereo_mode_get_type (void)
+{
+ static GType qtype = 0;
+
+ if (qtype == 0) {
+ static const GEnumValue values[] = {
+ {GST_WAVPACK_JS_MODE_AUTO, "auto", "auto"},
+ {GST_WAVPACK_JS_MODE_LEFT_RIGHT, "left/right", "leftright"},
+ {GST_WAVPACK_JS_MODE_MID_SIDE, "mid/side", "midside"},
+ {0, NULL, NULL}
+ };
+
+ qtype = g_enum_register_static ("GstWavpackEncJSMode", values);
+ }
+ return qtype;
+}
+
+#define gst_wavpack_enc_parent_class parent_class
+G_DEFINE_TYPE (GstWavpackEnc, gst_wavpack_enc, GST_TYPE_AUDIO_ENCODER);
+
+static void
+gst_wavpack_enc_class_init (GstWavpackEncClass * klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) (klass);
+ GstAudioEncoderClass *base_class = (GstAudioEncoderClass *) (klass);
+
+ /* add pad templates */
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&wvcsrc_factory));
+
+ /* set element details */
+ gst_element_class_set_static_metadata (element_class, "Wavpack audio encoder",
+ "Codec/Encoder/Audio",
+ "Encodes audio with the Wavpack lossless/lossy audio codec",
+ "Sebastian Dröge <slomo@circular-chaos.org>");
+
+ /* set property handlers */
+ gobject_class->set_property = gst_wavpack_enc_set_property;
+ gobject_class->get_property = gst_wavpack_enc_get_property;
+
+ base_class->start = GST_DEBUG_FUNCPTR (gst_wavpack_enc_start);
+ base_class->stop = GST_DEBUG_FUNCPTR (gst_wavpack_enc_stop);
+ base_class->set_format = GST_DEBUG_FUNCPTR (gst_wavpack_enc_set_format);
+ base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_wavpack_enc_handle_frame);
+ base_class->sink_event = GST_DEBUG_FUNCPTR (gst_wavpack_enc_sink_event);
+
+ /* install all properties */
+ g_object_class_install_property (gobject_class, ARG_MODE,
+ g_param_spec_enum ("mode", "Encoding mode",
+ "Speed versus compression tradeoff.",
+ GST_TYPE_WAVPACK_ENC_MODE, GST_WAVPACK_ENC_MODE_DEFAULT,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_BITRATE,
+ g_param_spec_uint ("bitrate", "Bitrate",
+ "Try to encode with this average bitrate (bits/sec). "
+ "This enables lossy encoding, values smaller than 24000 disable it again.",
+ 0, 9600000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_BITSPERSAMPLE,
+ g_param_spec_double ("bits-per-sample", "Bits per sample",
+ "Try to encode with this amount of bits per sample. "
+ "This enables lossy encoding, values smaller than 2.0 disable it again.",
+ 0.0, 24.0, 0.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_CORRECTION_MODE,
+ g_param_spec_enum ("correction-mode", "Correction stream mode",
+ "Use this mode for the correction stream. Only works in lossy mode!",
+ GST_TYPE_WAVPACK_ENC_CORRECTION_MODE, GST_WAVPACK_CORRECTION_MODE_OFF,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_MD5,
+ g_param_spec_boolean ("md5", "MD5",
+ "Store MD5 hash of raw samples within the file.", FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_EXTRA_PROCESSING,
+ g_param_spec_uint ("extra-processing", "Extra processing",
+ "Use better but slower filters for better compression/quality.",
+ 0, 6, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_JOINT_STEREO_MODE,
+ g_param_spec_enum ("joint-stereo-mode", "Joint-Stereo mode",
+ "Use this joint-stereo mode.", GST_TYPE_WAVPACK_ENC_JOINT_STEREO_MODE,
+ GST_WAVPACK_JS_MODE_AUTO,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_wavpack_enc_reset (GstWavpackEnc * enc)
+{
+ /* close and free everything stream related if we already did something */
+ if (enc->wp_context) {
+ WavpackCloseFile (enc->wp_context);
+ enc->wp_context = NULL;
+ }
+ if (enc->wp_config) {
+ g_free (enc->wp_config);
+ enc->wp_config = NULL;
+ }
+ if (enc->first_block) {
+ g_free (enc->first_block);
+ enc->first_block = NULL;
+ }
+ enc->first_block_size = 0;
+ if (enc->md5_context) {
+ g_checksum_free (enc->md5_context);
+ enc->md5_context = NULL;
+ }
+ if (enc->pending_segment)
+ gst_event_unref (enc->pending_segment);
+ enc->pending_segment = NULL;
+
+ if (enc->pending_buffer) {
+ gst_buffer_unref (enc->pending_buffer);
+ enc->pending_buffer = NULL;
+ enc->pending_offset = 0;
+ }
+
+ /* reset the last returns to GST_FLOW_OK. This is only set to something else
+ * while WavpackPackSamples() or more specific gst_wavpack_enc_push_block()
+ * so not valid anymore */
+ enc->srcpad_last_return = enc->wvcsrcpad_last_return = GST_FLOW_OK;
+
+ /* reset stream information */
+ enc->samplerate = 0;
+ enc->depth = 0;
+ enc->channels = 0;
+ enc->channel_mask = 0;
+ enc->need_channel_remap = FALSE;
+
+ enc->timestamp_offset = GST_CLOCK_TIME_NONE;
+ enc->next_ts = GST_CLOCK_TIME_NONE;
+}
+
+static void
+gst_wavpack_enc_init (GstWavpackEnc * enc)
+{
+ GstAudioEncoder *benc = GST_AUDIO_ENCODER (enc);
+
+ /* initialize object attributes */
+ enc->wp_config = NULL;
+ enc->wp_context = NULL;
+ enc->first_block = NULL;
+ enc->md5_context = NULL;
+ gst_wavpack_enc_reset (enc);
+
+ enc->wv_id.correction = FALSE;
+ enc->wv_id.wavpack_enc = enc;
+ enc->wv_id.passthrough = FALSE;
+ enc->wvc_id.correction = TRUE;
+ enc->wvc_id.wavpack_enc = enc;
+ enc->wvc_id.passthrough = FALSE;
+
+ /* set default values of params */
+ enc->mode = GST_WAVPACK_ENC_MODE_DEFAULT;
+ enc->bitrate = 0;
+ enc->bps = 0.0;
+ enc->correction_mode = GST_WAVPACK_CORRECTION_MODE_OFF;
+ enc->md5 = FALSE;
+ enc->extra_processing = 0;
+ enc->joint_stereo_mode = GST_WAVPACK_JS_MODE_AUTO;
+
+ /* require perfect ts */
+ gst_audio_encoder_set_perfect_timestamp (benc, TRUE);
+}
+
+
+static gboolean
+gst_wavpack_enc_start (GstAudioEncoder * enc)
+{
+ GST_DEBUG_OBJECT (enc, "start");
+
+ return TRUE;
+}
+
+static gboolean
+gst_wavpack_enc_stop (GstAudioEncoder * enc)
+{
+ GstWavpackEnc *wpenc = GST_WAVPACK_ENC (enc);
+
+ GST_DEBUG_OBJECT (enc, "stop");
+ gst_wavpack_enc_reset (wpenc);
+
+ return TRUE;
+}
+
+static gboolean
+gst_wavpack_enc_set_format (GstAudioEncoder * benc, GstAudioInfo * info)
+{
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (benc);
+ GstAudioChannelPosition *pos;
+ GstAudioChannelPosition opos[64] = { GST_AUDIO_CHANNEL_POSITION_INVALID, };
+ GstCaps *caps;
+ guint64 mask = 0;
+
+ /* we may be configured again, but that change should have cleanup context */
+ g_assert (enc->wp_context == NULL);
+
+ enc->channels = GST_AUDIO_INFO_CHANNELS (info);
+ enc->depth = GST_AUDIO_INFO_DEPTH (info);
+ enc->samplerate = GST_AUDIO_INFO_RATE (info);
+
+ pos = info->position;
+ g_assert (pos);
+
+ /* If one channel is NONE they'll be all undefined */
+ if (pos != NULL && pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE) {
+ goto invalid_channels;
+ }
+
+ enc->channel_mask =
+ gst_wavpack_get_channel_mask_from_positions (pos, enc->channels);
+ enc->need_channel_remap =
+ gst_wavpack_set_channel_mapping (pos, enc->channels,
+ enc->channel_mapping);
+
+ /* wavpack caps hold gst mask, not wavpack mask */
+ gst_audio_channel_positions_to_mask (opos, enc->channels, FALSE, &mask);
+
+ /* set fixed src pad caps now that we know what we will get */
+ caps = gst_caps_new_simple ("audio/x-wavpack",
+ "channels", G_TYPE_INT, enc->channels,
+ "rate", G_TYPE_INT, enc->samplerate,
+ "depth", G_TYPE_INT, enc->depth, "framed", G_TYPE_BOOLEAN, TRUE, NULL);
+
+ if (mask)
+ gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, mask, NULL);
+
+ if (!gst_audio_encoder_set_output_format (benc, caps))
+ goto setting_src_caps_failed;
+
+ gst_caps_unref (caps);
+
+ /* no special feedback to base class; should provide all available samples */
+
+ return TRUE;
+
+ /* ERRORS */
+setting_src_caps_failed:
+ {
+ GST_DEBUG_OBJECT (enc,
+ "Couldn't set caps on source pad: %" GST_PTR_FORMAT, caps);
+ gst_caps_unref (caps);
+ return FALSE;
+ }
+invalid_channels:
+ {
+ GST_DEBUG_OBJECT (enc, "input has invalid channel layout");
+ return FALSE;
+ }
+}
+
+static void
+gst_wavpack_enc_set_wp_config (GstWavpackEnc * enc)
+{
+ enc->wp_config = g_new0 (WavpackConfig, 1);
+ /* set general stream informations in the WavpackConfig */
+ enc->wp_config->bytes_per_sample = GST_ROUND_UP_8 (enc->depth) / 8;
+ enc->wp_config->bits_per_sample = enc->depth;
+ enc->wp_config->num_channels = enc->channels;
+ enc->wp_config->channel_mask = enc->channel_mask;
+ enc->wp_config->sample_rate = enc->samplerate;
+
+ /*
+ * Set parameters in WavpackConfig
+ */
+
+ /* Encoding mode */
+ switch (enc->mode) {
+#if 0
+ case GST_WAVPACK_ENC_MODE_VERY_FAST:
+ enc->wp_config->flags |= CONFIG_VERY_FAST_FLAG;
+ enc->wp_config->flags |= CONFIG_FAST_FLAG;
+ break;
+#endif
+ case GST_WAVPACK_ENC_MODE_FAST:
+ enc->wp_config->flags |= CONFIG_FAST_FLAG;
+ break;
+ case GST_WAVPACK_ENC_MODE_DEFAULT:
+ break;
+ case GST_WAVPACK_ENC_MODE_HIGH:
+ enc->wp_config->flags |= CONFIG_HIGH_FLAG;
+ break;
+#ifndef WAVPACK_OLD_API
+ case GST_WAVPACK_ENC_MODE_VERY_HIGH:
+ enc->wp_config->flags |= CONFIG_HIGH_FLAG;
+ enc->wp_config->flags |= CONFIG_VERY_HIGH_FLAG;
+ break;
+#endif
+ }
+
+ /* Bitrate, enables lossy mode */
+ if (enc->bitrate) {
+ enc->wp_config->flags |= CONFIG_HYBRID_FLAG;
+ enc->wp_config->flags |= CONFIG_BITRATE_KBPS;
+ enc->wp_config->bitrate = enc->bitrate / 1000.0;
+ } else if (enc->bps) {
+ enc->wp_config->flags |= CONFIG_HYBRID_FLAG;
+ enc->wp_config->bitrate = enc->bps;
+ }
+
+ /* Correction Mode, only in lossy mode */
+ if (enc->wp_config->flags & CONFIG_HYBRID_FLAG) {
+ if (enc->correction_mode > GST_WAVPACK_CORRECTION_MODE_OFF) {
+ GstCaps *caps = gst_caps_new_simple ("audio/x-wavpack-correction",
+ "framed", G_TYPE_BOOLEAN, TRUE, NULL);
+
+ enc->wvcsrcpad =
+ gst_pad_new_from_static_template (&wvcsrc_factory, "wvcsrc");
+
+ /* try to add correction src pad, don't set correction mode on failure */
+ GST_DEBUG_OBJECT (enc, "Adding correction pad with caps %"
+ GST_PTR_FORMAT, caps);
+ if (!gst_pad_set_caps (enc->wvcsrcpad, caps)) {
+ enc->correction_mode = 0;
+ GST_WARNING_OBJECT (enc, "setting correction caps failed");
+ } else {
+ gst_pad_use_fixed_caps (enc->wvcsrcpad);
+ gst_pad_set_active (enc->wvcsrcpad, TRUE);
+ gst_element_add_pad (GST_ELEMENT (enc), enc->wvcsrcpad);
+ enc->wp_config->flags |= CONFIG_CREATE_WVC;
+ if (enc->correction_mode == GST_WAVPACK_CORRECTION_MODE_OPTIMIZED) {
+ enc->wp_config->flags |= CONFIG_OPTIMIZE_WVC;
+ }
+ }
+ gst_caps_unref (caps);
+ }
+ } else {
+ if (enc->correction_mode > GST_WAVPACK_CORRECTION_MODE_OFF) {
+ enc->correction_mode = 0;
+ GST_WARNING_OBJECT (enc, "setting correction mode only has "
+ "any effect if a bitrate is provided.");
+ }
+ }
+ gst_element_no_more_pads (GST_ELEMENT (enc));
+
+ /* MD5, setup MD5 context */
+ if ((enc->md5) && !(enc->md5_context)) {
+ enc->wp_config->flags |= CONFIG_MD5_CHECKSUM;
+ enc->md5_context = g_checksum_new (G_CHECKSUM_MD5);
+ }
+
+ /* Extra encode processing */
+ if (enc->extra_processing) {
+ enc->wp_config->flags |= CONFIG_EXTRA_MODE;
+ enc->wp_config->xmode = enc->extra_processing;
+ }
+
+ /* Joint stereo mode */
+ switch (enc->joint_stereo_mode) {
+ case GST_WAVPACK_JS_MODE_AUTO:
+ break;
+ case GST_WAVPACK_JS_MODE_LEFT_RIGHT:
+ enc->wp_config->flags |= CONFIG_JOINT_OVERRIDE;
+ enc->wp_config->flags &= ~CONFIG_JOINT_STEREO;
+ break;
+ case GST_WAVPACK_JS_MODE_MID_SIDE:
+ enc->wp_config->flags |= (CONFIG_JOINT_OVERRIDE | CONFIG_JOINT_STEREO);
+ break;
+ }
+}
+
+static int
+gst_wavpack_enc_push_block (void *id, void *data, int32_t count)
+{
+ GstWavpackEncWriteID *wid = (GstWavpackEncWriteID *) id;
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (wid->wavpack_enc);
+ GstFlowReturn *flow;
+ GstBuffer *buffer;
+ GstPad *pad;
+ guchar *block = (guchar *) data;
+ gint samples = 0;
+
+ pad = (wid->correction) ? enc->wvcsrcpad : GST_AUDIO_ENCODER_SRC_PAD (enc);
+ flow =
+ (wid->correction) ? &enc->
+ wvcsrcpad_last_return : &enc->srcpad_last_return;
+
+ buffer = gst_buffer_new_and_alloc (count);
+ gst_buffer_fill (buffer, 0, data, count);
+
+ if (count > sizeof (WavpackHeader) && memcmp (block, "wvpk", 4) == 0) {
+ /* if it's a Wavpack block set buffer timestamp and duration, etc */
+ WavpackHeader wph;
+
+ GST_LOG_OBJECT (enc, "got %d bytes of encoded wavpack %sdata",
+ count, (wid->correction) ? "correction " : "");
+
+ gst_wavpack_read_header (&wph, block);
+
+ /* Only set when pushing the first buffer again, in that case
+ * we don't want to delay the buffer or push newsegment events
+ */
+ if (!wid->passthrough) {
+ /* Only push complete blocks */
+ if (enc->pending_buffer == NULL) {
+ enc->pending_buffer = buffer;
+ enc->pending_offset = wph.block_index;
+ } else if (enc->pending_offset == wph.block_index) {
+ enc->pending_buffer = gst_buffer_append (enc->pending_buffer, buffer);
+ } else {
+ GST_ERROR ("Got incomplete block, dropping");
+ gst_buffer_unref (enc->pending_buffer);
+ enc->pending_buffer = buffer;
+ enc->pending_offset = wph.block_index;
+ }
+
+ /* Is this the not-final block of multi-channel data? If so, just
+ * accumulate and return here. */
+ if (!(wph.flags & FINAL_BLOCK) && ((block[32] & ID_OPTIONAL_DATA) == 0))
+ return TRUE;
+
+ buffer = enc->pending_buffer;
+ enc->pending_buffer = NULL;
+ enc->pending_offset = 0;
+
+ /* only send segment on correction pad,
+ * regular pad is handled normally by baseclass */
+ if (wid->correction && enc->pending_segment) {
+ gst_pad_push_event (pad, enc->pending_segment);
+ enc->pending_segment = NULL;
+ }
+
+ if (wph.block_index == 0) {
+ /* save header for later reference, so we can re-send it later on
+ * EOS with fixed up values for total sample count etc. */
+ if (enc->first_block == NULL && !wid->correction) {
+ GstMapInfo map;
+
+ gst_buffer_map (buffer, &map, GST_MAP_READ);
+ enc->first_block = g_memdup (map.data, map.size);
+ enc->first_block_size = map.size;
+ gst_buffer_unmap (buffer, &map);
+ }
+ }
+ }
+ samples = wph.block_samples;
+
+ /* decorate buffer */
+ /* NOTE: this will get overwritten by baseclass, but stay for those
+ * that are pushed directly
+ * FIXME: add setting to baseclass to avoid overwriting it ?? */
+ GST_BUFFER_OFFSET (buffer) = wph.block_index;
+ GST_BUFFER_OFFSET_END (buffer) = wph.block_index + wph.block_samples;
+ } else {
+ /* if it's something else set no timestamp and duration on the buffer */
+ GST_DEBUG_OBJECT (enc, "got %d bytes of unknown data", count);
+ }
+
+ if (wid->correction || wid->passthrough) {
+ /* push the buffer and forward errors */
+ GST_DEBUG_OBJECT (enc, "pushing buffer with %" G_GSIZE_FORMAT " bytes",
+ gst_buffer_get_size (buffer));
+ *flow = gst_pad_push (pad, buffer);
+ } else {
+ GST_DEBUG_OBJECT (enc, "handing frame of %" G_GSIZE_FORMAT " bytes",
+ gst_buffer_get_size (buffer));
+ *flow = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), buffer,
+ samples);
+ }
+
+ if (*flow != GST_FLOW_OK) {
+ GST_WARNING_OBJECT (enc, "flow on %s:%s = %s",
+ GST_DEBUG_PAD_NAME (pad), gst_flow_get_name (*flow));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+gst_wavpack_enc_fix_channel_order (GstWavpackEnc * enc, gint32 * data,
+ gint nsamples)
+{
+ gint i, j;
+ gint32 tmp[8];
+
+ for (i = 0; i < nsamples / enc->channels; i++) {
+ for (j = 0; j < enc->channels; j++) {
+ tmp[enc->channel_mapping[j]] = data[j];
+ }
+ for (j = 0; j < enc->channels; j++) {
+ data[j] = tmp[j];
+ }
+ data += enc->channels;
+ }
+}
+
+static GstFlowReturn
+gst_wavpack_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf)
+{
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (benc);
+ uint32_t sample_count;
+ GstFlowReturn ret;
+ GstMapInfo map;
+
+ /* base class ensures configuration */
+ g_return_val_if_fail (enc->depth != 0, GST_FLOW_NOT_NEGOTIATED);
+
+ /* reset the last returns to GST_FLOW_OK. This is only set to something else
+ * while WavpackPackSamples() or more specific gst_wavpack_enc_push_block()
+ * so not valid anymore */
+ enc->srcpad_last_return = enc->wvcsrcpad_last_return = GST_FLOW_OK;
+
+ if (G_UNLIKELY (!buf))
+ return gst_wavpack_enc_drain (enc);
+
+ sample_count = gst_buffer_get_size (buf) / 4;
+ GST_DEBUG_OBJECT (enc, "got %u raw samples", sample_count);
+
+ /* check if we already have a valid WavpackContext, otherwise make one */
+ if (!enc->wp_context) {
+ /* create raw context */
+ enc->wp_context =
+ WavpackOpenFileOutput (gst_wavpack_enc_push_block, &enc->wv_id,
+ (enc->correction_mode > 0) ? &enc->wvc_id : NULL);
+ if (!enc->wp_context)
+ goto context_failed;
+
+ /* set the WavpackConfig according to our parameters */
+ gst_wavpack_enc_set_wp_config (enc);
+
+ /* set the configuration to the context now that we know everything
+ * and initialize the encoder */
+ if (!WavpackSetConfiguration (enc->wp_context,
+ enc->wp_config, (uint32_t) (-1))
+ || !WavpackPackInit (enc->wp_context)) {
+ WavpackCloseFile (enc->wp_context);
+ goto config_failed;
+ }
+ GST_DEBUG_OBJECT (enc, "setup of encoding context successfull");
+ }
+
+ if (enc->need_channel_remap) {
+ buf = gst_buffer_make_writable (buf);
+ gst_buffer_map (buf, &map, GST_MAP_WRITE);
+ gst_wavpack_enc_fix_channel_order (enc, (gint32 *) map.data, sample_count);
+ gst_buffer_unmap (buf, &map);
+ }
+
+ gst_buffer_map (buf, &map, GST_MAP_READ);
+
+ /* if we want to append the MD5 sum to the stream update it here
+ * with the current raw samples */
+ if (enc->md5) {
+ g_checksum_update (enc->md5_context, map.data, map.size);
+ }
+
+ /* encode and handle return values from encoding */
+ if (WavpackPackSamples (enc->wp_context, (int32_t *) map.data,
+ sample_count / enc->channels)) {
+ GST_DEBUG_OBJECT (enc, "encoding samples successful");
+ gst_buffer_unmap (buf, &map);
+ ret = GST_FLOW_OK;
+ } else {
+ gst_buffer_unmap (buf, &map);
+ if ((enc->srcpad_last_return == GST_FLOW_OK) ||
+ (enc->wvcsrcpad_last_return == GST_FLOW_OK)) {
+ ret = GST_FLOW_OK;
+ } else if ((enc->srcpad_last_return == GST_FLOW_NOT_LINKED) &&
+ (enc->wvcsrcpad_last_return == GST_FLOW_NOT_LINKED)) {
+ ret = GST_FLOW_NOT_LINKED;
+ } else if ((enc->srcpad_last_return == GST_FLOW_FLUSHING) &&
+ (enc->wvcsrcpad_last_return == GST_FLOW_FLUSHING)) {
+ ret = GST_FLOW_FLUSHING;
+ } else {
+ goto encoding_failed;
+ }
+ }
+
+exit:
+ return ret;
+
+ /* ERRORS */
+encoding_failed:
+ {
+ GST_ELEMENT_ERROR (enc, LIBRARY, ENCODE, (NULL),
+ ("encoding samples failed"));
+ ret = GST_FLOW_ERROR;
+ goto exit;
+ }
+config_failed:
+ {
+ GST_ELEMENT_ERROR (enc, LIBRARY, SETTINGS, (NULL),
+ ("error setting up wavpack encoding context"));
+ ret = GST_FLOW_ERROR;
+ goto exit;
+ }
+context_failed:
+ {
+ GST_ELEMENT_ERROR (enc, LIBRARY, INIT, (NULL),
+ ("error creating Wavpack context"));
+ ret = GST_FLOW_ERROR;
+ goto exit;
+ }
+}
+
+static void
+gst_wavpack_enc_rewrite_first_block (GstWavpackEnc * enc)
+{
+ GstSegment segment;
+ gboolean ret;
+ GstQuery *query;
+ gboolean seekable = FALSE;
+
+ g_return_if_fail (enc);
+ g_return_if_fail (enc->first_block);
+
+ /* update the sample count in the first block */
+ WavpackUpdateNumSamples (enc->wp_context, enc->first_block);
+
+ /* try to seek to the beginning of the output */
+ query = gst_query_new_seeking (GST_FORMAT_BYTES);
+ if (gst_pad_peer_query (GST_AUDIO_ENCODER_SRC_PAD (enc), query)) {
+ GstFormat format;
+
+ gst_query_parse_seeking (query, &format, &seekable, NULL, NULL);
+ if (format != GST_FORMAT_BYTES)
+ seekable = FALSE;
+ } else {
+ GST_LOG_OBJECT (enc, "SEEKING query not handled");
+ }
+ gst_query_unref (query);
+
+ if (!seekable) {
+ GST_DEBUG_OBJECT (enc, "downstream not seekable; not rewriting");
+ return;
+ }
+
+ gst_segment_init (&segment, GST_FORMAT_BYTES);
+ ret = gst_pad_push_event (GST_AUDIO_ENCODER_SRC_PAD (enc),
+ gst_event_new_segment (&segment));
+ if (ret) {
+ /* try to rewrite the first block */
+ GST_DEBUG_OBJECT (enc, "rewriting first block ...");
+ enc->wv_id.passthrough = TRUE;
+ ret = gst_wavpack_enc_push_block (&enc->wv_id,
+ enc->first_block, enc->first_block_size);
+ enc->wv_id.passthrough = FALSE;
+ g_free (enc->first_block);
+ enc->first_block = NULL;
+ } else {
+ GST_WARNING_OBJECT (enc, "rewriting of first block failed. "
+ "Seeking to first block failed!");
+ }
+}
+
+static GstFlowReturn
+gst_wavpack_enc_drain (GstWavpackEnc * enc)
+{
+ if (!enc->wp_context)
+ return GST_FLOW_OK;
+
+ GST_DEBUG_OBJECT (enc, "draining");
+
+ /* Encode all remaining samples and flush them to the src pads */
+ WavpackFlushSamples (enc->wp_context);
+
+ /* Drop all remaining data, this is no complete block otherwise
+ * it would've been pushed already */
+ if (enc->pending_buffer) {
+ gst_buffer_unref (enc->pending_buffer);
+ enc->pending_buffer = NULL;
+ enc->pending_offset = 0;
+ }
+
+ /* write the MD5 sum if we have to write one */
+ if ((enc->md5) && (enc->md5_context)) {
+ guint8 md5_digest[16];
+ gsize digest_len = sizeof (md5_digest);
+
+ g_checksum_get_digest (enc->md5_context, md5_digest, &digest_len);
+ if (digest_len == sizeof (md5_digest)) {
+ WavpackStoreMD5Sum (enc->wp_context, md5_digest);
+ WavpackFlushSamples (enc->wp_context);
+ } else
+ GST_WARNING_OBJECT (enc, "Calculating MD5 digest failed");
+ }
+
+ /* Try to rewrite the first frame with the correct sample number */
+ if (enc->first_block)
+ gst_wavpack_enc_rewrite_first_block (enc);
+
+ /* close the context if not already happened */
+ if (enc->wp_context) {
+ WavpackCloseFile (enc->wp_context);
+ enc->wp_context = NULL;
+ }
+
+ return GST_FLOW_OK;
+}
+
+static gboolean
+gst_wavpack_enc_sink_event (GstAudioEncoder * benc, GstEvent * event)
+{
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (benc);
+
+ GST_DEBUG_OBJECT (enc, "Received %s event on sinkpad",
+ GST_EVENT_TYPE_NAME (event));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_SEGMENT:
+ if (enc->wp_context) {
+ GST_WARNING_OBJECT (enc, "got NEWSEGMENT after encoding "
+ "already started");
+ }
+ /* peek and hold NEWSEGMENT events for sending on correction pad */
+ if (enc->pending_segment)
+ gst_event_unref (enc->pending_segment);
+ enc->pending_segment = gst_event_ref (event);
+ break;
+ default:
+ break;
+ }
+
+ /* baseclass handles rest */
+ return GST_AUDIO_ENCODER_CLASS (parent_class)->sink_event (benc, event);
+}
+
+static void
+gst_wavpack_enc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (object);
+
+ switch (prop_id) {
+ case ARG_MODE:
+ enc->mode = g_value_get_enum (value);
+ break;
+ case ARG_BITRATE:{
+ guint val = g_value_get_uint (value);
+
+ if ((val >= 24000) && (val <= 9600000)) {
+ enc->bitrate = val;
+ enc->bps = 0.0;
+ } else {
+ enc->bitrate = 0;
+ enc->bps = 0.0;
+ }
+ break;
+ }
+ case ARG_BITSPERSAMPLE:{
+ gdouble val = g_value_get_double (value);
+
+ if ((val >= 2.0) && (val <= 24.0)) {
+ enc->bps = val;
+ enc->bitrate = 0;
+ } else {
+ enc->bps = 0.0;
+ enc->bitrate = 0;
+ }
+ break;
+ }
+ case ARG_CORRECTION_MODE:
+ enc->correction_mode = g_value_get_enum (value);
+ break;
+ case ARG_MD5:
+ enc->md5 = g_value_get_boolean (value);
+ break;
+ case ARG_EXTRA_PROCESSING:
+ enc->extra_processing = g_value_get_uint (value);
+ break;
+ case ARG_JOINT_STEREO_MODE:
+ enc->joint_stereo_mode = g_value_get_enum (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_wavpack_enc_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
+{
+ GstWavpackEnc *enc = GST_WAVPACK_ENC (object);
+
+ switch (prop_id) {
+ case ARG_MODE:
+ g_value_set_enum (value, enc->mode);
+ break;
+ case ARG_BITRATE:
+ if (enc->bps == 0.0) {
+ g_value_set_uint (value, enc->bitrate);
+ } else {
+ g_value_set_uint (value, 0);
+ }
+ break;
+ case ARG_BITSPERSAMPLE:
+ if (enc->bitrate == 0) {
+ g_value_set_double (value, enc->bps);
+ } else {
+ g_value_set_double (value, 0.0);
+ }
+ break;
+ case ARG_CORRECTION_MODE:
+ g_value_set_enum (value, enc->correction_mode);
+ break;
+ case ARG_MD5:
+ g_value_set_boolean (value, enc->md5);
+ break;
+ case ARG_EXTRA_PROCESSING:
+ g_value_set_uint (value, enc->extra_processing);
+ break;
+ case ARG_JOINT_STEREO_MODE:
+ g_value_set_enum (value, enc->joint_stereo_mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+gboolean
+gst_wavpack_enc_plugin_init (GstPlugin * plugin)
+{
+ if (!gst_element_register (plugin, "wavpackenc",
+ GST_RANK_NONE, GST_TYPE_WAVPACK_ENC))
+ return FALSE;
+
+ GST_DEBUG_CATEGORY_INIT (gst_wavpack_enc_debug, "wavpackenc", 0,
+ "Wavpack encoder");
+
+ return TRUE;
+}
diff --git a/ext/wavpack/gstwavpackenc.h b/ext/wavpack/gstwavpackenc.h
new file mode 100644
index 0000000..26a5b11
--- /dev/null
+++ b/ext/wavpack/gstwavpackenc.h
@@ -0,0 +1,105 @@
+/* GStreamer Wavpack encoder plugin
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackenc.h: Wavpack audio encoder
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WAVPACK_ENC_H__
+#define __GST_WAVPACK_ENC_H__
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudioencoder.h>
+
+#include <wavpack/wavpack.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_WAVPACK_ENC \
+ (gst_wavpack_enc_get_type())
+#define GST_WAVPACK_ENC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVPACK_ENC,GstWavpackEnc))
+#define GST_WAVPACK_ENC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVPACK_ENC,GstWavpackEnc))
+#define GST_IS_WAVPACK_ENC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVPACK_ENC))
+#define GST_IS_WAVPACK_ENC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVPACK_ENC))
+typedef struct _GstWavpackEnc GstWavpackEnc;
+typedef struct _GstWavpackEncClass GstWavpackEncClass;
+
+typedef struct
+{
+ gboolean correction;
+ GstWavpackEnc *wavpack_enc;
+ gboolean passthrough;
+} GstWavpackEncWriteID;
+
+
+struct _GstWavpackEnc
+{
+ GstAudioEncoder element;
+
+ /*< private > */
+ GstPad *wvcsrcpad;
+
+ GstFlowReturn srcpad_last_return;
+ GstFlowReturn wvcsrcpad_last_return;
+
+ WavpackConfig *wp_config;
+ WavpackContext *wp_context;
+
+ gint samplerate;
+ gint channels;
+ gint channel_mask;
+ gint8 channel_mapping[8];
+ gboolean need_channel_remap;
+ gint depth;
+
+ GstWavpackEncWriteID wv_id;
+ GstWavpackEncWriteID wvc_id;
+
+ guint mode;
+ guint bitrate;
+ gdouble bps;
+ guint correction_mode;
+ gboolean md5;
+ GChecksum *md5_context;
+ guint extra_processing;
+ guint joint_stereo_mode;
+
+ void *first_block;
+ int32_t first_block_size;
+
+ GstBuffer *pending_buffer;
+ gint32 pending_offset;
+ GstEvent *pending_segment;
+
+ GstClockTime timestamp_offset;
+ GstClockTime next_ts;
+};
+
+struct _GstWavpackEncClass
+{
+ GstAudioEncoderClass parent;
+};
+
+GType gst_wavpack_enc_get_type (void);
+
+gboolean gst_wavpack_enc_plugin_init (GstPlugin * plugin);
+
+G_END_DECLS
+#endif /* __GST_WAVPACK_ENC_H__ */
diff --git a/ext/wavpack/gstwavpackstreamreader.c b/ext/wavpack/gstwavpackstreamreader.c
new file mode 100755
index 0000000..dd29a37
--- /dev/null
+++ b/ext/wavpack/gstwavpackstreamreader.c
@@ -0,0 +1,125 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackstreamreader.c: stream reader used for decoding
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <math.h>
+#include <gst/gst.h>
+
+#include "gstwavpackstreamreader.h"
+
+GST_DEBUG_CATEGORY_EXTERN (wavpack_debug);
+#define GST_CAT_DEFAULT wavpack_debug
+
+static int32_t
+gst_wavpack_stream_reader_read_bytes (void *id, void *data, int32_t bcount)
+{
+ read_id *rid = (read_id *) id;
+ uint32_t left = rid->length - rid->position;
+ uint32_t to_read = MIN (left, bcount);
+
+ GST_DEBUG ("Trying to read %d of %d bytes from position %d", bcount,
+ rid->length, rid->position);
+
+ if (to_read > 0) {
+ memmove (data, rid->buffer + rid->position, to_read);
+ rid->position += to_read;
+ return to_read;
+ } else {
+ GST_WARNING ("Couldn't read %d bytes", bcount);
+ return 0;
+ }
+}
+
+static uint32_t
+gst_wavpack_stream_reader_get_pos (void *id)
+{
+ GST_DEBUG ("Returning position %d", ((read_id *) id)->position);
+ return ((read_id *) id)->position;
+}
+
+static int
+gst_wavpack_stream_reader_set_pos_abs (void *id, uint32_t pos)
+{
+ GST_WARNING ("Should not be called: tried to set absolute position to %d",
+ pos);
+ return -1;
+}
+
+static int
+gst_wavpack_stream_reader_set_pos_rel (void *id, int32_t delta, int mode)
+{
+ GST_WARNING ("Should not be called: tried to set relative position to %d"
+ " with mode %d", delta, mode);
+ return -1;
+}
+
+static int
+gst_wavpack_stream_reader_push_back_byte (void *id, int c)
+{
+ read_id *rid = (read_id *) id;
+
+ GST_DEBUG ("Pushing back one byte: 0x%x", c);
+
+ if (rid->position == 0)
+ return rid->position;
+
+ rid->position -= 1;
+ return rid->position;
+}
+
+static uint32_t
+gst_wavpack_stream_reader_get_length (void *id)
+{
+ GST_DEBUG ("Returning length %d", ((read_id *) id)->length);
+
+ return ((read_id *) id)->length;
+}
+
+static int
+gst_wavpack_stream_reader_can_seek (void *id)
+{
+ GST_DEBUG ("Can't seek");
+ return FALSE;
+}
+
+static int32_t
+gst_wavpack_stream_reader_write_bytes (void *id, void *data, int32_t bcount)
+{
+ GST_WARNING ("Should not be called, tried to write %d bytes", bcount);
+ return 0;
+}
+
+WavpackStreamReader *
+gst_wavpack_stream_reader_new (void)
+{
+ WavpackStreamReader *stream_reader =
+ (WavpackStreamReader *) g_malloc0 (sizeof (WavpackStreamReader));
+ stream_reader->read_bytes = gst_wavpack_stream_reader_read_bytes;
+ stream_reader->get_pos = gst_wavpack_stream_reader_get_pos;
+ stream_reader->set_pos_abs = gst_wavpack_stream_reader_set_pos_abs;
+ stream_reader->set_pos_rel = gst_wavpack_stream_reader_set_pos_rel;
+ stream_reader->push_back_byte = gst_wavpack_stream_reader_push_back_byte;
+ stream_reader->get_length = gst_wavpack_stream_reader_get_length;
+ stream_reader->can_seek = gst_wavpack_stream_reader_can_seek;
+ stream_reader->write_bytes = gst_wavpack_stream_reader_write_bytes;
+
+ return stream_reader;
+}
diff --git a/ext/wavpack/gstwavpackstreamreader.h b/ext/wavpack/gstwavpackstreamreader.h
new file mode 100644
index 0000000..17412cc
--- /dev/null
+++ b/ext/wavpack/gstwavpackstreamreader.h
@@ -0,0 +1,36 @@
+/* GStreamer Wavpack plugin
+ * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstwavpackstreamreader.h: stream reader used for decoding
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WAVPACK_STREAM_READER_H__
+#define __GST_WAVPACK_STREAM_READER_H__
+
+#include <wavpack/wavpack.h>
+
+typedef struct
+{
+ guint8 *buffer;
+ uint32_t length;
+ uint32_t position;
+} read_id;
+
+WavpackStreamReader *gst_wavpack_stream_reader_new (void);
+
+#endif