diff options
author | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:14:42 +0900 |
---|---|---|
committer | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:14:42 +0900 |
commit | 715f9ce62a12d128754d2cf47f90a024b537e320 (patch) | |
tree | 57fb94c81055a31938bea831641092152a03089f /ext/speex | |
parent | dfa84b358c7cdf0535eba1fead62fc4122cc56e6 (diff) | |
download | gst-plugins-good0.10-tizen_2.0.tar.gz gst-plugins-good0.10-tizen_2.0.tar.bz2 gst-plugins-good0.10-tizen_2.0.zip |
Diffstat (limited to 'ext/speex')
-rw-r--r-- | ext/speex/Makefile.am | 18 | ||||
-rw-r--r-- | ext/speex/Makefile.in | 834 | ||||
-rw-r--r-- | ext/speex/gstspeex.c | 49 | ||||
-rw-r--r-- | ext/speex/gstspeexdec.c | 549 | ||||
-rw-r--r-- | ext/speex/gstspeexdec.h | 80 | ||||
-rw-r--r-- | ext/speex/gstspeexenc.c | 850 | ||||
-rw-r--r-- | ext/speex/gstspeexenc.h | 102 |
7 files changed, 2482 insertions, 0 deletions
diff --git a/ext/speex/Makefile.am b/ext/speex/Makefile.am new file mode 100644 index 0000000..fe55237 --- /dev/null +++ b/ext/speex/Makefile.am @@ -0,0 +1,18 @@ +plugin_LTLIBRARIES = libgstspeex.la + +libgstspeex_la_SOURCES = gstspeex.c gstspeexdec.c gstspeexenc.c +libgstspeex_la_CFLAGS = -DGST_USE_UNSTABLE_API \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + $(SPEEX_CFLAGS) +libgstspeex_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) \ + -lgsttag-$(GST_MAJORMINOR) -lgstaudio-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(SPEEX_LIBS) +libgstspeex_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM) +libgstspeex_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = gstspeexenc.h gstspeexdec.h diff --git a/ext/speex/Makefile.in b/ext/speex/Makefile.in new file mode 100644 index 0000000..8f5bcef --- /dev/null +++ b/ext/speex/Makefile.in @@ -0,0 +1,834 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = ext/speex +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +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-objc.m4 \ + $(top_srcdir)/common/m4/as-python.m4 \ + $(top_srcdir)/common/m4/as-scrub-include.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/esd.m4 \ + $(top_srcdir)/m4/gconf-2.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 = +libgstspeex_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libgstspeex_la_OBJECTS = libgstspeex_la-gstspeex.lo \ + libgstspeex_la-gstspeexdec.lo libgstspeex_la-gstspeexenc.lo +libgstspeex_la_OBJECTS = $(am_libgstspeex_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libgstspeex_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(libgstspeex_la_CFLAGS) $(CFLAGS) \ + $(libgstspeex_la_LDFLAGS) $(LDFLAGS) -o $@ +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_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +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_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libgstspeex_la_SOURCES) +DIST_SOURCES = $(libgstspeex_la_SOURCES) +HEADERS = $(noinst_HEADERS) +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@ +ANNODEX_CFLAGS = @ANNODEX_CFLAGS@ +ANNODEX_LIBS = @ANNODEX_LIBS@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BZ2_LIBS = @BZ2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_GOBJECT_CFLAGS = @CAIRO_GOBJECT_CFLAGS@ +CAIRO_GOBJECT_LIBS = @CAIRO_GOBJECT_LIBS@ +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@ +ESD_CFLAGS = @ESD_CFLAGS@ +ESD_CONFIG = @ESD_CONFIG@ +ESD_LIBS = @ESD_LIBS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC_CFLAGS = @FLAC_CFLAGS@ +FLAC_LIBS = @FLAC_LIBS@ +GCONFTOOL = @GCONFTOOL@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +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_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +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_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +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_CXXFLAGS = @GST_CXXFLAGS@ +GST_GDP_CFLAGS = @GST_GDP_CFLAGS@ +GST_GDP_LIBS = @GST_GDP_LIBS@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBS = @GST_LIBS@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GST_OPTION_CFLAGS = @GST_OPTION_CFLAGS@ +GST_OPTION_CXXFLAGS = @GST_OPTION_CXXFLAGS@ +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_SELECTED = @GST_PLUGINS_SELECTED@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PREFIX = @GST_PREFIX@ +GST_TOOLS_DIR = @GST_TOOLS_DIR@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +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@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +HAVE_AVC1394 = @HAVE_AVC1394@ +HAVE_BZ2 = @HAVE_BZ2@ +HAVE_CXX = @HAVE_CXX@ +HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@ +HAVE_GCONFTOOL = @HAVE_GCONFTOOL@ +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@ +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@ +OBJC_LDFLAGS = @OBJC_LDFLAGS@ +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_0_9_20_CFLAGS = @PULSE_0_9_20_CFLAGS@ +PULSE_0_9_20_LIBS = @PULSE_0_9_20_LIBS@ +PULSE_1_0_CFLAGS = @PULSE_1_0_CFLAGS@ +PULSE_1_0_LIBS = @PULSE_1_0_LIBS@ +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@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ +WAVPACK_CFLAGS = @WAVPACK_CFLAGS@ +WAVPACK_LIBS = @WAVPACK_LIBS@ +WIN32_LIBS = @WIN32_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@ +XVIDEO_LIBS = @XVIDEO_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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_LTLIBRARIES = libgstspeex.la +libgstspeex_la_SOURCES = gstspeex.c gstspeexdec.c gstspeexenc.c +libgstspeex_la_CFLAGS = -DGST_USE_UNSTABLE_API \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + $(SPEEX_CFLAGS) + +libgstspeex_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) \ + -lgsttag-$(GST_MAJORMINOR) -lgstaudio-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(SPEEX_LIBS) + +libgstspeex_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM) +libgstspeex_la_LIBTOOLFLAGS = --tag=disable-static +noinst_HEADERS = gstspeexenc.h gstspeexdec.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/speex/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu ext/speex/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) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgstspeex.la: $(libgstspeex_la_OBJECTS) $(libgstspeex_la_DEPENDENCIES) $(EXTRA_libgstspeex_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgstspeex_la_LINK) -rpath $(plugindir) $(libgstspeex_la_OBJECTS) $(libgstspeex_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstspeex_la-gstspeex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstspeex_la-gstspeexdec.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstspeex_la-gstspeexenc.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $@ $< + +libgstspeex_la-gstspeex.lo: gstspeex.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -MT libgstspeex_la-gstspeex.lo -MD -MP -MF $(DEPDIR)/libgstspeex_la-gstspeex.Tpo -c -o libgstspeex_la-gstspeex.lo `test -f 'gstspeex.c' || echo '$(srcdir)/'`gstspeex.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstspeex_la-gstspeex.Tpo $(DEPDIR)/libgstspeex_la-gstspeex.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstspeex.c' object='libgstspeex_la-gstspeex.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 $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -c -o libgstspeex_la-gstspeex.lo `test -f 'gstspeex.c' || echo '$(srcdir)/'`gstspeex.c + +libgstspeex_la-gstspeexdec.lo: gstspeexdec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -MT libgstspeex_la-gstspeexdec.lo -MD -MP -MF $(DEPDIR)/libgstspeex_la-gstspeexdec.Tpo -c -o libgstspeex_la-gstspeexdec.lo `test -f 'gstspeexdec.c' || echo '$(srcdir)/'`gstspeexdec.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstspeex_la-gstspeexdec.Tpo $(DEPDIR)/libgstspeex_la-gstspeexdec.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstspeexdec.c' object='libgstspeex_la-gstspeexdec.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 $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -c -o libgstspeex_la-gstspeexdec.lo `test -f 'gstspeexdec.c' || echo '$(srcdir)/'`gstspeexdec.c + +libgstspeex_la-gstspeexenc.lo: gstspeexenc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -MT libgstspeex_la-gstspeexenc.lo -MD -MP -MF $(DEPDIR)/libgstspeex_la-gstspeexenc.Tpo -c -o libgstspeex_la-gstspeexenc.lo `test -f 'gstspeexenc.c' || echo '$(srcdir)/'`gstspeexenc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstspeex_la-gstspeexenc.Tpo $(DEPDIR)/libgstspeex_la-gstspeexenc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstspeexenc.c' object='libgstspeex_la-gstspeexenc.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 $(libgstspeex_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstspeex_la_CFLAGS) $(CFLAGS) -c -o libgstspeex_la-gstspeexenc.lo `test -f 'gstspeexenc.c' || echo '$(srcdir)/'`gstspeexenc.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(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 all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-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 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/speex/gstspeex.c b/ext/speex/gstspeex.c new file mode 100644 index 0000000..3cd7cbf --- /dev/null +++ b/ext/speex/gstspeex.c @@ -0,0 +1,49 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gstspeexdec.h" +#include "gstspeexenc.h" + +#include <gst/tag/tag.h> + +static gboolean +plugin_init (GstPlugin * plugin) +{ + + if (!gst_element_register (plugin, "speexenc", GST_RANK_PRIMARY, + GST_TYPE_SPEEX_ENC)) + return FALSE; + + if (!gst_element_register (plugin, "speexdec", GST_RANK_PRIMARY, + GST_TYPE_SPEEX_DEC)) + return FALSE; + + gst_tag_register_musicbrainz_tags (); + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "speex", + "Speex plugin library", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c new file mode 100644 index 0000000..e1d80b6 --- /dev/null +++ b/ext/speex/gstspeexdec.c @@ -0,0 +1,549 @@ +/* GStreamer + * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> + * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:element-speexdec + * @see_also: speexenc, oggdemux + * + * This element decodes a Speex stream to raw integer audio. + * <ulink url="http://www.speex.org/">Speex</ulink> is a royalty-free + * audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org + * Foundation</ulink>. + * + * <refsect2> + * <title>Example pipelines</title> + * |[ + * gst-launch -v filesrc location=speex.ogg ! oggdemux ! speexdec ! audioconvert ! audioresample ! alsasink + * ]| Decode an Ogg/Speex file. To create an Ogg/Speex file refer to the + * documentation of speexenc. + * </refsect2> + * + * Last reviewed on 2006-04-05 (0.10.2) + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstspeexdec.h" +#include <stdlib.h> +#include <string.h> +#include <gst/tag/tag.h> + +GST_DEBUG_CATEGORY_STATIC (speexdec_debug); +#define GST_CAT_DEFAULT speexdec_debug + +#define DEFAULT_ENH TRUE + +enum +{ + ARG_0, + ARG_ENH +}; + +static GstStaticPadTemplate speex_dec_src_factory = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 6000, 48000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16") + ); + +static GstStaticPadTemplate speex_dec_sink_factory = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-speex") + ); + +GST_BOILERPLATE (GstSpeexDec, gst_speex_dec, GstAudioDecoder, + GST_TYPE_AUDIO_DECODER); + + +static gboolean gst_speex_dec_start (GstAudioDecoder * dec); +static gboolean gst_speex_dec_stop (GstAudioDecoder * dec); +static gboolean gst_speex_dec_set_format (GstAudioDecoder * bdec, + GstCaps * caps); +static GstFlowReturn gst_speex_dec_handle_frame (GstAudioDecoder * dec, + GstBuffer * buffer); + +static void gst_speex_dec_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static void gst_speex_dec_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); + +static void +gst_speex_dec_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_static_pad_template (element_class, + &speex_dec_src_factory); + gst_element_class_add_static_pad_template (element_class, + &speex_dec_sink_factory); + gst_element_class_set_details_simple (element_class, "Speex audio decoder", + "Codec/Decoder/Audio", + "decode speex streams to audio", "Wim Taymans <wim@fluendo.com>"); +} + +static void +gst_speex_dec_class_init (GstSpeexDecClass * klass) +{ + GObjectClass *gobject_class; + GstAudioDecoderClass *base_class; + + gobject_class = (GObjectClass *) klass; + base_class = (GstAudioDecoderClass *) klass; + + gobject_class->set_property = gst_speex_dec_set_property; + gobject_class->get_property = gst_speex_dec_get_property; + + base_class->start = GST_DEBUG_FUNCPTR (gst_speex_dec_start); + base_class->stop = GST_DEBUG_FUNCPTR (gst_speex_dec_stop); + base_class->set_format = GST_DEBUG_FUNCPTR (gst_speex_dec_set_format); + base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_speex_dec_handle_frame); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ENH, + g_param_spec_boolean ("enh", "Enh", "Enable perceptual enhancement", + DEFAULT_ENH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + GST_DEBUG_CATEGORY_INIT (speexdec_debug, "speexdec", 0, + "speex decoding element"); +} + +static void +gst_speex_dec_reset (GstSpeexDec * dec) +{ + dec->packetno = 0; + dec->frame_size = 0; + dec->frame_duration = 0; + dec->mode = NULL; + free (dec->header); + dec->header = NULL; + speex_bits_destroy (&dec->bits); + + gst_buffer_replace (&dec->streamheader, NULL); + gst_buffer_replace (&dec->vorbiscomment, NULL); + + if (dec->stereo) { + speex_stereo_state_destroy (dec->stereo); + dec->stereo = NULL; + } + + if (dec->state) { + speex_decoder_destroy (dec->state); + dec->state = NULL; + } +} + +static void +gst_speex_dec_init (GstSpeexDec * dec, GstSpeexDecClass * g_class) +{ + dec->enh = DEFAULT_ENH; + + gst_speex_dec_reset (dec); +} + +static gboolean +gst_speex_dec_start (GstAudioDecoder * dec) +{ + GstSpeexDec *sd = GST_SPEEX_DEC (dec); + + GST_DEBUG_OBJECT (dec, "start"); + gst_speex_dec_reset (sd); + + /* we know about concealment */ + gst_audio_decoder_set_plc_aware (dec, TRUE); + + return TRUE; +} + +static gboolean +gst_speex_dec_stop (GstAudioDecoder * dec) +{ + GstSpeexDec *sd = GST_SPEEX_DEC (dec); + + GST_DEBUG_OBJECT (dec, "stop"); + gst_speex_dec_reset (sd); + + return TRUE; +} + +static GstFlowReturn +gst_speex_dec_parse_header (GstSpeexDec * dec, GstBuffer * buf) +{ + GstCaps *caps; + + /* get the header */ + dec->header = speex_packet_to_header ((char *) GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)); + + if (!dec->header) + goto no_header; + + if (dec->header->mode >= SPEEX_NB_MODES || dec->header->mode < 0) + goto mode_too_old; + + dec->mode = speex_lib_get_mode (dec->header->mode); + + /* initialize the decoder */ + dec->state = speex_decoder_init (dec->mode); + if (!dec->state) + goto init_failed; + + speex_decoder_ctl (dec->state, SPEEX_SET_ENH, &dec->enh); + speex_decoder_ctl (dec->state, SPEEX_GET_FRAME_SIZE, &dec->frame_size); + + if (dec->header->nb_channels != 1) { + dec->stereo = speex_stereo_state_init (); + dec->callback.callback_id = SPEEX_INBAND_STEREO; + dec->callback.func = speex_std_stereo_request_handler; + dec->callback.data = dec->stereo; + speex_decoder_ctl (dec->state, SPEEX_SET_HANDLER, &dec->callback); + } + + speex_decoder_ctl (dec->state, SPEEX_SET_SAMPLING_RATE, &dec->header->rate); + + dec->frame_duration = gst_util_uint64_scale_int (dec->frame_size, + GST_SECOND, dec->header->rate); + + speex_bits_init (&dec->bits); + + /* set caps */ + caps = gst_caps_new_simple ("audio/x-raw-int", + "rate", G_TYPE_INT, dec->header->rate, + "channels", G_TYPE_INT, dec->header->nb_channels, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL); + + if (!gst_pad_set_caps (GST_AUDIO_DECODER_SRC_PAD (dec), caps)) + goto nego_failed; + + gst_caps_unref (caps); + return GST_FLOW_OK; + + /* ERRORS */ +no_header: + { + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), ("couldn't read header")); + return GST_FLOW_ERROR; + } +mode_too_old: + { + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), + ("Mode number %d does not (yet/any longer) exist in this version", + dec->header->mode)); + return GST_FLOW_ERROR; + } +init_failed: + { + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), ("couldn't initialize decoder")); + return GST_FLOW_ERROR; + } +nego_failed: + { + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), ("couldn't negotiate format")); + gst_caps_unref (caps); + return GST_FLOW_NOT_NEGOTIATED; + } +} + +static GstFlowReturn +gst_speex_dec_parse_comments (GstSpeexDec * dec, GstBuffer * buf) +{ + GstTagList *list; + gchar *ver, *encoder = NULL; + + list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, &encoder); + + if (!list) { + GST_WARNING_OBJECT (dec, "couldn't decode comments"); + list = gst_tag_list_new (); + } + + if (encoder) { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_ENCODER, encoder, NULL); + } + + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_AUDIO_CODEC, "Speex", NULL); + + ver = g_strndup (dec->header->speex_version, SPEEX_HEADER_VERSION_LENGTH); + g_strstrip (ver); + + if (ver != NULL && *ver != '\0') { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_ENCODER_VERSION, ver, NULL); + } + + if (dec->header->bitrate > 0) { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_BITRATE, (guint) dec->header->bitrate, NULL); + } + + GST_INFO_OBJECT (dec, "tags: %" GST_PTR_FORMAT, list); + + gst_element_found_tags_for_pad (GST_ELEMENT (dec), + GST_AUDIO_DECODER_SRC_PAD (dec), list); + + g_free (encoder); + g_free (ver); + + return GST_FLOW_OK; +} + +static gboolean +gst_speex_dec_set_format (GstAudioDecoder * bdec, GstCaps * caps) +{ + GstSpeexDec *dec = GST_SPEEX_DEC (bdec); + gboolean ret = TRUE; + GstStructure *s; + const GValue *streamheader; + + s = gst_caps_get_structure (caps, 0); + if ((streamheader = gst_structure_get_value (s, "streamheader")) && + G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) && + gst_value_array_get_size (streamheader) >= 2) { + const GValue *header, *vorbiscomment; + GstBuffer *buf; + GstFlowReturn res = GST_FLOW_OK; + + header = gst_value_array_get_value (streamheader, 0); + if (header && G_VALUE_HOLDS (header, GST_TYPE_BUFFER)) { + buf = gst_value_get_buffer (header); + res = gst_speex_dec_parse_header (dec, buf); + if (res != GST_FLOW_OK) + goto done; + gst_buffer_replace (&dec->streamheader, buf); + } + + vorbiscomment = gst_value_array_get_value (streamheader, 1); + if (vorbiscomment && G_VALUE_HOLDS (vorbiscomment, GST_TYPE_BUFFER)) { + buf = gst_value_get_buffer (vorbiscomment); + res = gst_speex_dec_parse_comments (dec, buf); + if (res != GST_FLOW_OK) + goto done; + gst_buffer_replace (&dec->vorbiscomment, buf); + } + } + +done: + return ret; +} + +static GstFlowReturn +gst_speex_dec_parse_data (GstSpeexDec * dec, GstBuffer * buf) +{ + GstFlowReturn res = GST_FLOW_OK; + gint i, fpp; + guint size; + guint8 *data; + SpeexBits *bits; + + if (!dec->frame_duration) + goto not_negotiated; + + if (G_LIKELY (GST_BUFFER_SIZE (buf))) { + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + + /* send data to the bitstream */ + speex_bits_read_from (&dec->bits, (char *) data, size); + + fpp = dec->header->frames_per_packet; + bits = &dec->bits; + + GST_DEBUG_OBJECT (dec, "received buffer of size %u, fpp %d, %d bits", + size, fpp, speex_bits_remaining (bits)); + } else { + /* FIXME ? actually consider how much concealment is needed */ + /* concealment data, pass NULL as the bits parameters */ + GST_DEBUG_OBJECT (dec, "creating concealment data"); + fpp = dec->header->frames_per_packet; + bits = NULL; + } + + /* now decode each frame, catering for unknown number of them (e.g. rtp) */ + for (i = 0; i < fpp; i++) { + GstBuffer *outbuf; + gint16 *out_data; + gint ret; + + GST_LOG_OBJECT (dec, "decoding frame %d/%d, %d bits remaining", i, fpp, + bits ? speex_bits_remaining (bits) : -1); + + res = + gst_pad_alloc_buffer_and_set_caps (GST_AUDIO_DECODER_SRC_PAD (dec), + GST_BUFFER_OFFSET_NONE, dec->frame_size * dec->header->nb_channels * 2, + GST_PAD_CAPS (GST_AUDIO_DECODER_SRC_PAD (dec)), &outbuf); + + if (res != GST_FLOW_OK) { + GST_DEBUG_OBJECT (dec, "buf alloc flow: %s", gst_flow_get_name (res)); + return res; + } + + out_data = (gint16 *) GST_BUFFER_DATA (outbuf); + + ret = speex_decode_int (dec->state, bits, out_data); + if (ret == -1) { + /* uh? end of stream */ + if (fpp == 0 && speex_bits_remaining (bits) < 8) { + /* if we did not know how many frames to expect, then we get this + at the end if there are leftover bits to pad to the next byte */ + GST_DEBUG_OBJECT (dec, "Discarding leftover bits"); + } else { + GST_WARNING_OBJECT (dec, "Unexpected end of stream found"); + } + gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1); + gst_buffer_unref (outbuf); + } else if (ret == -2) { + GST_WARNING_OBJECT (dec, "Decoding error: corrupted stream?"); + gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1); + gst_buffer_unref (outbuf); + } + + if (bits && speex_bits_remaining (bits) < 0) { + GST_WARNING_OBJECT (dec, "Decoding overflow: corrupted stream?"); + gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1); + gst_buffer_unref (outbuf); + } + if (dec->header->nb_channels == 2) + speex_decode_stereo_int (out_data, dec->frame_size, dec->stereo); + + res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), outbuf, 1); + + if (res != GST_FLOW_OK) { + GST_DEBUG_OBJECT (dec, "flow: %s", gst_flow_get_name (res)); + break; + } + } + + return res; + + /* ERRORS */ +not_negotiated: + { + GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL), + ("decoder not initialized")); + return GST_FLOW_NOT_NEGOTIATED; + } +} + +static GstFlowReturn +gst_speex_dec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buf) +{ + GstFlowReturn res; + GstSpeexDec *dec; + + /* no fancy draining */ + if (G_UNLIKELY (!buf)) + return GST_FLOW_OK; + + dec = GST_SPEEX_DEC (bdec); + + /* If we have the streamheader and vorbiscomment from the caps already + * ignore them here */ + if (dec->streamheader && dec->vorbiscomment) { + if (GST_BUFFER_SIZE (dec->streamheader) == GST_BUFFER_SIZE (buf) + && memcmp (GST_BUFFER_DATA (dec->streamheader), GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)) == 0) { + GST_DEBUG_OBJECT (dec, "found streamheader"); + gst_audio_decoder_finish_frame (bdec, NULL, 1); + res = GST_FLOW_OK; + } else if (GST_BUFFER_SIZE (dec->vorbiscomment) == GST_BUFFER_SIZE (buf) + && memcmp (GST_BUFFER_DATA (dec->vorbiscomment), GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)) == 0) { + GST_DEBUG_OBJECT (dec, "found vorbiscomments"); + gst_audio_decoder_finish_frame (bdec, NULL, 1); + res = GST_FLOW_OK; + } else { + res = gst_speex_dec_parse_data (dec, buf); + } + } else { + /* Otherwise fall back to packet counting and assume that the + * first two packets are the headers. */ + switch (dec->packetno) { + case 0: + GST_DEBUG_OBJECT (dec, "counted streamheader"); + res = gst_speex_dec_parse_header (dec, buf); + gst_audio_decoder_finish_frame (bdec, NULL, 1); + break; + case 1: + GST_DEBUG_OBJECT (dec, "counted vorbiscomments"); + res = gst_speex_dec_parse_comments (dec, buf); + gst_audio_decoder_finish_frame (bdec, NULL, 1); + break; + default: + { + res = gst_speex_dec_parse_data (dec, buf); + break; + } + } + } + + dec->packetno++; + + return res; +} + +static void +gst_speex_dec_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstSpeexDec *speexdec; + + speexdec = GST_SPEEX_DEC (object); + + switch (prop_id) { + case ARG_ENH: + g_value_set_boolean (value, speexdec->enh); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_speex_dec_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstSpeexDec *speexdec; + + speexdec = GST_SPEEX_DEC (object); + + switch (prop_id) { + case ARG_ENH: + speexdec->enh = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} diff --git a/ext/speex/gstspeexdec.h b/ext/speex/gstspeexdec.h new file mode 100644 index 0000000..8187af8 --- /dev/null +++ b/ext/speex/gstspeexdec.h @@ -0,0 +1,80 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_SPEEX_DEC_H__ +#define __GST_SPEEX_DEC_H__ + +#include <gst/gst.h> +#include <gst/audio/gstaudiodecoder.h> + +#include <speex/speex.h> +#include <speex/speex_callbacks.h> +#include <speex/speex_header.h> +#include <speex/speex_stereo.h> + +G_BEGIN_DECLS + +#define GST_TYPE_SPEEX_DEC \ + (gst_speex_dec_get_type()) +#define GST_SPEEX_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPEEX_DEC,GstSpeexDec)) +#define GST_SPEEX_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPEEX_DEC,GstSpeexDecClass)) +#define GST_IS_SPEEX_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPEEX_DEC)) +#define GST_IS_SPEEX_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPEEX_DEC)) + +typedef struct _GstSpeexDec GstSpeexDec; +typedef struct _GstSpeexDecClass GstSpeexDecClass; + +struct _GstSpeexDec { + GstAudioDecoder element; + + void *state; + SpeexStereoState *stereo; +#ifdef SPEEX_1_0 + SpeexMode *mode; +#else + const SpeexMode *mode; +#endif + SpeexHeader *header; + SpeexCallback callback; + SpeexBits bits; + + gboolean enh; + + gint frame_size; + GstClockTime frame_duration; + guint64 packetno; + + GstBuffer *streamheader; + GstBuffer *vorbiscomment; +}; + +struct _GstSpeexDecClass { + GstAudioDecoderClass parent_class; +}; + +GType gst_speex_dec_get_type (void); + +G_END_DECLS + +#endif /* __GST_SPEEX_DEC_H__ */ diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c new file mode 100644 index 0000000..b866e5c --- /dev/null +++ b/ext/speex/gstspeexenc.c @@ -0,0 +1,850 @@ +/* GStreamer Speex Encoder + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:element-speexenc + * @see_also: speexdec, oggmux + * + * This element encodes audio as a Speex stream. + * <ulink url="http://www.speex.org/">Speex</ulink> is a royalty-free + * audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org + * Foundation</ulink>. + * + * <refsect2> + * <title>Example pipelines</title> + * |[ + * gst-launch audiotestsrc num-buffers=100 ! speexenc ! oggmux ! filesink location=beep.ogg + * ]| Encode an Ogg/Speex file. + * </refsect2> + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <math.h> +#include <speex/speex.h> +#include <speex/speex_stereo.h> + +#include <gst/gsttagsetter.h> +#include <gst/tag/tag.h> +#include <gst/audio/audio.h> +#include "gstspeexenc.h" + +GST_DEBUG_CATEGORY_STATIC (speexenc_debug); +#define GST_CAT_DEFAULT speexenc_debug + +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 6000, 48000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16") + ); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-speex, " + "rate = (int) [ 6000, 48000 ], " "channels = (int) [ 1, 2]") + ); + +#define DEFAULT_QUALITY 8.0 +#define DEFAULT_BITRATE 0 +#define DEFAULT_MODE GST_SPEEX_ENC_MODE_AUTO +#define DEFAULT_VBR FALSE +#define DEFAULT_ABR 0 +#define DEFAULT_VAD FALSE +#define DEFAULT_DTX FALSE +#define DEFAULT_COMPLEXITY 3 +#define DEFAULT_NFRAMES 1 + +enum +{ + PROP_0, + PROP_QUALITY, + PROP_BITRATE, + PROP_MODE, + PROP_VBR, + PROP_ABR, + PROP_VAD, + PROP_DTX, + PROP_COMPLEXITY, + PROP_NFRAMES, + PROP_LAST_MESSAGE +}; + +#define GST_TYPE_SPEEX_ENC_MODE (gst_speex_enc_mode_get_type()) +static GType +gst_speex_enc_mode_get_type (void) +{ + static GType speex_enc_mode_type = 0; + static const GEnumValue speex_enc_modes[] = { + {GST_SPEEX_ENC_MODE_AUTO, "Auto", "auto"}, + {GST_SPEEX_ENC_MODE_UWB, "Ultra Wide Band", "uwb"}, + {GST_SPEEX_ENC_MODE_WB, "Wide Band", "wb"}, + {GST_SPEEX_ENC_MODE_NB, "Narrow Band", "nb"}, + {0, NULL, NULL}, + }; + if (G_UNLIKELY (speex_enc_mode_type == 0)) { + speex_enc_mode_type = g_enum_register_static ("GstSpeexEncMode", + speex_enc_modes); + } + return speex_enc_mode_type; +} + +static void gst_speex_enc_finalize (GObject * object); + +static gboolean gst_speex_enc_setup (GstSpeexEnc * enc); + +static void gst_speex_enc_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static void gst_speex_enc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); + +static GstFlowReturn gst_speex_enc_encode (GstSpeexEnc * enc, GstBuffer * buf); + +static gboolean gst_speex_enc_start (GstAudioEncoder * enc); +static gboolean gst_speex_enc_stop (GstAudioEncoder * enc); +static gboolean gst_speex_enc_set_format (GstAudioEncoder * enc, + GstAudioInfo * info); +static GstFlowReturn gst_speex_enc_handle_frame (GstAudioEncoder * enc, + GstBuffer * in_buf); +static gboolean gst_speex_enc_sink_event (GstAudioEncoder * enc, + GstEvent * event); +static GstFlowReturn +gst_speex_enc_pre_push (GstAudioEncoder * benc, GstBuffer ** buffer); + +static void +gst_speex_enc_setup_interfaces (GType speexenc_type) +{ + static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL }; + + g_type_add_interface_static (speexenc_type, GST_TYPE_TAG_SETTER, + &tag_setter_info); + + GST_DEBUG_CATEGORY_INIT (speexenc_debug, "speexenc", 0, "Speex encoder"); +} + +GST_BOILERPLATE_FULL (GstSpeexEnc, gst_speex_enc, GstAudioEncoder, + GST_TYPE_AUDIO_ENCODER, gst_speex_enc_setup_interfaces); + +static void +gst_speex_enc_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_static_pad_template (element_class, &src_factory); + gst_element_class_add_static_pad_template (element_class, &sink_factory); + gst_element_class_set_details_simple (element_class, "Speex audio encoder", + "Codec/Encoder/Audio", + "Encodes audio in Speex format", "Wim Taymans <wim@fluendo.com>"); +} + +static void +gst_speex_enc_class_init (GstSpeexEncClass * klass) +{ + GObjectClass *gobject_class; + GstAudioEncoderClass *base_class; + + gobject_class = (GObjectClass *) klass; + base_class = (GstAudioEncoderClass *) klass; + + gobject_class->set_property = gst_speex_enc_set_property; + gobject_class->get_property = gst_speex_enc_get_property; + + base_class->start = GST_DEBUG_FUNCPTR (gst_speex_enc_start); + base_class->stop = GST_DEBUG_FUNCPTR (gst_speex_enc_stop); + base_class->set_format = GST_DEBUG_FUNCPTR (gst_speex_enc_set_format); + base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_speex_enc_handle_frame); + base_class->event = GST_DEBUG_FUNCPTR (gst_speex_enc_sink_event); + base_class->pre_push = GST_DEBUG_FUNCPTR (gst_speex_enc_pre_push); + + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_QUALITY, + g_param_spec_float ("quality", "Quality", "Encoding quality", + 0.0, 10.0, DEFAULT_QUALITY, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BITRATE, + g_param_spec_int ("bitrate", "Encoding Bit-rate", + "Specify an encoding bit-rate (in bps). (0 = automatic)", + 0, G_MAXINT, DEFAULT_BITRATE, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_MODE, + g_param_spec_enum ("mode", "Mode", "The encoding mode", + GST_TYPE_SPEEX_ENC_MODE, GST_SPEEX_ENC_MODE_AUTO, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VBR, + g_param_spec_boolean ("vbr", "VBR", + "Enable variable bit-rate", DEFAULT_VBR, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ABR, + g_param_spec_int ("abr", "ABR", + "Enable average bit-rate (0 = disabled)", + 0, G_MAXINT, DEFAULT_ABR, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VAD, + g_param_spec_boolean ("vad", "VAD", + "Enable voice activity detection", DEFAULT_VAD, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DTX, + g_param_spec_boolean ("dtx", "DTX", + "Enable discontinuous transmission", DEFAULT_DTX, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COMPLEXITY, + g_param_spec_int ("complexity", "Complexity", + "Set encoding complexity", + 0, G_MAXINT, DEFAULT_COMPLEXITY, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_NFRAMES, + g_param_spec_int ("nframes", "NFrames", + "Number of frames per buffer", + 0, G_MAXINT, DEFAULT_NFRAMES, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LAST_MESSAGE, + g_param_spec_string ("last-message", "last-message", + "The last status message", NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + gobject_class->finalize = gst_speex_enc_finalize; +} + +static void +gst_speex_enc_finalize (GObject * object) +{ + GstSpeexEnc *enc; + + enc = GST_SPEEX_ENC (object); + + g_free (enc->last_message); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gst_speex_enc_init (GstSpeexEnc * enc, GstSpeexEncClass * klass) +{ + GstAudioEncoder *benc = GST_AUDIO_ENCODER (enc); + + /* arrange granulepos marking (and required perfect ts) */ + gst_audio_encoder_set_mark_granule (benc, TRUE); + gst_audio_encoder_set_perfect_timestamp (benc, TRUE); +} + +static gboolean +gst_speex_enc_start (GstAudioEncoder * benc) +{ + GstSpeexEnc *enc = GST_SPEEX_ENC (benc); + + GST_DEBUG_OBJECT (enc, "start"); + speex_bits_init (&enc->bits); + enc->tags = gst_tag_list_new (); + enc->header_sent = FALSE; + + return TRUE; +} + +static gboolean +gst_speex_enc_stop (GstAudioEncoder * benc) +{ + GstSpeexEnc *enc = GST_SPEEX_ENC (benc); + + GST_DEBUG_OBJECT (enc, "stop"); + enc->header_sent = FALSE; + if (enc->state) { + speex_encoder_destroy (enc->state); + enc->state = NULL; + } + speex_bits_destroy (&enc->bits); + gst_tag_list_free (enc->tags); + enc->tags = NULL; + g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL); + enc->headers = NULL; + + gst_tag_setter_reset_tags (GST_TAG_SETTER (enc)); + + return TRUE; +} + +static gint64 +gst_speex_enc_get_latency (GstSpeexEnc * enc) +{ + /* See the Speex manual section "Latency and algorithmic delay" */ + if (enc->rate == 8000) + return 30 * GST_MSECOND; + else + return 34 * GST_MSECOND; +} + +static gboolean +gst_speex_enc_set_format (GstAudioEncoder * benc, GstAudioInfo * info) +{ + GstSpeexEnc *enc; + + enc = GST_SPEEX_ENC (benc); + + enc->channels = GST_AUDIO_INFO_CHANNELS (info); + enc->rate = GST_AUDIO_INFO_RATE (info); + + /* handle reconfigure */ + if (enc->state) { + speex_encoder_destroy (enc->state); + enc->state = NULL; + } + + if (!gst_speex_enc_setup (enc)) + return FALSE; + + /* feedback to base class */ + gst_audio_encoder_set_latency (benc, + gst_speex_enc_get_latency (enc), gst_speex_enc_get_latency (enc)); + gst_audio_encoder_set_lookahead (benc, enc->lookahead); + + if (enc->nframes == 0) { + /* as many frames as available input allows */ + gst_audio_encoder_set_frame_samples_min (benc, enc->frame_size); + gst_audio_encoder_set_frame_samples_max (benc, enc->frame_size); + gst_audio_encoder_set_frame_max (benc, 0); + } else { + /* exactly as many frames as configured */ + gst_audio_encoder_set_frame_samples_min (benc, + enc->frame_size * enc->nframes); + gst_audio_encoder_set_frame_samples_max (benc, + enc->frame_size * enc->nframes); + gst_audio_encoder_set_frame_max (benc, 1); + } + + return TRUE; +} + +static GstBuffer * +gst_speex_enc_create_metadata_buffer (GstSpeexEnc * enc) +{ + const GstTagList *user_tags; + GstTagList *merged_tags; + GstBuffer *comments = NULL; + + user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (enc)); + + GST_DEBUG_OBJECT (enc, "upstream tags = %" GST_PTR_FORMAT, enc->tags); + GST_DEBUG_OBJECT (enc, "user-set tags = %" GST_PTR_FORMAT, user_tags); + + /* gst_tag_list_merge() will handle NULL for either or both lists fine */ + merged_tags = gst_tag_list_merge (user_tags, enc->tags, + gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (enc))); + + if (merged_tags == NULL) + merged_tags = gst_tag_list_new (); + + GST_DEBUG_OBJECT (enc, "merged tags = %" GST_PTR_FORMAT, merged_tags); + comments = gst_tag_list_to_vorbiscomment_buffer (merged_tags, NULL, + 0, "Encoded with GStreamer Speexenc"); + gst_tag_list_free (merged_tags); + + GST_BUFFER_OFFSET (comments) = 0; + GST_BUFFER_OFFSET_END (comments) = 0; + + return comments; +} + +static void +gst_speex_enc_set_last_msg (GstSpeexEnc * enc, const gchar * msg) +{ + g_free (enc->last_message); + enc->last_message = g_strdup (msg); + GST_WARNING_OBJECT (enc, "%s", msg); + g_object_notify (G_OBJECT (enc), "last-message"); +} + +static gboolean +gst_speex_enc_setup (GstSpeexEnc * enc) +{ + switch (enc->mode) { + case GST_SPEEX_ENC_MODE_UWB: + GST_LOG_OBJECT (enc, "configuring for requested UWB mode"); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_UWB); + break; + case GST_SPEEX_ENC_MODE_WB: + GST_LOG_OBJECT (enc, "configuring for requested WB mode"); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_WB); + break; + case GST_SPEEX_ENC_MODE_NB: + GST_LOG_OBJECT (enc, "configuring for requested NB mode"); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_NB); + break; + case GST_SPEEX_ENC_MODE_AUTO: + /* fall through */ + GST_LOG_OBJECT (enc, "finding best mode"); + default: + break; + } + + if (enc->rate > 25000) { + if (enc->mode == GST_SPEEX_ENC_MODE_AUTO) { + GST_LOG_OBJECT (enc, "selected UWB mode for samplerate %d", enc->rate); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_UWB); + } else { + if (enc->speex_mode != speex_lib_get_mode (SPEEX_MODEID_UWB)) { + gst_speex_enc_set_last_msg (enc, + "Warning: suggest to use ultra wide band mode for this rate"); + } + } + } else if (enc->rate > 12500) { + if (enc->mode == GST_SPEEX_ENC_MODE_AUTO) { + GST_LOG_OBJECT (enc, "selected WB mode for samplerate %d", enc->rate); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_WB); + } else { + if (enc->speex_mode != speex_lib_get_mode (SPEEX_MODEID_WB)) { + gst_speex_enc_set_last_msg (enc, + "Warning: suggest to use wide band mode for this rate"); + } + } + } else { + if (enc->mode == GST_SPEEX_ENC_MODE_AUTO) { + GST_LOG_OBJECT (enc, "selected NB mode for samplerate %d", enc->rate); + enc->speex_mode = speex_lib_get_mode (SPEEX_MODEID_NB); + } else { + if (enc->speex_mode != speex_lib_get_mode (SPEEX_MODEID_NB)) { + gst_speex_enc_set_last_msg (enc, + "Warning: suggest to use narrow band mode for this rate"); + } + } + } + + if (enc->rate != 8000 && enc->rate != 16000 && enc->rate != 32000) { + gst_speex_enc_set_last_msg (enc, + "Warning: speex is optimized for 8, 16 and 32 KHz"); + } + + speex_init_header (&enc->header, enc->rate, 1, enc->speex_mode); + enc->header.frames_per_packet = enc->nframes; + enc->header.vbr = enc->vbr; + enc->header.nb_channels = enc->channels; + + /*Initialize Speex encoder */ + enc->state = speex_encoder_init (enc->speex_mode); + + speex_encoder_ctl (enc->state, SPEEX_GET_FRAME_SIZE, &enc->frame_size); + speex_encoder_ctl (enc->state, SPEEX_SET_COMPLEXITY, &enc->complexity); + speex_encoder_ctl (enc->state, SPEEX_SET_SAMPLING_RATE, &enc->rate); + + if (enc->vbr) + speex_encoder_ctl (enc->state, SPEEX_SET_VBR_QUALITY, &enc->quality); + else { + gint tmp = floor (enc->quality); + + speex_encoder_ctl (enc->state, SPEEX_SET_QUALITY, &tmp); + } + if (enc->bitrate) { + if (enc->quality >= 0.0 && enc->vbr) { + gst_speex_enc_set_last_msg (enc, + "Warning: bitrate option is overriding quality"); + } + speex_encoder_ctl (enc->state, SPEEX_SET_BITRATE, &enc->bitrate); + } + if (enc->vbr) { + gint tmp = 1; + + speex_encoder_ctl (enc->state, SPEEX_SET_VBR, &tmp); + } else if (enc->vad) { + gint tmp = 1; + + speex_encoder_ctl (enc->state, SPEEX_SET_VAD, &tmp); + } + + if (enc->dtx) { + gint tmp = 1; + + speex_encoder_ctl (enc->state, SPEEX_SET_DTX, &tmp); + } + + if (enc->dtx && !(enc->vbr || enc->abr || enc->vad)) { + gst_speex_enc_set_last_msg (enc, + "Warning: dtx is useless without vad, vbr or abr"); + } else if ((enc->vbr || enc->abr) && (enc->vad)) { + gst_speex_enc_set_last_msg (enc, + "Warning: vad is already implied by vbr or abr"); + } + + if (enc->abr) { + speex_encoder_ctl (enc->state, SPEEX_SET_ABR, &enc->abr); + } + + speex_encoder_ctl (enc->state, SPEEX_GET_LOOKAHEAD, &enc->lookahead); + + GST_LOG_OBJECT (enc, "we have frame size %d, lookahead %d", enc->frame_size, + enc->lookahead); + + return TRUE; +} + +/* push out the buffer */ +static GstFlowReturn +gst_speex_enc_push_buffer (GstSpeexEnc * enc, GstBuffer * buffer) +{ + guint size; + + size = GST_BUFFER_SIZE (buffer); + GST_DEBUG_OBJECT (enc, "pushing output buffer of size %u", size); + + gst_buffer_set_caps (buffer, GST_PAD_CAPS (GST_AUDIO_ENCODER_SRC_PAD (enc))); + return gst_pad_push (GST_AUDIO_ENCODER_SRC_PAD (enc), buffer); +} + +static gboolean +gst_speex_enc_sink_event (GstAudioEncoder * benc, GstEvent * event) +{ + GstSpeexEnc *enc; + + enc = GST_SPEEX_ENC (benc); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_TAG: + { + if (enc->tags) { + GstTagList *list; + + gst_event_parse_tag (event, &list); + gst_tag_list_insert (enc->tags, list, + gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (enc))); + } else { + g_assert_not_reached (); + } + break; + } + default: + break; + } + + /* we only peeked, let base class handle it */ + return FALSE; +} + +static GstFlowReturn +gst_speex_enc_encode (GstSpeexEnc * enc, GstBuffer * buf) +{ + gint frame_size = enc->frame_size; + gint bytes = frame_size * 2 * enc->channels, samples, size; + gint outsize, written, dtx_ret = 0; + guint8 *data, *data0 = NULL; + GstBuffer *outbuf; + GstFlowReturn ret = GST_FLOW_OK; + + if (G_LIKELY (buf)) { + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + + if (G_UNLIKELY (size % bytes)) { + GST_DEBUG_OBJECT (enc, "draining; adding silence samples"); + size = ((size / bytes) + 1) * bytes; + data0 = data = g_malloc0 (size); + memcpy (data, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + } + } else { + GST_DEBUG_OBJECT (enc, "nothing to drain"); + goto done; + } + + samples = size / (2 * enc->channels); + speex_bits_reset (&enc->bits); + + /* FIXME what about dropped samples if DTS enabled ?? */ + + while (size) { + GST_DEBUG_OBJECT (enc, "encoding %d samples (%d bytes)", frame_size, bytes); + + if (enc->channels == 2) { + speex_encode_stereo_int ((gint16 *) data, frame_size, &enc->bits); + } + dtx_ret += speex_encode_int (enc->state, (gint16 *) data, &enc->bits); + + data += bytes; + size -= bytes; + } + + speex_bits_insert_terminator (&enc->bits); + outsize = speex_bits_nbytes (&enc->bits); + + ret = gst_pad_alloc_buffer_and_set_caps (GST_AUDIO_ENCODER_SRC_PAD (enc), + GST_BUFFER_OFFSET_NONE, outsize, + GST_PAD_CAPS (GST_AUDIO_ENCODER_SRC_PAD (enc)), &outbuf); + + if ((GST_FLOW_OK != ret)) + goto done; + + written = speex_bits_write (&enc->bits, + (gchar *) GST_BUFFER_DATA (outbuf), outsize); + + if (G_UNLIKELY (written < outsize)) { + GST_ERROR_OBJECT (enc, "short write: %d < %d bytes", written, outsize); + GST_BUFFER_SIZE (outbuf) = written; + } else if (G_UNLIKELY (written > outsize)) { + GST_ERROR_OBJECT (enc, "overrun: %d > %d bytes", written, outsize); + } + + if (!dtx_ret) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP); + + ret = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), + outbuf, samples); + +done: + g_free (data0); + return ret; +} + +/* + * (really really) FIXME: move into core (dixit tpm) + */ +/** + * _gst_caps_set_buffer_array: + * @caps: a #GstCaps + * @field: field in caps to set + * @buf: header buffers + * + * Adds given buffers to an array of buffers set as the given @field + * on the given @caps. List of buffer arguments must be NULL-terminated. + * + * Returns: input caps with a streamheader field added, or NULL if some error + */ +static GstCaps * +_gst_caps_set_buffer_array (GstCaps * caps, const gchar * field, + GstBuffer * buf, ...) +{ + GstStructure *structure = NULL; + va_list va; + GValue array = { 0 }; + GValue value = { 0 }; + + g_return_val_if_fail (caps != NULL, NULL); + g_return_val_if_fail (gst_caps_is_fixed (caps), NULL); + g_return_val_if_fail (field != NULL, NULL); + + caps = gst_caps_make_writable (caps); + structure = gst_caps_get_structure (caps, 0); + + g_value_init (&array, GST_TYPE_ARRAY); + + va_start (va, buf); + /* put buffers in a fixed list */ + while (buf) { + g_assert (gst_buffer_is_metadata_writable (buf)); + + /* mark buffer */ + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); + + g_value_init (&value, GST_TYPE_BUFFER); + buf = gst_buffer_copy (buf); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); + gst_value_set_buffer (&value, buf); + gst_buffer_unref (buf); + gst_value_array_append_value (&array, &value); + g_value_unset (&value); + + buf = va_arg (va, GstBuffer *); + } + + gst_structure_set_value (structure, field, &array); + g_value_unset (&array); + + return caps; +} + +static GstFlowReturn +gst_speex_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf) +{ + GstSpeexEnc *enc; + GstFlowReturn ret = GST_FLOW_OK; + + enc = GST_SPEEX_ENC (benc); + + if (!enc->header_sent) { + /* Speex streams begin with two headers; the initial header (with + most of the codec setup parameters) which is mandated by the Ogg + bitstream spec. The second header holds any comment fields. + We merely need to make the headers, then pass them to libspeex + one at a time; libspeex handles the additional Ogg bitstream + constraints */ + GstBuffer *buf1, *buf2; + GstCaps *caps; + guchar *data; + gint data_len; + + /* create header buffer */ + data = (guint8 *) speex_header_to_packet (&enc->header, &data_len); + buf1 = gst_buffer_new (); + GST_BUFFER_DATA (buf1) = GST_BUFFER_MALLOCDATA (buf1) = data; + GST_BUFFER_SIZE (buf1) = data_len; + GST_BUFFER_OFFSET_END (buf1) = 0; + GST_BUFFER_OFFSET (buf1) = 0; + + /* create comment buffer */ + buf2 = gst_speex_enc_create_metadata_buffer (enc); + + /* mark and put on caps */ + caps = gst_caps_new_simple ("audio/x-speex", "rate", G_TYPE_INT, enc->rate, + "channels", G_TYPE_INT, enc->channels, NULL); + caps = _gst_caps_set_buffer_array (caps, "streamheader", buf1, buf2, NULL); + + /* negotiate with these caps */ + GST_DEBUG_OBJECT (enc, "here are the caps: %" GST_PTR_FORMAT, caps); + + gst_buffer_set_caps (buf1, caps); + gst_buffer_set_caps (buf2, caps); + gst_pad_set_caps (GST_AUDIO_ENCODER_SRC_PAD (enc), caps); + gst_caps_unref (caps); + + /* push out buffers */ + /* store buffers for later pre_push sending */ + g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL); + enc->headers = NULL; + GST_DEBUG_OBJECT (enc, "storing header buffers"); + enc->headers = g_slist_prepend (enc->headers, buf2); + enc->headers = g_slist_prepend (enc->headers, buf1); + + enc->header_sent = TRUE; + } + + GST_DEBUG_OBJECT (enc, "received buffer %p of %u bytes", buf, + buf ? GST_BUFFER_SIZE (buf) : 0); + + ret = gst_speex_enc_encode (enc, buf); + + return ret; +} + +static GstFlowReturn +gst_speex_enc_pre_push (GstAudioEncoder * benc, GstBuffer ** buffer) +{ + GstSpeexEnc *enc; + GstFlowReturn ret = GST_FLOW_OK; + + enc = GST_SPEEX_ENC (benc); + + /* FIXME 0.11 ? get rid of this special ogg stuff and have it + * put and use 'codec data' in caps like anything else, + * with all the usual out-of-band advantage etc */ + if (G_UNLIKELY (enc->headers)) { + GSList *header = enc->headers; + + /* try to push all of these, if we lose one, might as well lose all */ + while (header) { + if (ret == GST_FLOW_OK) + ret = gst_speex_enc_push_buffer (enc, header->data); + else + gst_speex_enc_push_buffer (enc, header->data); + header = g_slist_next (header); + } + + g_slist_free (enc->headers); + enc->headers = NULL; + } + + return ret; +} + +static void +gst_speex_enc_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstSpeexEnc *enc; + + enc = GST_SPEEX_ENC (object); + + switch (prop_id) { + case PROP_QUALITY: + g_value_set_float (value, enc->quality); + break; + case PROP_BITRATE: + g_value_set_int (value, enc->bitrate); + break; + case PROP_MODE: + g_value_set_enum (value, enc->mode); + break; + case PROP_VBR: + g_value_set_boolean (value, enc->vbr); + break; + case PROP_ABR: + g_value_set_int (value, enc->abr); + break; + case PROP_VAD: + g_value_set_boolean (value, enc->vad); + break; + case PROP_DTX: + g_value_set_boolean (value, enc->dtx); + break; + case PROP_COMPLEXITY: + g_value_set_int (value, enc->complexity); + break; + case PROP_NFRAMES: + g_value_set_int (value, enc->nframes); + break; + case PROP_LAST_MESSAGE: + g_value_set_string (value, enc->last_message); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_speex_enc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstSpeexEnc *enc; + + enc = GST_SPEEX_ENC (object); + + switch (prop_id) { + case PROP_QUALITY: + enc->quality = g_value_get_float (value); + break; + case PROP_BITRATE: + enc->bitrate = g_value_get_int (value); + break; + case PROP_MODE: + enc->mode = g_value_get_enum (value); + break; + case PROP_VBR: + enc->vbr = g_value_get_boolean (value); + break; + case PROP_ABR: + enc->abr = g_value_get_int (value); + break; + case PROP_VAD: + enc->vad = g_value_get_boolean (value); + break; + case PROP_DTX: + enc->dtx = g_value_get_boolean (value); + break; + case PROP_COMPLEXITY: + enc->complexity = g_value_get_int (value); + break; + case PROP_NFRAMES: + enc->nframes = g_value_get_int (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} diff --git a/ext/speex/gstspeexenc.h b/ext/speex/gstspeexenc.h new file mode 100644 index 0000000..5cf5cd8 --- /dev/null +++ b/ext/speex/gstspeexenc.h @@ -0,0 +1,102 @@ +/* GStreamer Speex Encoder + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_SPEEX_ENC_H__ +#define __GST_SPEEX_ENC_H__ + + +#include <gst/gst.h> +#include <gst/audio/gstaudioencoder.h> + +#include <speex/speex.h> +#include <speex/speex_header.h> + +G_BEGIN_DECLS + +#define GST_TYPE_SPEEX_ENC \ + (gst_speex_enc_get_type()) +#define GST_SPEEX_ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPEEX_ENC,GstSpeexEnc)) +#define GST_SPEEX_ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPEEX_ENC,GstSpeexEncClass)) +#define GST_IS_SPEEX_ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPEEX_ENC)) +#define GST_IS_SPEEX_ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPEEX_ENC)) + +typedef enum +{ + GST_SPEEX_ENC_MODE_AUTO, + GST_SPEEX_ENC_MODE_UWB, + GST_SPEEX_ENC_MODE_WB, + GST_SPEEX_ENC_MODE_NB +} GstSpeexMode; + +typedef struct _GstSpeexEnc GstSpeexEnc; +typedef struct _GstSpeexEncClass GstSpeexEncClass; + +struct _GstSpeexEnc { + GstAudioEncoder element; + + SpeexBits bits; + SpeexHeader header; +#ifdef SPEEX_1_0 + SpeexMode *speex_mode; +#else + const SpeexMode *speex_mode; +#endif + void *state; + + /* properties */ + GstSpeexMode mode; + gfloat quality; + gint bitrate; + gboolean vbr; + gint abr; + gboolean vad; + gboolean dtx; + gint complexity; + gint nframes; + gchar *last_message; + + gint channels; + gint rate; + + gboolean header_sent; + GSList *headers; + + GstTagList *tags; + + gint frame_size; + gint lookahead; + + guint8 *comments; + gint comment_len; +}; + +struct _GstSpeexEncClass { + GstAudioEncoderClass parent_class; +}; + +GType gst_speex_enc_get_type (void); + +G_END_DECLS + +#endif /* __GST_SPEEXENC_H__ */ |