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 /gst/law | |
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 'gst/law')
-rw-r--r-- | gst/law/Makefile.am | 40 | ||||
-rw-r--r-- | gst/law/Makefile.in | 894 | ||||
-rw-r--r-- | gst/law/alaw-decode.c | 344 | ||||
-rw-r--r-- | gst/law/alaw-decode.h | 58 | ||||
-rw-r--r-- | gst/law/alaw-encode.c | 524 | ||||
-rw-r--r-- | gst/law/alaw-encode.h | 59 | ||||
-rw-r--r-- | gst/law/alaw.c | 77 | ||||
-rw-r--r-- | gst/law/mulaw-conversion.c | 118 | ||||
-rw-r--r-- | gst/law/mulaw-conversion.h | 12 | ||||
-rw-r--r-- | gst/law/mulaw-decode.c | 307 | ||||
-rw-r--r-- | gst/law/mulaw-decode.h | 58 | ||||
-rw-r--r-- | gst/law/mulaw-encode.c | 297 | ||||
-rw-r--r-- | gst/law/mulaw-encode.h | 59 | ||||
-rw-r--r-- | gst/law/mulaw.c | 75 |
14 files changed, 2922 insertions, 0 deletions
diff --git a/gst/law/Makefile.am b/gst/law/Makefile.am new file mode 100644 index 0000000..16bff25 --- /dev/null +++ b/gst/law/Makefile.am @@ -0,0 +1,40 @@ +plugin_LTLIBRARIES = libgstalaw.la libgstmulaw.la + +libgstalaw_la_SOURCES = alaw-encode.c alaw-decode.c alaw.c +libgstalaw_la_CFLAGS = $(GST_CFLAGS) +libgstalaw_la_LIBADD = $(GST_LIBS) +libgstalaw_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstalaw_la_LIBTOOLFLAGS = --tag=disable-static + +libgstmulaw_la_SOURCES = mulaw-encode.c mulaw-conversion.c mulaw-decode.c mulaw.c +libgstmulaw_la_CFLAGS = $(GST_CFLAGS) +libgstmulaw_la_LIBADD = $(GST_LIBS) +libgstmulaw_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstmulaw_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = mulaw-conversion.h alaw-encode.h alaw-decode.h mulaw-encode.h mulaw-decode.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstalaw -:SHARED libgstalaw \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstalaw_la_SOURCES) \ + $(nodist_libgstalaw_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstalaw_la_CFLAGS) \ + -:LDFLAGS $(libgstalaw_la_LDFLAGS) \ + $(libgstalaw_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + -:SHARED libgstmulaw \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmulaw_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmulaw_la_CFLAGS) \ + -:LDFLAGS $(libgstmulaw_la_LDFLAGS) \ + $(libgstmulaw_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/law/Makefile.in b/gst/law/Makefile.in new file mode 100644 index 0000000..dff15f8 --- /dev/null +++ b/gst/law/Makefile.in @@ -0,0 +1,894 @@ +# 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 = gst/law +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 = +libgstalaw_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libgstalaw_la_OBJECTS = libgstalaw_la-alaw-encode.lo \ + libgstalaw_la-alaw-decode.lo libgstalaw_la-alaw.lo +libgstalaw_la_OBJECTS = $(am_libgstalaw_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libgstalaw_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(libgstalaw_la_CFLAGS) $(CFLAGS) \ + $(libgstalaw_la_LDFLAGS) $(LDFLAGS) -o $@ +libgstmulaw_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libgstmulaw_la_OBJECTS = libgstmulaw_la-mulaw-encode.lo \ + libgstmulaw_la-mulaw-conversion.lo \ + libgstmulaw_la-mulaw-decode.lo libgstmulaw_la-mulaw.lo +libgstmulaw_la_OBJECTS = $(am_libgstmulaw_la_OBJECTS) +libgstmulaw_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(libgstmulaw_la_CFLAGS) $(CFLAGS) \ + $(libgstmulaw_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 = $(libgstalaw_la_SOURCES) $(libgstmulaw_la_SOURCES) +DIST_SOURCES = $(libgstalaw_la_SOURCES) $(libgstmulaw_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 = libgstalaw.la libgstmulaw.la +libgstalaw_la_SOURCES = alaw-encode.c alaw-decode.c alaw.c +libgstalaw_la_CFLAGS = $(GST_CFLAGS) +libgstalaw_la_LIBADD = $(GST_LIBS) +libgstalaw_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstalaw_la_LIBTOOLFLAGS = --tag=disable-static +libgstmulaw_la_SOURCES = mulaw-encode.c mulaw-conversion.c mulaw-decode.c mulaw.c +libgstmulaw_la_CFLAGS = $(GST_CFLAGS) +libgstmulaw_la_LIBADD = $(GST_LIBS) +libgstmulaw_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstmulaw_la_LIBTOOLFLAGS = --tag=disable-static +noinst_HEADERS = mulaw-conversion.h alaw-encode.h alaw-decode.h mulaw-encode.h mulaw-decode.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 gst/law/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu gst/law/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 +libgstalaw.la: $(libgstalaw_la_OBJECTS) $(libgstalaw_la_DEPENDENCIES) $(EXTRA_libgstalaw_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgstalaw_la_LINK) -rpath $(plugindir) $(libgstalaw_la_OBJECTS) $(libgstalaw_la_LIBADD) $(LIBS) +libgstmulaw.la: $(libgstmulaw_la_OBJECTS) $(libgstmulaw_la_DEPENDENCIES) $(EXTRA_libgstmulaw_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgstmulaw_la_LINK) -rpath $(plugindir) $(libgstmulaw_la_OBJECTS) $(libgstmulaw_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstalaw_la-alaw-decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstalaw_la-alaw-encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstalaw_la-alaw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmulaw_la-mulaw-conversion.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmulaw_la-mulaw-decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmulaw_la-mulaw-encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmulaw_la-mulaw.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 $@ $< + +libgstalaw_la-alaw-encode.lo: alaw-encode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -MT libgstalaw_la-alaw-encode.lo -MD -MP -MF $(DEPDIR)/libgstalaw_la-alaw-encode.Tpo -c -o libgstalaw_la-alaw-encode.lo `test -f 'alaw-encode.c' || echo '$(srcdir)/'`alaw-encode.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstalaw_la-alaw-encode.Tpo $(DEPDIR)/libgstalaw_la-alaw-encode.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alaw-encode.c' object='libgstalaw_la-alaw-encode.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 $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -c -o libgstalaw_la-alaw-encode.lo `test -f 'alaw-encode.c' || echo '$(srcdir)/'`alaw-encode.c + +libgstalaw_la-alaw-decode.lo: alaw-decode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -MT libgstalaw_la-alaw-decode.lo -MD -MP -MF $(DEPDIR)/libgstalaw_la-alaw-decode.Tpo -c -o libgstalaw_la-alaw-decode.lo `test -f 'alaw-decode.c' || echo '$(srcdir)/'`alaw-decode.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstalaw_la-alaw-decode.Tpo $(DEPDIR)/libgstalaw_la-alaw-decode.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alaw-decode.c' object='libgstalaw_la-alaw-decode.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 $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -c -o libgstalaw_la-alaw-decode.lo `test -f 'alaw-decode.c' || echo '$(srcdir)/'`alaw-decode.c + +libgstalaw_la-alaw.lo: alaw.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -MT libgstalaw_la-alaw.lo -MD -MP -MF $(DEPDIR)/libgstalaw_la-alaw.Tpo -c -o libgstalaw_la-alaw.lo `test -f 'alaw.c' || echo '$(srcdir)/'`alaw.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstalaw_la-alaw.Tpo $(DEPDIR)/libgstalaw_la-alaw.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alaw.c' object='libgstalaw_la-alaw.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 $(libgstalaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstalaw_la_CFLAGS) $(CFLAGS) -c -o libgstalaw_la-alaw.lo `test -f 'alaw.c' || echo '$(srcdir)/'`alaw.c + +libgstmulaw_la-mulaw-encode.lo: mulaw-encode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -MT libgstmulaw_la-mulaw-encode.lo -MD -MP -MF $(DEPDIR)/libgstmulaw_la-mulaw-encode.Tpo -c -o libgstmulaw_la-mulaw-encode.lo `test -f 'mulaw-encode.c' || echo '$(srcdir)/'`mulaw-encode.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstmulaw_la-mulaw-encode.Tpo $(DEPDIR)/libgstmulaw_la-mulaw-encode.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mulaw-encode.c' object='libgstmulaw_la-mulaw-encode.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 $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -c -o libgstmulaw_la-mulaw-encode.lo `test -f 'mulaw-encode.c' || echo '$(srcdir)/'`mulaw-encode.c + +libgstmulaw_la-mulaw-conversion.lo: mulaw-conversion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -MT libgstmulaw_la-mulaw-conversion.lo -MD -MP -MF $(DEPDIR)/libgstmulaw_la-mulaw-conversion.Tpo -c -o libgstmulaw_la-mulaw-conversion.lo `test -f 'mulaw-conversion.c' || echo '$(srcdir)/'`mulaw-conversion.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstmulaw_la-mulaw-conversion.Tpo $(DEPDIR)/libgstmulaw_la-mulaw-conversion.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mulaw-conversion.c' object='libgstmulaw_la-mulaw-conversion.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 $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -c -o libgstmulaw_la-mulaw-conversion.lo `test -f 'mulaw-conversion.c' || echo '$(srcdir)/'`mulaw-conversion.c + +libgstmulaw_la-mulaw-decode.lo: mulaw-decode.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -MT libgstmulaw_la-mulaw-decode.lo -MD -MP -MF $(DEPDIR)/libgstmulaw_la-mulaw-decode.Tpo -c -o libgstmulaw_la-mulaw-decode.lo `test -f 'mulaw-decode.c' || echo '$(srcdir)/'`mulaw-decode.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstmulaw_la-mulaw-decode.Tpo $(DEPDIR)/libgstmulaw_la-mulaw-decode.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mulaw-decode.c' object='libgstmulaw_la-mulaw-decode.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 $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -c -o libgstmulaw_la-mulaw-decode.lo `test -f 'mulaw-decode.c' || echo '$(srcdir)/'`mulaw-decode.c + +libgstmulaw_la-mulaw.lo: mulaw.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -MT libgstmulaw_la-mulaw.lo -MD -MP -MF $(DEPDIR)/libgstmulaw_la-mulaw.Tpo -c -o libgstmulaw_la-mulaw.lo `test -f 'mulaw.c' || echo '$(srcdir)/'`mulaw.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstmulaw_la-mulaw.Tpo $(DEPDIR)/libgstmulaw_la-mulaw.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mulaw.c' object='libgstmulaw_la-mulaw.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 $(libgstmulaw_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmulaw_la_CFLAGS) $(CFLAGS) -c -o libgstmulaw_la-mulaw.lo `test -f 'mulaw.c' || echo '$(srcdir)/'`mulaw.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 + + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstalaw -:SHARED libgstalaw \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstalaw_la_SOURCES) \ + $(nodist_libgstalaw_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstalaw_la_CFLAGS) \ + -:LDFLAGS $(libgstalaw_la_LDFLAGS) \ + $(libgstalaw_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + -:SHARED libgstmulaw \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmulaw_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmulaw_la_CFLAGS) \ + -:LDFLAGS $(libgstmulaw_la_LDFLAGS) \ + $(libgstmulaw_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ + +# 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/gst/law/alaw-decode.c b/gst/law/alaw-decode.c new file mode 100644 index 0000000..2fa6a5d --- /dev/null +++ b/gst/law/alaw-decode.c @@ -0,0 +1,344 @@ +/* GStreamer A-Law to PCM conversion + * Copyright (C) 2000 by Abramo Bagnara <abramo@alsa-project.org> + * + * 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.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * 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-alawdec + * + * This element decodes alaw audio. Alaw coding is also known as G.711. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "alaw-decode.h" + +extern GstStaticPadTemplate alaw_dec_src_factory; +extern GstStaticPadTemplate alaw_dec_sink_factory; + +GST_DEBUG_CATEGORY_STATIC (alaw_dec_debug); +#define GST_CAT_DEFAULT alaw_dec_debug + +static GstStateChangeReturn +gst_alaw_dec_change_state (GstElement * element, GstStateChange transition); +static GstFlowReturn gst_alaw_dec_chain (GstPad * pad, GstBuffer * buffer); + +GST_BOILERPLATE (GstALawDec, gst_alaw_dec, GstElement, GST_TYPE_ELEMENT); + +/* some day we might have defines in gstconfig.h that tell us about the + * desired cpu/memory/binary size trade-offs */ +#define GST_ALAW_DEC_USE_TABLE + +#ifdef GST_ALAW_DEC_USE_TABLE + +static const gint alaw_to_s16_table[256] = { + -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, + -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, + -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, + -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, + -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944, + -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136, + -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472, + -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568, + -344, -328, -376, -360, -280, -264, -312, -296, + -472, -456, -504, -488, -408, -392, -440, -424, + -88, -72, -120, -104, -24, -8, -56, -40, + -216, -200, -248, -232, -152, -136, -184, -168, + -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, + -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, + -688, -656, -752, -720, -560, -528, -624, -592, + -944, -912, -1008, -976, -816, -784, -880, -848, + 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736, + 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, + 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, + 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, + 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, + 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, + 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472, + 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, + 344, 328, 376, 360, 280, 264, 312, 296, + 472, 456, 504, 488, 408, 392, 440, 424, + 88, 72, 120, 104, 24, 8, 56, 40, + 216, 200, 248, 232, 152, 136, 184, 168, + 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, + 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, + 688, 656, 752, 720, 560, 528, 624, 592, + 944, 912, 1008, 976, 816, 784, 880, 848 +}; + +static inline gint +alaw_to_s16 (guint8 a_val) +{ + return alaw_to_s16_table[a_val]; +} + +#else /* GST_ALAW_DEC_USE_TABLE */ + +static inline gint +alaw_to_s16 (guint8 a_val) +{ + gint t; + gint seg; + + a_val ^= 0x55; + t = a_val & 0x7f; + if (t < 16) + t = (t << 4) + 8; + else { + seg = (t >> 4) & 0x07; + t = ((t & 0x0f) << 4) + 0x108; + t <<= seg - 1; + } + return ((a_val & 0x80) ? t : -t); +} + +#endif /* GST_ALAW_DEC_USE_TABLE */ + +static gboolean +gst_alaw_dec_sink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstALawDec *alawdec; + GstStructure *structure; + int rate, channels; + gboolean ret; + GstCaps *outcaps; + + alawdec = GST_ALAW_DEC (GST_PAD_PARENT (pad)); + + structure = gst_caps_get_structure (caps, 0); + + ret = gst_structure_get_int (structure, "rate", &rate); + ret &= gst_structure_get_int (structure, "channels", &channels); + if (!ret) + return FALSE; + + outcaps = gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, channels, NULL); + + ret = gst_pad_set_caps (alawdec->srcpad, outcaps); + gst_caps_unref (outcaps); + + if (ret) { + GST_DEBUG_OBJECT (alawdec, "rate=%d, channels=%d", rate, channels); + alawdec->rate = rate; + alawdec->channels = channels; + } + return ret; +} + +static GstCaps * +gst_alaw_dec_getcaps (GstPad * pad) +{ + GstALawDec *alawdec; + GstPad *otherpad; + GstCaps *othercaps, *result; + const GstCaps *templ; + const gchar *name; + gint i; + + alawdec = GST_ALAW_DEC (GST_PAD_PARENT (pad)); + + /* figure out the name of the caps we are going to return */ + if (pad == alawdec->srcpad) { + name = "audio/x-raw-int"; + otherpad = alawdec->sinkpad; + } else { + name = "audio/x-alaw"; + otherpad = alawdec->srcpad; + } + /* get caps from the peer, this can return NULL when there is no peer */ + othercaps = gst_pad_peer_get_caps (otherpad); + + /* get the template caps to make sure we return something acceptable */ + templ = gst_pad_get_pad_template_caps (pad); + + if (othercaps) { + /* there was a peer */ + othercaps = gst_caps_make_writable (othercaps); + + /* go through the caps and remove the fields we don't want */ + for (i = 0; i < gst_caps_get_size (othercaps); i++) { + GstStructure *structure; + + structure = gst_caps_get_structure (othercaps, i); + + /* adjust the name */ + gst_structure_set_name (structure, name); + + if (pad == alawdec->sinkpad) { + /* remove the fields we don't want */ + gst_structure_remove_fields (structure, "width", "depth", "endianness", + "signed", NULL); + } else { + /* add fixed fields */ + gst_structure_set (structure, "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, NULL); + } + } + /* filter against the allowed caps of the pad to return our result */ + result = gst_caps_intersect (othercaps, templ); + gst_caps_unref (othercaps); + } else { + /* there was no peer, return the template caps */ + result = gst_caps_copy (templ); + } + + return result; +} + +static void +gst_alaw_dec_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_static_pad_template (element_class, + &alaw_dec_src_factory); + gst_element_class_add_static_pad_template (element_class, + &alaw_dec_sink_factory); + + gst_element_class_set_details_simple (element_class, "A Law audio decoder", + "Codec/Decoder/Audio", "Convert 8bit A law to 16bit PCM", + "Zaheer Abbas Merali <zaheerabbas at merali dot org>"); + + GST_DEBUG_CATEGORY_INIT (alaw_dec_debug, "alawdec", 0, "A Law audio decoder"); +} + +static void +gst_alaw_dec_class_init (GstALawDecClass * klass) +{ + GstElementClass *element_class = (GstElementClass *) klass; + + element_class->change_state = GST_DEBUG_FUNCPTR (gst_alaw_dec_change_state); +} + +static void +gst_alaw_dec_init (GstALawDec * alawdec, GstALawDecClass * klass) +{ + alawdec->sinkpad = + gst_pad_new_from_static_template (&alaw_dec_sink_factory, "sink"); + gst_pad_set_setcaps_function (alawdec->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_dec_sink_setcaps)); + gst_pad_set_getcaps_function (alawdec->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_dec_getcaps)); + gst_pad_set_chain_function (alawdec->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_dec_chain)); + gst_element_add_pad (GST_ELEMENT (alawdec), alawdec->sinkpad); + + alawdec->srcpad = + gst_pad_new_from_static_template (&alaw_dec_src_factory, "src"); + gst_pad_use_fixed_caps (alawdec->srcpad); + gst_pad_set_getcaps_function (alawdec->srcpad, + GST_DEBUG_FUNCPTR (gst_alaw_dec_getcaps)); + gst_element_add_pad (GST_ELEMENT (alawdec), alawdec->srcpad); +} + +static GstFlowReturn +gst_alaw_dec_chain (GstPad * pad, GstBuffer * buffer) +{ + GstALawDec *alawdec; + gint16 *linear_data; + guint8 *alaw_data; + guint alaw_size; + GstBuffer *outbuf; + gint i; + GstFlowReturn ret; + + alawdec = GST_ALAW_DEC (GST_PAD_PARENT (pad)); + + if (G_UNLIKELY (alawdec->rate == 0)) + goto not_negotiated; + + GST_LOG_OBJECT (alawdec, "buffer with ts=%" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); + + alaw_data = GST_BUFFER_DATA (buffer); + alaw_size = GST_BUFFER_SIZE (buffer); + + ret = + gst_pad_alloc_buffer_and_set_caps (alawdec->srcpad, + GST_BUFFER_OFFSET_NONE, alaw_size * 2, GST_PAD_CAPS (alawdec->srcpad), + &outbuf); + if (ret != GST_FLOW_OK) + goto alloc_failed; + + linear_data = (gint16 *) GST_BUFFER_DATA (outbuf); + + /* copy discont flag */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer); + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buffer); + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (alawdec->srcpad)); + + for (i = 0; i < alaw_size; i++) { + linear_data[i] = alaw_to_s16 (alaw_data[i]); + } + gst_buffer_unref (buffer); + + ret = gst_pad_push (alawdec->srcpad, outbuf); + + return ret; + +not_negotiated: + { + gst_buffer_unref (buffer); + GST_WARNING_OBJECT (alawdec, "no input format set: not-negotiated"); + return GST_FLOW_NOT_NEGOTIATED; + } +alloc_failed: + { + gst_buffer_unref (buffer); + GST_DEBUG_OBJECT (alawdec, "pad alloc failed, flow: %s", + gst_flow_get_name (ret)); + return ret; + } +} + +static GstStateChangeReturn +gst_alaw_dec_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret; + GstALawDec *dec = GST_ALAW_DEC (element); + + switch (transition) { + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret != GST_STATE_CHANGE_SUCCESS) + return ret; + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + dec->rate = 0; + dec->channels = 0; + break; + default: + break; + } + + return ret; +} diff --git a/gst/law/alaw-decode.h b/gst/law/alaw-decode.h new file mode 100644 index 0000000..55433cc --- /dev/null +++ b/gst/law/alaw-decode.h @@ -0,0 +1,58 @@ +/* GStreamer A-Law to PCM conversion + * Copyright (C) 2000 by Abramo Bagnara <abramo@alsa-project.org> + * + * 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_ALAW_DECODE_H__ +#define __GST_ALAW_DECODE_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_ALAW_DEC \ + (gst_alaw_dec_get_type()) +#define GST_ALAW_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALAW_DEC,GstALawDec)) +#define GST_ALAW_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALAW_DEC,GstALawDecClass)) +#define GST_IS_ALAW_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALAW_DEC)) +#define GST_IS_ALAW_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALAW_DEC)) + +typedef struct _GstALawDec GstALawDec; +typedef struct _GstALawDecClass GstALawDecClass; + +struct _GstALawDec { + GstElement element; + + GstPad *sinkpad,*srcpad; + gint rate; + gint channels; +}; + +struct _GstALawDecClass { + GstElementClass parent_class; +}; + +GType gst_alaw_dec_get_type(void); + +G_END_DECLS + +#endif /* __GST_ALAW_DECODE_H__ */ + diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c new file mode 100644 index 0000000..b12c23e --- /dev/null +++ b/gst/law/alaw-encode.c @@ -0,0 +1,524 @@ +/* GStreamer PCM to A-Law conversion + * Copyright (C) 2000 by Abramo Bagnara <abramo@alsa-project.org> + * + * 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.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * 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-alawenc + * + * This element encode alaw audio. Alaw coding is also known as G.711. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "alaw-encode.h" + +GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug); +#define GST_CAT_DEFAULT alaw_enc_debug + +extern GstStaticPadTemplate alaw_enc_src_factory; +extern GstStaticPadTemplate alaw_enc_sink_factory; + +static GstFlowReturn gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer); + +GST_BOILERPLATE (GstALawEnc, gst_alaw_enc, GstElement, GST_TYPE_ELEMENT); + +/* some day we might have defines in gstconfig.h that tell us about the + * desired cpu/memory/binary size trade-offs */ +#define GST_ALAW_ENC_USE_TABLE + +#ifdef GST_ALAW_ENC_USE_TABLE + +static const guint8 alaw_encode[2048 + 1] = { + 0xd5, 0xd4, 0xd7, 0xd6, 0xd1, 0xd0, 0xd3, 0xd2, 0xdd, 0xdc, 0xdf, 0xde, + 0xd9, 0xd8, 0xdb, 0xda, 0xc5, 0xc4, 0xc7, 0xc6, 0xc1, 0xc0, 0xc3, 0xc2, + 0xcd, 0xcc, 0xcf, 0xce, 0xc9, 0xc8, 0xcb, 0xca, 0xf5, 0xf5, 0xf4, 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9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x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ac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0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, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a +}; + +static inline guint8 +s16_to_alaw (gint16 pcm_val) +{ + if (pcm_val >= 0) + return alaw_encode[pcm_val / 16]; + else + return (0x7F & alaw_encode[pcm_val / -16]); +} + +#else /* GST_ALAW_ENC_USE_TABLE */ + +/* + * s16_to_alaw() - Convert a 16-bit linear PCM value to 8-bit A-law + * + * s16_to_alaw() accepts an 16-bit integer and encodes it as A-law data. + * + * Linear Input Code Compressed Code + * ------------------------ --------------- + * 0000000wxyza 000wxyz + * 0000001wxyza 001wxyz + * 000001wxyzab 010wxyz + * 00001wxyzabc 011wxyz + * 0001wxyzabcd 100wxyz + * 001wxyzabcde 101wxyz + * 01wxyzabcdef 110wxyz + * 1wxyzabcdefg 111wxyz + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +static inline gint +val_seg (gint val) +{ + gint r = 1; + + val >>= 8; + if (val & 0xf0) { + val >>= 4; + r += 4; + } + if (val & 0x0c) { + val >>= 2; + r += 2; + } + if (val & 0x02) + r += 1; + return r; +} + +static inline guint8 +s16_to_alaw (gint pcm_val) +{ + gint seg; + guint8 mask; + guint8 aval; + + if (pcm_val >= 0) { + mask = 0xD5; + } else { + mask = 0x55; + pcm_val = -pcm_val; + if (pcm_val > 0x7fff) + pcm_val = 0x7fff; + } + + if (pcm_val < 256) + aval = pcm_val >> 4; + else { + /* Convert the scaled magnitude to segment number. */ + seg = val_seg (pcm_val); + aval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0x0f); + } + return aval ^ mask; +} + +#endif /* GST_ALAW_ENC_USE_TABLE */ + +static GstCaps * +gst_alaw_enc_getcaps (GstPad * pad) +{ + GstALawEnc *alawenc; + GstPad *otherpad; + GstCaps *othercaps, *result; + const GstCaps *templ; + const gchar *name; + gint i; + + alawenc = GST_ALAW_ENC (GST_PAD_PARENT (pad)); + + /* figure out the name of the caps we are going to return */ + if (pad == alawenc->srcpad) { + name = "audio/x-alaw"; + otherpad = alawenc->sinkpad; + } else { + name = "audio/x-raw-int"; + otherpad = alawenc->srcpad; + } + /* get caps from the peer, this can return NULL when there is no peer */ + othercaps = gst_pad_peer_get_caps (otherpad); + + /* get the template caps to make sure we return something acceptable */ + templ = gst_pad_get_pad_template_caps (pad); + + if (othercaps) { + /* there was a peer */ + othercaps = gst_caps_make_writable (othercaps); + + /* go through the caps and remove the fields we don't want */ + for (i = 0; i < gst_caps_get_size (othercaps); i++) { + GstStructure *structure; + + structure = gst_caps_get_structure (othercaps, i); + + /* adjust the name */ + gst_structure_set_name (structure, name); + + if (pad == alawenc->srcpad) { + /* remove the fields we don't want */ + gst_structure_remove_fields (structure, "width", "depth", "endianness", + "signed", NULL); + } else { + /* add fixed fields */ + gst_structure_set (structure, "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, NULL); + } + } + /* filter against the allowed caps of the pad to return our result */ + result = gst_caps_intersect (othercaps, templ); + gst_caps_unref (othercaps); + } else { + /* there was no peer, return the template caps */ + result = gst_caps_copy (templ); + } + + return result; +} + +static gboolean +gst_alaw_enc_setcaps (GstPad * pad, GstCaps * caps) +{ + GstALawEnc *alawenc; + GstPad *otherpad; + GstStructure *structure; + gboolean ret; + GstCaps *base_caps; + + alawenc = GST_ALAW_ENC (GST_PAD_PARENT (pad)); + + structure = gst_caps_get_structure (caps, 0); + gst_structure_get_int (structure, "channels", &alawenc->channels); + gst_structure_get_int (structure, "rate", &alawenc->rate); + + if (pad == alawenc->sinkpad) { + otherpad = alawenc->srcpad; + } else { + otherpad = alawenc->sinkpad; + } + + base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad)); + structure = gst_caps_get_structure (base_caps, 0); + gst_structure_set (structure, "rate", G_TYPE_INT, alawenc->rate, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, alawenc->channels, + NULL); + + GST_DEBUG_OBJECT (alawenc, "rate=%d, channels=%d", alawenc->rate, + alawenc->channels); + + ret = gst_pad_set_caps (otherpad, base_caps); + + gst_caps_unref (base_caps); + + return ret; +} + +static void +gst_alaw_enc_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_static_pad_template (element_class, + &alaw_enc_src_factory); + gst_element_class_add_static_pad_template (element_class, + &alaw_enc_sink_factory); + + gst_element_class_set_details_simple (element_class, + "A Law audio encoder", "Codec/Encoder/Audio", + "Convert 16bit PCM to 8bit A law", + "Zaheer Abbas Merali <zaheerabbas at merali dot org>"); + + GST_DEBUG_CATEGORY_INIT (alaw_enc_debug, "alawenc", 0, "A Law audio encoder"); +} + +static void +gst_alaw_enc_class_init (GstALawEncClass * klass) +{ + /* nothing to do here for now */ +} + +static void +gst_alaw_enc_init (GstALawEnc * alawenc, GstALawEncClass * klass) +{ + alawenc->sinkpad = + gst_pad_new_from_static_template (&alaw_enc_sink_factory, "sink"); + gst_pad_set_setcaps_function (alawenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_enc_setcaps)); + gst_pad_set_getcaps_function (alawenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_enc_getcaps)); + gst_pad_set_chain_function (alawenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_alaw_enc_chain)); + gst_element_add_pad (GST_ELEMENT (alawenc), alawenc->sinkpad); + + alawenc->srcpad = + gst_pad_new_from_static_template (&alaw_enc_src_factory, "src"); + gst_pad_set_setcaps_function (alawenc->srcpad, + GST_DEBUG_FUNCPTR (gst_alaw_enc_setcaps)); + gst_pad_set_getcaps_function (alawenc->srcpad, + GST_DEBUG_FUNCPTR (gst_alaw_enc_getcaps)); + gst_pad_use_fixed_caps (alawenc->srcpad); + gst_element_add_pad (GST_ELEMENT (alawenc), alawenc->srcpad); + + /* init rest */ + alawenc->channels = 0; + alawenc->rate = 0; +} + +static GstFlowReturn +gst_alaw_enc_chain (GstPad * pad, GstBuffer * buffer) +{ + GstALawEnc *alawenc; + gint16 *linear_data; + guint linear_size; + guint8 *alaw_data; + guint alaw_size; + GstBuffer *outbuf; + gint i; + GstFlowReturn ret; + GstClockTime timestamp, duration; + + alawenc = GST_ALAW_ENC (GST_PAD_PARENT (pad)); + + if (G_UNLIKELY (alawenc->rate == 0 || alawenc->channels == 0)) + goto not_negotiated; + + linear_data = (gint16 *) GST_BUFFER_DATA (buffer); + linear_size = GST_BUFFER_SIZE (buffer); + + alaw_size = linear_size / 2; + + timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); + + GST_LOG_OBJECT (alawenc, "buffer with ts=%" GST_TIME_FORMAT, + GST_TIME_ARGS (timestamp)); + + ret = + gst_pad_alloc_buffer_and_set_caps (alawenc->srcpad, + GST_BUFFER_OFFSET_NONE, alaw_size, GST_PAD_CAPS (alawenc->srcpad), + &outbuf); + if (ret != GST_FLOW_OK) + goto done; + + if (duration == GST_CLOCK_TIME_NONE) { + duration = gst_util_uint64_scale_int (alaw_size, + GST_SECOND, alawenc->rate * alawenc->channels); + } + + if (GST_BUFFER_SIZE (outbuf) < alaw_size) { + /* pad-alloc can return a smaller buffer */ + gst_buffer_unref (outbuf); + outbuf = gst_buffer_new_and_alloc (alaw_size); + } + + alaw_data = (guint8 *) GST_BUFFER_DATA (outbuf); + + /* copy discont flag */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + + GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + GST_BUFFER_DURATION (outbuf) = duration; + + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (alawenc->srcpad)); + + for (i = 0; i < alaw_size; i++) { + alaw_data[i] = s16_to_alaw (linear_data[i]); + } + + ret = gst_pad_push (alawenc->srcpad, outbuf); + +done: + + gst_buffer_unref (buffer); + + return ret; + +not_negotiated: + { + ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } +} diff --git a/gst/law/alaw-encode.h b/gst/law/alaw-encode.h new file mode 100644 index 0000000..3ca53a6 --- /dev/null +++ b/gst/law/alaw-encode.h @@ -0,0 +1,59 @@ +/* GStreamer PCM to A-Law conversion + * Copyright (C) 2000 by Abramo Bagnara <abramo@alsa-project.org> + * + * 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_ALAW_ENCODE_H__ +#define __GST_ALAW_ENCODE_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_ALAW_ENC \ + (gst_alaw_enc_get_type()) +#define GST_ALAW_ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALAW_ENC,GstALawEnc)) +#define GST_ALAW_ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALAW_ENC,GstALawEncClass)) +#define GST_IS_ALAW_ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALAW_ENC)) +#define GST_IS_ALAW_ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALAW_ENC)) + +typedef struct _GstALawEnc GstALawEnc; +typedef struct _GstALawEncClass GstALawEncClass; + +struct _GstALawEnc { + GstElement element; + + GstPad *sinkpad,*srcpad; + + gint channels; + gint rate; +}; + +struct _GstALawEncClass { + GstElementClass parent_class; +}; + +GType gst_alaw_enc_get_type(void); + +G_END_DECLS + +#endif /* __GST_ALAW_ENCODE_H__ */ diff --git a/gst/law/alaw.c b/gst/law/alaw.c new file mode 100644 index 0000000..0442935 --- /dev/null +++ b/gst/law/alaw.c @@ -0,0 +1,77 @@ +/* GStreamer PCM/A-Law conversions + * + * 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.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * 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 "alaw-encode.h" +#include "alaw-decode.h" + +GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 8000, 192000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True") + ); + +GstStaticPadTemplate alaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-alaw, " + "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]") + ); + +GstStaticPadTemplate alaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 8000, 192000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True") + ); + +GstStaticPadTemplate alaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-alaw, " + "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]") + ); + +static gboolean +plugin_init (GstPlugin * plugin) +{ + if (!gst_element_register (plugin, "alawenc", + GST_RANK_PRIMARY, GST_TYPE_ALAW_ENC) || + !gst_element_register (plugin, "alawdec", + GST_RANK_PRIMARY, GST_TYPE_ALAW_DEC)) + return FALSE; + + return TRUE; +} + +/* FIXME 0.11: merge alaw and mulaw into one plugin? */ +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "alaw", + "ALaw audio conversion routines", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst/law/mulaw-conversion.c b/gst/law/mulaw-conversion.c new file mode 100644 index 0000000..8afae80 --- /dev/null +++ b/gst/law/mulaw-conversion.c @@ -0,0 +1,118 @@ +/* + * This routine converts from linear to ulaw + * 29 September 1989 + * + * Craig Reese: IDA/Supercomputing Research Center + * Joe Campbell: Department of Defense + * + * References: + * 1) CCITT Recommendation G.711 (very difficult to follow) + * 2) "A New Digital Technique for Implementation of Any + * Continuous PCM Companding Law," Villeret, Michel, + * et al. 1973 IEEE Int. Conf. on Communications, Vol 1, + * 1973, pg. 11.12-11.17 + * 3) MIL-STD-188-113,"Interoperability and Performance Standards + * for Analog-to_Digital Conversion Techniques," + * 17 February 1987 + * + * Input: Signed 16 bit linear sample + * Output: 8 bit ulaw sample + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <glib.h> + +#include "mulaw-conversion.h" + +#undef ZEROTRAP /* turn on the trap as per the MIL-STD */ +#define BIAS 0x84 /* define the add-in bias for 16 bit samples */ +#define CLIP 32635 + +void +mulaw_encode (gint16 * in, guint8 * out, gint numsamples) +{ + static gint16 exp_lut[256] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 + }; + gint16 sign, exponent, mantissa, i; + gint16 sample; + guint8 ulawbyte; + + for (i = 0; i < numsamples; i++) { + sample = in[i]; + /** get the sample into sign-magnitude **/ + sign = (sample >> 8) & 0x80; /* set aside the sign */ + if (sign != 0) { + sample = -sample; /* get magnitude */ + } + /* sample can be zero because we can overflow in the inversion, + * checking against the unsigned version solves this */ + if (((guint16) sample) > CLIP) + sample = CLIP; /* clip the magnitude */ + + /** convert from 16 bit linear to ulaw **/ + sample = sample + BIAS; + exponent = exp_lut[(sample >> 7) & 0xFF]; + mantissa = (sample >> (exponent + 3)) & 0x0F; + ulawbyte = ~(sign | (exponent << 4) | mantissa); +#ifdef ZEROTRAP + if (ulawbyte == 0) + ulawbyte = 0x02; /* optional CCITT trap */ +#endif + out[i] = ulawbyte; + } +} + +/* + * This routine converts from ulaw to 16 bit linear + * 29 September 1989 + * + * Craig Reese: IDA/Supercomputing Research Center + * + * References: + * 1) CCITT Recommendation G.711 (very difficult to follow) + * 2) MIL-STD-188-113,"Interoperability and Performance Standards + * for Analog-to_Digital Conversion Techniques," + * 17 February 1987 + * + * Input: 8 bit ulaw sample + * Output: signed 16 bit linear sample + */ + +void +mulaw_decode (guint8 * in, gint16 * out, gint numsamples) +{ + static gint16 exp_lut[8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 }; + gint16 sign, exponent, mantissa; + guint8 ulawbyte; + gint16 linear, i; + + for (i = 0; i < numsamples; i++) { + ulawbyte = in[i]; + ulawbyte = ~ulawbyte; + sign = (ulawbyte & 0x80); + exponent = (ulawbyte >> 4) & 0x07; + mantissa = ulawbyte & 0x0F; + linear = exp_lut[exponent] + (mantissa << (exponent + 3)); + if (sign != 0) + linear = -linear; + out[i] = linear; + } +} diff --git a/gst/law/mulaw-conversion.h b/gst/law/mulaw-conversion.h new file mode 100644 index 0000000..38367ad --- /dev/null +++ b/gst/law/mulaw-conversion.h @@ -0,0 +1,12 @@ +#ifndef _GST_ULAW_CONVERSION_H +#define _GST_ULAW_CONVERSION_H + +#include <glib.h> + +void +mulaw_encode(gint16* in, guint8* out, gint numsamples); +void +mulaw_decode(guint8* in,gint16* out,gint numsamples); + +#endif /* _GST_ULAW_CONVERSION_H */ + diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c new file mode 100644 index 0000000..b8a0d65 --- /dev/null +++ b/gst/law/mulaw-decode.c @@ -0,0 +1,307 @@ +/* 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. + */ +/** + * SECTION:element-mulawdec + * + * This element decodes mulaw audio. Mulaw coding is also known as G.711. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <gst/gst.h> +#include "mulaw-decode.h" +#include "mulaw-conversion.h" + +extern GstStaticPadTemplate mulaw_dec_src_factory; +extern GstStaticPadTemplate mulaw_dec_sink_factory; + +/* Stereo signals and args */ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + ARG_0 +}; + +static void gst_mulawdec_class_init (GstMuLawDecClass * klass); +static void gst_mulawdec_base_init (GstMuLawDecClass * klass); +static void gst_mulawdec_init (GstMuLawDec * mulawdec); +static GstStateChangeReturn +gst_mulawdec_change_state (GstElement * element, GstStateChange transition); + +static GstFlowReturn gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer); + +static GstElementClass *parent_class = NULL; + +static gboolean +mulawdec_sink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstMuLawDec *mulawdec; + GstStructure *structure; + int rate, channels; + gboolean ret; + GstCaps *outcaps; + + mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad)); + + structure = gst_caps_get_structure (caps, 0); + ret = gst_structure_get_int (structure, "rate", &rate); + ret = ret && gst_structure_get_int (structure, "channels", &channels); + if (!ret) + return FALSE; + + outcaps = gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, channels, NULL); + ret = gst_pad_set_caps (mulawdec->srcpad, outcaps); + gst_caps_unref (outcaps); + + if (ret) { + GST_DEBUG_OBJECT (mulawdec, "rate=%d, channels=%d", rate, channels); + mulawdec->rate = rate; + mulawdec->channels = channels; + } + return ret; +} + +static GstCaps * +mulawdec_getcaps (GstPad * pad) +{ + GstMuLawDec *mulawdec; + GstPad *otherpad; + GstCaps *othercaps, *result; + const GstCaps *templ; + const gchar *name; + gint i; + + mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad)); + + /* figure out the name of the caps we are going to return */ + if (pad == mulawdec->srcpad) { + name = "audio/x-raw-int"; + otherpad = mulawdec->sinkpad; + } else { + name = "audio/x-mulaw"; + otherpad = mulawdec->srcpad; + } + /* get caps from the peer, this can return NULL when there is no peer */ + othercaps = gst_pad_peer_get_caps (otherpad); + + /* get the template caps to make sure we return something acceptable */ + templ = gst_pad_get_pad_template_caps (pad); + + if (othercaps) { + /* there was a peer */ + othercaps = gst_caps_make_writable (othercaps); + + /* go through the caps and remove the fields we don't want */ + for (i = 0; i < gst_caps_get_size (othercaps); i++) { + GstStructure *structure; + + structure = gst_caps_get_structure (othercaps, i); + + /* adjust the name */ + gst_structure_set_name (structure, name); + + if (pad == mulawdec->sinkpad) { + /* remove the fields we don't want */ + gst_structure_remove_fields (structure, "width", "depth", "endianness", + "signed", NULL); + } else { + /* add fixed fields */ + gst_structure_set (structure, "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, NULL); + } + } + /* filter against the allowed caps of the pad to return our result */ + result = gst_caps_intersect (othercaps, templ); + gst_caps_unref (othercaps); + } else { + /* there was no peer, return the template caps */ + result = gst_caps_copy (templ); + } + return result; +} + +GType +gst_mulawdec_get_type (void) +{ + static GType mulawdec_type = 0; + + if (!mulawdec_type) { + static const GTypeInfo mulawdec_info = { + sizeof (GstMuLawDecClass), + (GBaseInitFunc) gst_mulawdec_base_init, + NULL, + (GClassInitFunc) gst_mulawdec_class_init, + NULL, + NULL, + sizeof (GstMuLawDec), + 0, + (GInstanceInitFunc) gst_mulawdec_init, + }; + + mulawdec_type = + g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info, + 0); + } + return mulawdec_type; +} + +static void +gst_mulawdec_base_init (GstMuLawDecClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_static_pad_template (element_class, + &mulaw_dec_src_factory); + gst_element_class_add_static_pad_template (element_class, + &mulaw_dec_sink_factory); + gst_element_class_set_details_simple (element_class, "Mu Law audio decoder", + "Codec/Decoder/Audio", + "Convert 8bit mu law to 16bit PCM", + "Zaheer Abbas Merali <zaheerabbas at merali dot org>"); +} + +static void +gst_mulawdec_class_init (GstMuLawDecClass * klass) +{ + GstElementClass *element_class = (GstElementClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + element_class->change_state = GST_DEBUG_FUNCPTR (gst_mulawdec_change_state); +} + +static void +gst_mulawdec_init (GstMuLawDec * mulawdec) +{ + mulawdec->sinkpad = + gst_pad_new_from_static_template (&mulaw_dec_sink_factory, "sink"); + gst_pad_set_setcaps_function (mulawdec->sinkpad, mulawdec_sink_setcaps); + gst_pad_set_getcaps_function (mulawdec->sinkpad, mulawdec_getcaps); + gst_pad_set_chain_function (mulawdec->sinkpad, gst_mulawdec_chain); + gst_element_add_pad (GST_ELEMENT (mulawdec), mulawdec->sinkpad); + + mulawdec->srcpad = + gst_pad_new_from_static_template (&mulaw_dec_src_factory, "src"); + gst_pad_use_fixed_caps (mulawdec->srcpad); + gst_pad_set_getcaps_function (mulawdec->srcpad, mulawdec_getcaps); + gst_element_add_pad (GST_ELEMENT (mulawdec), mulawdec->srcpad); +} + +static GstFlowReturn +gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer) +{ + GstMuLawDec *mulawdec; + gint16 *linear_data; + guint8 *mulaw_data; + guint mulaw_size; + GstBuffer *outbuf; + GstFlowReturn ret; + + mulawdec = GST_MULAWDEC (GST_PAD_PARENT (pad)); + + if (G_UNLIKELY (mulawdec->rate == 0)) + goto not_negotiated; + + mulaw_data = (guint8 *) GST_BUFFER_DATA (buffer); + mulaw_size = GST_BUFFER_SIZE (buffer); + + ret = + gst_pad_alloc_buffer_and_set_caps (mulawdec->srcpad, + GST_BUFFER_OFFSET_NONE, mulaw_size * 2, GST_PAD_CAPS (mulawdec->srcpad), + &outbuf); + if (ret != GST_FLOW_OK) + goto alloc_failed; + + linear_data = (gint16 *) GST_BUFFER_DATA (outbuf); + + /* copy discont flag */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer); + if (GST_BUFFER_DURATION (outbuf) == GST_CLOCK_TIME_NONE) + GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale_int (GST_SECOND, + mulaw_size * 2, 2 * mulawdec->rate * mulawdec->channels); + else + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buffer); + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mulawdec->srcpad)); + + mulaw_decode (mulaw_data, linear_data, mulaw_size); + + gst_buffer_unref (buffer); + + ret = gst_pad_push (mulawdec->srcpad, outbuf); + + return ret; + + /* ERRORS */ +not_negotiated: + { + GST_WARNING_OBJECT (mulawdec, "no input format set: not-negotiated"); + gst_buffer_unref (buffer); + return GST_FLOW_NOT_NEGOTIATED; + } +alloc_failed: + { + GST_DEBUG_OBJECT (mulawdec, "pad alloc failed, flow: %s", + gst_flow_get_name (ret)); + gst_buffer_unref (buffer); + return ret; + } +} + +static GstStateChangeReturn +gst_mulawdec_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret; + GstMuLawDec *dec = GST_MULAWDEC (element); + + switch (transition) { + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret != GST_STATE_CHANGE_SUCCESS) + return ret; + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + dec->rate = 0; + dec->channels = 0; + break; + default: + break; + } + + return ret; +} diff --git a/gst/law/mulaw-decode.h b/gst/law/mulaw-decode.h new file mode 100644 index 0000000..9585118 --- /dev/null +++ b/gst/law/mulaw-decode.h @@ -0,0 +1,58 @@ +/* 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_MULAWDECODE_H__ +#define __GST_MULAWDECODE_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_MULAWDEC \ + (gst_mulawdec_get_type()) +#define GST_MULAWDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULAWDEC,GstMuLawDec)) +#define GST_MULAWDEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULAWDEC,GstMuLawDecClass)) +#define GST_IS_MULAWDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULAWDEC)) +#define GST_IS_MULAWDEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULAWDEC)) + +typedef struct _GstMuLawDec GstMuLawDec; +typedef struct _GstMuLawDecClass GstMuLawDecClass; + +struct _GstMuLawDec { + GstElement element; + + GstPad *sinkpad,*srcpad; + + gint rate; + gint channels; +}; + +struct _GstMuLawDecClass { + GstElementClass parent_class; +}; + +GType gst_mulawdec_get_type(void); + +G_END_DECLS + +#endif /* __GST_STEREO_H__ */ diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c new file mode 100644 index 0000000..15f8285 --- /dev/null +++ b/gst/law/mulaw-encode.c @@ -0,0 +1,297 @@ +/* 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. + */ +/** + * SECTION:element-mulawenc + * + * This element encode mulaw audio. Mulaw coding is also known as G.711. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <gst/gst.h> +#include "mulaw-encode.h" +#include "mulaw-conversion.h" + +extern GstStaticPadTemplate mulaw_enc_src_factory; +extern GstStaticPadTemplate mulaw_enc_sink_factory; + +/* Stereo signals and args */ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + ARG_0 +}; + +static void gst_mulawenc_class_init (GstMuLawEncClass * klass); +static void gst_mulawenc_base_init (GstMuLawEncClass * klass); +static void gst_mulawenc_init (GstMuLawEnc * mulawenc); + +static GstFlowReturn gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer); + +static GstElementClass *parent_class = NULL; + +/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */ + +static GstCaps * +mulawenc_getcaps (GstPad * pad) +{ + GstMuLawEnc *mulawenc; + GstPad *otherpad; + GstCaps *othercaps, *result; + const GstCaps *templ; + const gchar *name; + gint i; + + mulawenc = GST_MULAWENC (GST_PAD_PARENT (pad)); + + /* figure out the name of the caps we are going to return */ + if (pad == mulawenc->srcpad) { + name = "audio/x-mulaw"; + otherpad = mulawenc->sinkpad; + } else { + name = "audio/x-raw-int"; + otherpad = mulawenc->srcpad; + } + /* get caps from the peer, this can return NULL when there is no peer */ + othercaps = gst_pad_peer_get_caps (otherpad); + + /* get the template caps to make sure we return something acceptable */ + templ = gst_pad_get_pad_template_caps (pad); + + if (othercaps) { + /* there was a peer */ + othercaps = gst_caps_make_writable (othercaps); + + /* go through the caps and remove the fields we don't want */ + for (i = 0; i < gst_caps_get_size (othercaps); i++) { + GstStructure *structure; + + structure = gst_caps_get_structure (othercaps, i); + + /* adjust the name */ + gst_structure_set_name (structure, name); + + if (pad == mulawenc->srcpad) { + /* remove the fields we don't want */ + gst_structure_remove_fields (structure, "width", "depth", "endianness", + "signed", NULL); + } else { + /* add fixed fields */ + gst_structure_set (structure, "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, NULL); + } + } + /* filter against the allowed caps of the pad to return our result */ + result = gst_caps_intersect (othercaps, templ); + gst_caps_unref (othercaps); + } else { + /* there was no peer, return the template caps */ + result = gst_caps_copy (templ); + } + return result; +} + +static gboolean +mulawenc_setcaps (GstPad * pad, GstCaps * caps) +{ + GstMuLawEnc *mulawenc; + GstPad *otherpad; + GstStructure *structure; + GstCaps *base_caps; + + mulawenc = GST_MULAWENC (gst_pad_get_parent (pad)); + + structure = gst_caps_get_structure (caps, 0); + gst_structure_get_int (structure, "channels", &mulawenc->channels); + gst_structure_get_int (structure, "rate", &mulawenc->rate); + + if (pad == mulawenc->sinkpad) { + otherpad = mulawenc->srcpad; + } else { + otherpad = mulawenc->sinkpad; + } + base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad)); + + structure = gst_caps_get_structure (base_caps, 0); + gst_structure_set (structure, "rate", G_TYPE_INT, mulawenc->rate, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, mulawenc->channels, + NULL); + + gst_pad_set_caps (otherpad, base_caps); + + gst_object_unref (mulawenc); + gst_caps_unref (base_caps); + + return TRUE; +} + +GType +gst_mulawenc_get_type (void) +{ + static GType mulawenc_type = 0; + + if (!mulawenc_type) { + static const GTypeInfo mulawenc_info = { + sizeof (GstMuLawEncClass), + (GBaseInitFunc) gst_mulawenc_base_init, + NULL, + (GClassInitFunc) gst_mulawenc_class_init, + NULL, + NULL, + sizeof (GstMuLawEnc), + 0, + (GInstanceInitFunc) gst_mulawenc_init, + }; + + mulawenc_type = + g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info, + 0); + } + return mulawenc_type; +} + +static void +gst_mulawenc_base_init (GstMuLawEncClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_static_pad_template (element_class, + &mulaw_enc_src_factory); + gst_element_class_add_static_pad_template (element_class, + &mulaw_enc_sink_factory); + gst_element_class_set_details_simple (element_class, "Mu Law audio encoder", + "Codec/Encoder/Audio", + "Convert 16bit PCM to 8bit mu law", + "Zaheer Abbas Merali <zaheerabbas at merali dot org>"); +} + +static void +gst_mulawenc_class_init (GstMuLawEncClass * klass) +{ + parent_class = g_type_class_peek_parent (klass); +} + +static void +gst_mulawenc_init (GstMuLawEnc * mulawenc) +{ + mulawenc->sinkpad = + gst_pad_new_from_static_template (&mulaw_enc_sink_factory, "sink"); + gst_pad_set_setcaps_function (mulawenc->sinkpad, mulawenc_setcaps); + gst_pad_set_getcaps_function (mulawenc->sinkpad, mulawenc_getcaps); + gst_pad_set_chain_function (mulawenc->sinkpad, gst_mulawenc_chain); + gst_element_add_pad (GST_ELEMENT (mulawenc), mulawenc->sinkpad); + + mulawenc->srcpad = + gst_pad_new_from_static_template (&mulaw_enc_src_factory, "src"); + gst_pad_set_setcaps_function (mulawenc->srcpad, mulawenc_setcaps); + gst_pad_set_getcaps_function (mulawenc->srcpad, mulawenc_getcaps); + gst_pad_use_fixed_caps (mulawenc->srcpad); + gst_element_add_pad (GST_ELEMENT (mulawenc), mulawenc->srcpad); + + /* init rest */ + mulawenc->channels = 0; + mulawenc->rate = 0; +} + +static GstFlowReturn +gst_mulawenc_chain (GstPad * pad, GstBuffer * buffer) +{ + GstMuLawEnc *mulawenc; + gint16 *linear_data; + guint linear_size; + guint8 *mulaw_data; + guint mulaw_size; + GstBuffer *outbuf; + GstFlowReturn ret; + GstClockTime timestamp, duration; + + mulawenc = GST_MULAWENC (gst_pad_get_parent (pad)); + + if (!mulawenc->rate || !mulawenc->channels) + goto not_negotiated; + + linear_data = (gint16 *) GST_BUFFER_DATA (buffer); + linear_size = GST_BUFFER_SIZE (buffer); + + mulaw_size = linear_size / 2; + + timestamp = GST_BUFFER_TIMESTAMP (buffer); + duration = GST_BUFFER_DURATION (buffer); + + ret = gst_pad_alloc_buffer_and_set_caps (mulawenc->srcpad, + GST_BUFFER_OFFSET_NONE, mulaw_size, GST_PAD_CAPS (mulawenc->srcpad), + &outbuf); + if (ret != GST_FLOW_OK) + goto alloc_failed; + + if (duration == -1) { + duration = gst_util_uint64_scale_int (mulaw_size, + GST_SECOND, mulawenc->rate * mulawenc->channels); + } + + if (GST_BUFFER_SIZE (outbuf) < mulaw_size) { + /* pad-alloc can suggest a smaller size */ + gst_buffer_unref (outbuf); + outbuf = gst_buffer_new_and_alloc (mulaw_size); + } + + mulaw_data = (guint8 *) GST_BUFFER_DATA (outbuf); + + /* copy discont flag */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + + GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + GST_BUFFER_DURATION (outbuf) = duration; + + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mulawenc->srcpad)); + + mulaw_encode (linear_data, mulaw_data, mulaw_size); + + gst_buffer_unref (buffer); + + ret = gst_pad_push (mulawenc->srcpad, outbuf); + +done: + gst_object_unref (mulawenc); + + return ret; + +not_negotiated: + { + GST_DEBUG_OBJECT (mulawenc, "no format negotiated"); + ret = GST_FLOW_NOT_NEGOTIATED; + gst_buffer_unref (buffer); + goto done; + } +alloc_failed: + { + GST_DEBUG_OBJECT (mulawenc, "pad alloc failed"); + gst_buffer_unref (buffer); + goto done; + } +} diff --git a/gst/law/mulaw-encode.h b/gst/law/mulaw-encode.h new file mode 100644 index 0000000..f428c3c --- /dev/null +++ b/gst/law/mulaw-encode.h @@ -0,0 +1,59 @@ +/* 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_MULAWENCODE_H__ +#define __GST_MULAWENCODE_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_MULAWENC \ + (gst_mulawenc_get_type()) +#define GST_MULAWENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULAWENC,GstMuLawEnc)) +#define GST_MULAWENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULAWENC,GstMuLawEncClass)) +#define GST_IS_MULAWENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULAWENC)) +#define GST_IS_MULAWENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULAWENC)) + +typedef struct _GstMuLawEnc GstMuLawEnc; +typedef struct _GstMuLawEncClass GstMuLawEncClass; + +struct _GstMuLawEnc { + GstElement element; + + GstPad *sinkpad,*srcpad; + + gint channels; + gint rate; +}; + +struct _GstMuLawEncClass { + GstElementClass parent_class; +}; + +GType gst_mulawenc_get_type(void); + +G_END_DECLS + +#endif /* __GST_STEREO_H__ */ diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c new file mode 100644 index 0000000..e8d9e72 --- /dev/null +++ b/gst/law/mulaw.c @@ -0,0 +1,75 @@ +/* GStreamer PCM/A-Law conversions + * + * 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.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * 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 "mulaw-encode.h" +#include "mulaw-decode.h" + +GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 8000, 192000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True") + ); + +GstStaticPadTemplate mulaw_dec_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-mulaw, " + "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]") + ); + +GstStaticPadTemplate mulaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "rate = (int) [ 8000, 192000 ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True") + ); + +GstStaticPadTemplate mulaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-mulaw, " + "rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]") + ); + +static gboolean +plugin_init (GstPlugin * plugin) +{ + if (!gst_element_register (plugin, "mulawenc", + GST_RANK_PRIMARY, GST_TYPE_MULAWENC) || + !gst_element_register (plugin, "mulawdec", + GST_RANK_PRIMARY, GST_TYPE_MULAWDEC)) + return FALSE; + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "mulaw", + "MuLaw audio conversion routines", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) |