diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:49:49 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:49:49 +0900 |
commit | fed9ccc4d4585e39e42dc6079432ff6aae32eb1a (patch) | |
tree | 6731ed9fe52be60184497e20ece1a9b725f8d8b9 /ext/twolame | |
parent | b324cb9340d425326f3d0a491c7754cfcdd1c571 (diff) | |
download | gst-plugins-ugly-accepted/tizen_2.4_mobile.tar.gz gst-plugins-ugly-accepted/tizen_2.4_mobile.tar.bz2 gst-plugins-ugly-accepted/tizen_2.4_mobile.zip |
tizen 2.4 releasetizen_2.4_mobile_releasesubmit/tizen_2.4/20151028.064345accepted/tizen/2.4/mobile/20151029.032640tizen_2.4accepted/tizen_2.4_mobile
Diffstat (limited to 'ext/twolame')
-rw-r--r-- | ext/twolame/Makefile.am | 12 | ||||
-rw-r--r-- | ext/twolame/Makefile.in | 830 | ||||
-rw-r--r-- | ext/twolame/gsttwolamemp2enc.c | 891 | ||||
-rw-r--r-- | ext/twolame/gsttwolamemp2enc.h | 88 |
4 files changed, 1821 insertions, 0 deletions
diff --git a/ext/twolame/Makefile.am b/ext/twolame/Makefile.am new file mode 100644 index 0000000..b6de82c --- /dev/null +++ b/ext/twolame/Makefile.am @@ -0,0 +1,12 @@ +plugin_LTLIBRARIES = libgsttwolame.la + +libgsttwolame_la_SOURCES = gsttwolamemp2enc.c +libgsttwolame_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(TWOLAME_CFLAGS) +libgsttwolame_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ + -lgstaudio-@GST_API_VERSION@ -lgstpbutils-@GST_API_VERSION@ \ + $(GST_LIBS) $(TWOLAME_LIBS) +libgsttwolame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgsttwolame_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) + +noinst_HEADERS = gsttwolamemp2enc.h diff --git a/ext/twolame/Makefile.in b/ext/twolame/Makefile.in new file mode 100644 index 0000000..3017506 --- /dev/null +++ b/ext/twolame/Makefile.in @@ -0,0 +1,830 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = ext/twolame +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp $(noinst_HEADERS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \ + $(top_srcdir)/common/m4/as-auto-alt.m4 \ + $(top_srcdir)/common/m4/as-compiler-flag.m4 \ + $(top_srcdir)/common/m4/as-libtool.m4 \ + $(top_srcdir)/common/m4/as-version.m4 \ + $(top_srcdir)/common/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/common/m4/gst-arch.m4 \ + $(top_srcdir)/common/m4/gst-args.m4 \ + $(top_srcdir)/common/m4/gst-check.m4 \ + $(top_srcdir)/common/m4/gst-default.m4 \ + $(top_srcdir)/common/m4/gst-dowhile.m4 \ + $(top_srcdir)/common/m4/gst-error.m4 \ + $(top_srcdir)/common/m4/gst-feature.m4 \ + $(top_srcdir)/common/m4/gst-function.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-plugin-docs.m4 \ + $(top_srcdir)/common/m4/gst-plugindir.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/a52.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gst-sid.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 = +libgsttwolame_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libgsttwolame_la_OBJECTS = libgsttwolame_la-gsttwolamemp2enc.lo +libgsttwolame_la_OBJECTS = $(am_libgsttwolame_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgsttwolame_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(libgsttwolame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(libgsttwolame_la_CFLAGS) $(CFLAGS) \ + $(libgsttwolame_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgsttwolame_la_SOURCES) +DIST_SOURCES = $(libgsttwolame_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A52DEC_CFLAGS = @A52DEC_CFLAGS@ +A52DEC_LIBS = @A52DEC_LIBS@ +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMRNB_CFLAGS = @AMRNB_CFLAGS@ +AMRNB_LIBS = @AMRNB_LIBS@ +AMRWB_CFLAGS = @AMRWB_CFLAGS@ +AMRWB_LIBS = @AMRWB_LIBS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CDIO_CFLAGS = @CDIO_CFLAGS@ +CDIO_LIBS = @CDIO_LIBS@ +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@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DVDREAD_LIBS = @DVDREAD_LIBS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +ERROR_CXXFLAGS = @ERROR_CXXFLAGS@ +EXEEXT = @EXEEXT@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GCOV = @GCOV@ +GCOV_CFLAGS = @GCOV_CFLAGS@ +GCOV_LIBS = @GCOV_LIBS@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LDFLAGS = @GIO_LDFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ = @GLIB_REQ@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@ +GSTPB_PREFIX = @GSTPB_PREFIX@ +GST_AGE = @GST_AGE@ +GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@ +GST_API_VERSION = @GST_API_VERSION@ +GST_BASE_CFLAGS = @GST_BASE_CFLAGS@ +GST_BASE_LIBS = @GST_BASE_LIBS@ +GST_CFLAGS = @GST_CFLAGS@ +GST_CHECK_CFLAGS = @GST_CHECK_CFLAGS@ +GST_CHECK_LIBS = @GST_CHECK_LIBS@ +GST_CURRENT = @GST_CURRENT@ +GST_CXXFLAGS = @GST_CXXFLAGS@ +GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@ +GST_LIBS = @GST_LIBS@ +GST_LIBVERSION = @GST_LIBVERSION@ +GST_LICENSE = @GST_LICENSE@ +GST_LT_LDFLAGS = @GST_LT_LDFLAGS@ +GST_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_NONPORTED = @GST_PLUGINS_NONPORTED@ +GST_PLUGINS_SELECTED = @GST_PLUGINS_SELECTED@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GST_PLUGIN_LIBTOOLFLAGS = @GST_PLUGIN_LIBTOOLFLAGS@ +GST_PREFIX = @GST_PREFIX@ +GST_REVISION = @GST_REVISION@ +GST_TOOLS_DIR = @GST_TOOLS_DIR@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +HAVE_CXX = @HAVE_CXX@ +HAVE_DVDREAD = @HAVE_DVDREAD@ +HAVE_LAME = @HAVE_LAME@ +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@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MPEG2DEC_CFLAGS = @MPEG2DEC_CFLAGS@ +MPEG2DEC_LIBS = @MPEG2DEC_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +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@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIDPLAY_CFLAGS = @SIDPLAY_CFLAGS@ +SIDPLAY_LIBS = @SIDPLAY_LIBS@ +STRIP = @STRIP@ +TWOLAME_CFLAGS = @TWOLAME_CFLAGS@ +TWOLAME_LIBS = @TWOLAME_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@ +WIN32_LIBS = @WIN32_LIBS@ +X264_CFLAGS = @X264_CFLAGS@ +X264_LIBS = @X264_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_LTLIBRARIES = libgsttwolame.la +libgsttwolame_la_SOURCES = gsttwolamemp2enc.c +libgsttwolame_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(TWOLAME_CFLAGS) + +libgsttwolame_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ + -lgstaudio-@GST_API_VERSION@ -lgstpbutils-@GST_API_VERSION@ \ + $(GST_LIBS) $(TWOLAME_LIBS) + +libgsttwolame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgsttwolame_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) +noinst_HEADERS = gsttwolamemp2enc.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/twolame/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu ext/twolame/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libgsttwolame.la: $(libgsttwolame_la_OBJECTS) $(libgsttwolame_la_DEPENDENCIES) $(EXTRA_libgsttwolame_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgsttwolame_la_LINK) -rpath $(plugindir) $(libgsttwolame_la_OBJECTS) $(libgsttwolame_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsttwolame_la-gsttwolamemp2enc.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libgsttwolame_la-gsttwolamemp2enc.lo: gsttwolamemp2enc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgsttwolame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgsttwolame_la_CFLAGS) $(CFLAGS) -MT libgsttwolame_la-gsttwolamemp2enc.lo -MD -MP -MF $(DEPDIR)/libgsttwolame_la-gsttwolamemp2enc.Tpo -c -o libgsttwolame_la-gsttwolamemp2enc.lo `test -f 'gsttwolamemp2enc.c' || echo '$(srcdir)/'`gsttwolamemp2enc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsttwolame_la-gsttwolamemp2enc.Tpo $(DEPDIR)/libgsttwolame_la-gsttwolamemp2enc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsttwolamemp2enc.c' object='libgsttwolame_la-gsttwolamemp2enc.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 $(libgsttwolame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgsttwolame_la_CFLAGS) $(CFLAGS) -c -o libgsttwolame_la-gsttwolamemp2enc.lo `test -f 'gsttwolamemp2enc.c' || echo '$(srcdir)/'`gsttwolamemp2enc.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pluginLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/ext/twolame/gsttwolamemp2enc.c b/ext/twolame/gsttwolamemp2enc.c new file mode 100644 index 0000000..12b6f5a --- /dev/null +++ b/ext/twolame/gsttwolamemp2enc.c @@ -0,0 +1,891 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * Copyright (C) <2004> Wim Taymans <wim@fluendo.com> + * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> + * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* + * Based on the lame element. + */ + +/** + * SECTION:element-twolame + * @see_also: mad, lame + * + * This element encodes raw integer audio into an MPEG-1 layer 2 (MP2) stream. + * + * <refsect2> + * <title>Example pipelines</title> + * |[ + * gst-launch -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! twolame ! filesink location=sine.mp2 + * ]| Encode a test sine signal to MP2. + * |[ + * gst-launch -v alsasrc ! audioconvert ! twolame bitrate=192 ! filesink location=alsasrc.mp2 + * ]| Record from a sound card using ALSA and encode to MP2 + * |[ + * gst-launch -v filesrc location=music.wav ! decodebin ! audioconvert ! audioresample ! twolame bitrate=192 ! id3v2mux ! filesink location=music.mp2 + * ]| Transcode from a .wav file to MP2 (the id3v2mux element is optional) + * |[ + * gst-launch -v cdda://5 ! audioconvert ! twolame bitrate=192 ! filesink location=track5.mp2 + * ]| Encode Audio CD track 5 to MP2 + * </refsect2> + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "string.h" +#include "gsttwolamemp2enc.h" +#include "gst/gst-i18n-plugin.h" + +GST_DEBUG_CATEGORY_STATIC (debug); +#define GST_CAT_DEFAULT debug + +/* TwoLAME can do MPEG-1, MPEG-2 so it has 6 possible + * sample rates it supports */ +static GstStaticPadTemplate gst_two_lame_sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) { " GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (S16) " }, " + "layout = (string) interleaved, " + "rate = (int) { 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) 1; " + "audio/x-raw, " + "format = (string) { " GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (S16) " }, " + "layout = (string) interleaved, " + "rate = (int) { 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) 2," "channel-mask = (bitmask) 0x3") + ); + +static GstStaticPadTemplate gst_two_lame_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) 2, " + "rate = (int) { 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) [ 1, 2 ]") + ); + +static struct +{ + gint mode; + gint psymodel; + gint bitrate; + gint padding; + gboolean energy_level_extension; + gint emphasis; + gboolean error_protection; + gboolean copyright; + gboolean original; + gboolean vbr; + gfloat vbr_level; + gfloat ath_level; + gint vbr_max_bitrate; + gboolean quick_mode; + gint quick_mode_count; +} gst_two_lame_default_settings; + +/********** Define useful types for non-programmatic interfaces **********/ +#define GST_TYPE_TWO_LAME_MODE (gst_two_lame_mode_get_type()) +static GType +gst_two_lame_mode_get_type (void) +{ + static GType two_lame_mode_type = 0; + static GEnumValue two_lame_modes[] = { + {TWOLAME_AUTO_MODE, "Auto", "auto"}, + {TWOLAME_STEREO, "Stereo", "stereo"}, + {TWOLAME_JOINT_STEREO, "Joint Stereo", "joint"}, + {TWOLAME_DUAL_CHANNEL, "Dual Channel", "dual"}, + {TWOLAME_MONO, "Mono", "mono"}, + {0, NULL, NULL} + }; + + if (!two_lame_mode_type) { + two_lame_mode_type = + g_enum_register_static ("GstTwoLameMode", two_lame_modes); + } + return two_lame_mode_type; +} + +#define GST_TYPE_TWO_LAME_PADDING (gst_two_lame_padding_get_type()) +static GType +gst_two_lame_padding_get_type (void) +{ + static GType two_lame_padding_type = 0; + static GEnumValue two_lame_padding[] = { + {TWOLAME_PAD_NO, "No Padding", "never"}, + {TWOLAME_PAD_ALL, "Always Pad", "always"}, + {0, NULL, NULL} + }; + + if (!two_lame_padding_type) { + two_lame_padding_type = + g_enum_register_static ("GstTwoLamePadding", two_lame_padding); + } + return two_lame_padding_type; +} + +#define GST_TYPE_TWO_LAME_EMPHASIS (gst_two_lame_emphasis_get_type()) +static GType +gst_two_lame_emphasis_get_type (void) +{ + static GType two_lame_emphasis_type = 0; + static GEnumValue two_lame_emphasis[] = { + {TWOLAME_EMPHASIS_N, "No emphasis", "none"}, + {TWOLAME_EMPHASIS_5, "50/15 ms", "5"}, + {TWOLAME_EMPHASIS_C, "CCIT J.17", "ccit"}, + {0, NULL, NULL} + }; + + if (!two_lame_emphasis_type) { + two_lame_emphasis_type = + g_enum_register_static ("GstTwoLameEmphasis", two_lame_emphasis); + } + + return two_lame_emphasis_type; +} + +/********** Standard stuff for signals and arguments **********/ + +enum +{ + ARG_0, + ARG_MODE, + ARG_PSYMODEL, + ARG_BITRATE, + ARG_PADDING, + ARG_ENERGY_LEVEL_EXTENSION, + ARG_EMPHASIS, + ARG_ERROR_PROTECTION, + ARG_COPYRIGHT, + ARG_ORIGINAL, + ARG_VBR, + ARG_VBR_LEVEL, + ARG_ATH_LEVEL, + ARG_VBR_MAX_BITRATE, + ARG_QUICK_MODE, + ARG_QUICK_MODE_COUNT +}; + +static gboolean gst_two_lame_start (GstAudioEncoder * enc); +static gboolean gst_two_lame_stop (GstAudioEncoder * enc); +static gboolean gst_two_lame_set_format (GstAudioEncoder * enc, + GstAudioInfo * info); +static GstFlowReturn gst_two_lame_handle_frame (GstAudioEncoder * enc, + GstBuffer * in_buf); +static void gst_two_lame_flush (GstAudioEncoder * enc); + +static void gst_two_lame_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_two_lame_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static gboolean gst_two_lame_setup (GstTwoLame * twolame); + +G_DEFINE_TYPE (GstTwoLame, gst_two_lame, GST_TYPE_AUDIO_ENCODER); + +static void +gst_two_lame_release_memory (GstTwoLame * twolame) +{ + if (twolame->glopts) { + twolame_close (&twolame->glopts); + twolame->glopts = NULL; + } +} + +static void +gst_two_lame_finalize (GObject * obj) +{ + gst_two_lame_release_memory (GST_TWO_LAME (obj)); + + G_OBJECT_CLASS (gst_two_lame_parent_class)->finalize (obj); +} + +static void +gst_two_lame_class_init (GstTwoLameClass * klass) +{ + GObjectClass *gobject_class; + GstAudioEncoderClass *gstbase_class; + + gobject_class = (GObjectClass *) klass; + gstbase_class = (GstAudioEncoderClass *) klass; + + gobject_class->set_property = gst_two_lame_set_property; + gobject_class->get_property = gst_two_lame_get_property; + gobject_class->finalize = gst_two_lame_finalize; + + gstbase_class->start = GST_DEBUG_FUNCPTR (gst_two_lame_start); + gstbase_class->stop = GST_DEBUG_FUNCPTR (gst_two_lame_stop); + gstbase_class->set_format = GST_DEBUG_FUNCPTR (gst_two_lame_set_format); + gstbase_class->handle_frame = GST_DEBUG_FUNCPTR (gst_two_lame_handle_frame); + gstbase_class->flush = GST_DEBUG_FUNCPTR (gst_two_lame_flush); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODE, + g_param_spec_enum ("mode", "Mode", "Encoding mode", + GST_TYPE_TWO_LAME_MODE, gst_two_lame_default_settings.mode, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PSYMODEL, + g_param_spec_int ("psymodel", "Psychoacoustic Model", + "Psychoacoustic model used to encode the audio", + -1, 4, gst_two_lame_default_settings.psymodel, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, + g_param_spec_int ("bitrate", "Bitrate (kb/s)", + "Bitrate in kbit/sec (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, " + "112, 128, 144, 160, 192, 224, 256, 320, 384)", + 8, 384, gst_two_lame_default_settings.bitrate, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PADDING, + g_param_spec_enum ("padding", "Padding", "Padding type", + GST_TYPE_TWO_LAME_PADDING, gst_two_lame_default_settings.padding, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), + ARG_ENERGY_LEVEL_EXTENSION, + g_param_spec_boolean ("energy-level-extension", "Energy Level Extension", + "Write peak PCM level to each frame", + gst_two_lame_default_settings.energy_level_extension, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EMPHASIS, + g_param_spec_enum ("emphasis", "Emphasis", + "Pre-emphasis to apply to the decoded audio", + GST_TYPE_TWO_LAME_EMPHASIS, gst_two_lame_default_settings.emphasis, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ERROR_PROTECTION, + g_param_spec_boolean ("error-protection", "Error protection", + "Adds checksum to every frame", + gst_two_lame_default_settings.error_protection, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COPYRIGHT, + g_param_spec_boolean ("copyright", "Copyright", "Mark as copyright", + gst_two_lame_default_settings.copyright, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ORIGINAL, + g_param_spec_boolean ("original", "Original", "Mark as original", + gst_two_lame_default_settings.original, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR, + g_param_spec_boolean ("vbr", "VBR", "Enable variable bitrate mode", + gst_two_lame_default_settings.vbr, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_LEVEL, + g_param_spec_float ("vbr-level", "VBR Level", "VBR Level", + -10.0, 10.0, gst_two_lame_default_settings.vbr_level, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ATH_LEVEL, + g_param_spec_float ("ath-level", "ATH Level", "ATH Level in dB", + -G_MAXFLOAT, G_MAXFLOAT, gst_two_lame_default_settings.ath_level, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_MAX_BITRATE, + g_param_spec_int ("vbr-max-bitrate", "VBR max bitrate", + "Specify maximum VBR bitrate (0=off, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, " + "112, 128, 144, 160, 192, 224, 256, 320, 384)", + 0, 384, gst_two_lame_default_settings.vbr_max_bitrate, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUICK_MODE, + g_param_spec_boolean ("quick-mode", "Quick mode", + "Calculate Psymodel every frames", + gst_two_lame_default_settings.quick_mode, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUICK_MODE_COUNT, + g_param_spec_int ("quick-mode-count", "Quick mode count", + "Calculate Psymodel every n frames", + 0, G_MAXINT, gst_two_lame_default_settings.quick_mode_count, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), + gst_static_pad_template_get (&gst_two_lame_src_template)); + gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), + gst_static_pad_template_get (&gst_two_lame_sink_template)); + + gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass), + "TwoLAME mp2 encoder", "Codec/Encoder/Audio", + "High-quality free MP2 encoder", + "Sebastian Dröge <sebastian.droege@collabora.co.uk>"); +} + +static gboolean +gst_two_lame_set_format (GstAudioEncoder * enc, GstAudioInfo * info) +{ + GstTwoLame *twolame; + gint out_samplerate; + gint version; + GstCaps *othercaps; + + twolame = GST_TWO_LAME (enc); + + /* parameters already parsed for us */ + twolame->samplerate = GST_AUDIO_INFO_RATE (info); + twolame->num_channels = GST_AUDIO_INFO_CHANNELS (info); + twolame->float_input = !GST_AUDIO_INFO_IS_INTEGER (info); + + /* but we might be asked to reconfigure, so reset */ + gst_two_lame_release_memory (twolame); + + GST_DEBUG_OBJECT (twolame, "setting up twolame"); + if (!gst_two_lame_setup (twolame)) + goto setup_failed; + + out_samplerate = twolame_get_out_samplerate (twolame->glopts); + if (out_samplerate == 0) + goto zero_output_rate; + + if (out_samplerate != twolame->samplerate) { + GST_WARNING_OBJECT (twolame, + "output samplerate %d is different from incoming samplerate %d", + out_samplerate, twolame->samplerate); + } + + version = twolame_get_version (twolame->glopts); + if (version == TWOLAME_MPEG2) + version = 2; + else + version = 1; + + othercaps = + gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "mpegaudioversion", G_TYPE_INT, version, + "layer", G_TYPE_INT, 2, + "channels", G_TYPE_INT, + twolame->mode == TWOLAME_MONO ? 1 : twolame->num_channels, "rate", + G_TYPE_INT, out_samplerate, NULL); + + /* and use these caps */ + gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (twolame), othercaps); + gst_caps_unref (othercaps); + + /* report needs to base class: + * hand one frame at a time, if we are pretty sure what a frame is */ + if (out_samplerate == twolame->samplerate) { + gst_audio_encoder_set_frame_samples_min (enc, 1152); + gst_audio_encoder_set_frame_samples_max (enc, 1152); + gst_audio_encoder_set_frame_max (enc, 1); + } + + return TRUE; + +zero_output_rate: + { + GST_ELEMENT_ERROR (twolame, LIBRARY, SETTINGS, (NULL), + ("TwoLAME decided on a zero sample rate")); + return FALSE; + } +setup_failed: + { + GST_ELEMENT_ERROR (twolame, LIBRARY, SETTINGS, + (_("Failed to configure TwoLAME encoder. Check your encoding parameters.")), (NULL)); + return FALSE; + } +} + +static void +gst_two_lame_init (GstTwoLame * twolame) +{ + GST_DEBUG_OBJECT (twolame, "starting initialization"); + + twolame->mode = gst_two_lame_default_settings.mode; + twolame->psymodel = gst_two_lame_default_settings.psymodel; + twolame->bitrate = gst_two_lame_default_settings.bitrate; + twolame->padding = gst_two_lame_default_settings.padding; + twolame->energy_level_extension = + gst_two_lame_default_settings.energy_level_extension; + twolame->emphasis = gst_two_lame_default_settings.emphasis; + twolame->error_protection = gst_two_lame_default_settings.error_protection; + twolame->copyright = gst_two_lame_default_settings.copyright; + twolame->original = gst_two_lame_default_settings.original; + twolame->vbr = gst_two_lame_default_settings.vbr; + twolame->vbr_level = gst_two_lame_default_settings.vbr_level; + twolame->ath_level = gst_two_lame_default_settings.ath_level; + twolame->vbr_max_bitrate = gst_two_lame_default_settings.vbr_max_bitrate; + twolame->quick_mode = gst_two_lame_default_settings.quick_mode; + twolame->quick_mode_count = gst_two_lame_default_settings.quick_mode_count; + + GST_DEBUG_OBJECT (twolame, "done initializing"); +} + +static gboolean +gst_two_lame_start (GstAudioEncoder * enc) +{ + GstTwoLame *twolame = GST_TWO_LAME (enc); + + GST_DEBUG_OBJECT (twolame, "start"); + return TRUE; +} + +static gboolean +gst_two_lame_stop (GstAudioEncoder * enc) +{ + GstTwoLame *twolame = GST_TWO_LAME (enc); + + GST_DEBUG_OBJECT (twolame, "stop"); + + gst_two_lame_release_memory (twolame); + return TRUE; +} + +/* <php-emulation-mode>three underscores for ___rate is really really really + * private as opposed to one underscore<php-emulation-mode> */ +/* call this MACRO outside of the NULL state so that we have a higher chance + * of actually having a pipeline and bus to get the message through */ + +#define CHECK_AND_FIXUP_BITRATE(obj,param,rate) \ +G_STMT_START { \ + gint ___rate = rate; \ + gint maxrate = 320; \ + gint multiplier = 64; \ + if (rate <= 64) { \ + maxrate = 64; multiplier = 8; \ + if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \ + } else if (rate <= 144) { \ + maxrate = 144; multiplier = 16; \ + if ((rate % 16) != 0) ___rate = GST_ROUND_UP_16 (rate); \ + } else if (rate <= 256) { \ + maxrate = 256; multiplier = 32; \ + if ((rate % 32) != 0) ___rate = GST_ROUND_UP_32 (rate); \ + } else if (rate <= 384) { \ + maxrate = 384; multiplier = 64; \ + if ((rate % 64) != 0) ___rate = GST_ROUND_UP_64 (rate); \ + } \ + if (___rate != rate) { \ + GST_ELEMENT_WARNING (obj, LIBRARY, SETTINGS, \ + (_("The requested bitrate %d kbit/s for property '%s' " \ + "is not allowed. " \ + "The bitrate was changed to %d kbit/s."), rate, \ + param, ___rate), \ + ("A bitrate below %d should be a multiple of %d.", \ + maxrate, multiplier)); \ + rate = ___rate; \ + } \ +} G_STMT_END + +static void +gst_two_lame_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstTwoLame *twolame = GST_TWO_LAME (object); + + switch (prop_id) { + case ARG_MODE: + twolame->mode = g_value_get_enum (value); + break; + case ARG_PSYMODEL: + twolame->psymodel = g_value_get_int (value); + break; + case ARG_BITRATE: + twolame->bitrate = g_value_get_int (value); + break; + case ARG_PADDING: + twolame->padding = g_value_get_enum (value); + break; + case ARG_ENERGY_LEVEL_EXTENSION: + twolame->energy_level_extension = g_value_get_boolean (value); + break; + case ARG_EMPHASIS: + twolame->emphasis = g_value_get_enum (value); + break; + case ARG_ERROR_PROTECTION: + twolame->error_protection = g_value_get_boolean (value); + break; + case ARG_COPYRIGHT: + twolame->copyright = g_value_get_boolean (value); + break; + case ARG_ORIGINAL: + twolame->original = g_value_get_boolean (value); + break; + case ARG_VBR: + twolame->vbr = g_value_get_boolean (value); + break; + case ARG_VBR_LEVEL: + twolame->vbr_level = g_value_get_float (value); + break; + case ARG_ATH_LEVEL: + twolame->ath_level = g_value_get_float (value); + break; + case ARG_VBR_MAX_BITRATE: + twolame->vbr_max_bitrate = g_value_get_int (value); + break; + case ARG_QUICK_MODE: + twolame->quick_mode = g_value_get_boolean (value); + break; + case ARG_QUICK_MODE_COUNT: + twolame->quick_mode_count = g_value_get_int (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_two_lame_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstTwoLame *twolame = GST_TWO_LAME (object); + + switch (prop_id) { + case ARG_MODE: + g_value_set_enum (value, twolame->mode); + break; + case ARG_PSYMODEL: + g_value_set_int (value, twolame->psymodel); + break; + case ARG_BITRATE: + g_value_set_int (value, twolame->bitrate); + break; + case ARG_PADDING: + g_value_set_enum (value, twolame->padding); + break; + case ARG_ENERGY_LEVEL_EXTENSION: + g_value_set_boolean (value, twolame->energy_level_extension); + break; + case ARG_EMPHASIS: + g_value_set_enum (value, twolame->emphasis); + break; + case ARG_ERROR_PROTECTION: + g_value_set_boolean (value, twolame->error_protection); + break; + case ARG_COPYRIGHT: + g_value_set_boolean (value, twolame->copyright); + break; + case ARG_ORIGINAL: + g_value_set_boolean (value, twolame->original); + break; + case ARG_VBR: + g_value_set_boolean (value, twolame->vbr); + break; + case ARG_VBR_LEVEL: + g_value_set_float (value, twolame->vbr_level); + break; + case ARG_ATH_LEVEL: + g_value_set_float (value, twolame->ath_level); + break; + case ARG_VBR_MAX_BITRATE: + g_value_set_int (value, twolame->vbr_max_bitrate); + break; + case ARG_QUICK_MODE: + g_value_set_boolean (value, twolame->quick_mode); + break; + case ARG_QUICK_MODE_COUNT: + g_value_set_int (value, twolame->quick_mode_count); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstFlowReturn +gst_two_lame_flush_full (GstTwoLame * lame, gboolean push) +{ + GstBuffer *buf; + GstMapInfo map; + gint size; + GstFlowReturn result = GST_FLOW_OK; + + if (!lame->glopts) + return GST_FLOW_OK; + + buf = gst_buffer_new_and_alloc (16384); + gst_buffer_map (buf, &map, GST_MAP_WRITE); + size = twolame_encode_flush (lame->glopts, map.data, 16384); + gst_buffer_unmap (buf, &map); + + if (size > 0 && push) { + gst_buffer_set_size (buf, size); + GST_DEBUG_OBJECT (lame, "pushing final packet of %u bytes", size); + result = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (lame), buf, -1); + } else { + GST_DEBUG_OBJECT (lame, "no final packet (size=%d, push=%d)", size, push); + gst_buffer_unref (buf); + result = GST_FLOW_OK; + } + return result; +} + +static void +gst_two_lame_flush (GstAudioEncoder * enc) +{ + gst_two_lame_flush_full (GST_TWO_LAME (enc), FALSE); +} + +static GstFlowReturn +gst_two_lame_handle_frame (GstAudioEncoder * enc, GstBuffer * buf) +{ + GstTwoLame *twolame; + gint mp3_buffer_size, mp3_size; + GstBuffer *mp3_buf; + GstFlowReturn result; + gint num_samples; + GstMapInfo map, mp3_map; + + twolame = GST_TWO_LAME (enc); + + /* squeeze remaining and push */ + if (G_UNLIKELY (buf == NULL)) + return gst_two_lame_flush_full (twolame, TRUE); + + gst_buffer_map (buf, &map, GST_MAP_READ); + + if (twolame->float_input) + num_samples = map.size / 4; + else + num_samples = map.size / 2; + + /* allocate space for output */ + mp3_buffer_size = 1.25 * num_samples + 16384; + mp3_buf = gst_buffer_new_and_alloc (mp3_buffer_size); + gst_buffer_map (mp3_buf, &mp3_map, GST_MAP_WRITE); + + if (twolame->num_channels == 1) { + if (twolame->float_input) + mp3_size = twolame_encode_buffer_float32 (twolame->glopts, + (float *) map.data, + (float *) map.data, num_samples, mp3_map.data, mp3_buffer_size); + else + mp3_size = twolame_encode_buffer (twolame->glopts, + (short int *) map.data, + (short int *) map.data, num_samples, mp3_map.data, mp3_buffer_size); + } else { + if (twolame->float_input) + mp3_size = twolame_encode_buffer_float32_interleaved (twolame->glopts, + (float *) map.data, + num_samples / twolame->num_channels, mp3_map.data, mp3_buffer_size); + else + mp3_size = twolame_encode_buffer_interleaved (twolame->glopts, + (short int *) map.data, + num_samples / twolame->num_channels, mp3_map.data, mp3_buffer_size); + } + + GST_LOG_OBJECT (twolame, "encoded %" G_GSIZE_FORMAT " bytes of audio " + "to %d bytes of mp3", map.size, mp3_size); + + gst_buffer_unmap (buf, &map); + gst_buffer_unmap (mp3_buf, &mp3_map); + + if (mp3_size > 0) { + gst_buffer_set_size (mp3_buf, mp3_size); + result = gst_audio_encoder_finish_frame (enc, mp3_buf, -1); + } else { + if (mp3_size < 0) { + /* eat error ? */ + g_warning ("error %d", mp3_size); + } + gst_buffer_unref (mp3_buf); + result = GST_FLOW_OK; + } + + return result; +} + +/* set up the encoder state */ +static gboolean +gst_two_lame_setup (GstTwoLame * twolame) +{ + +#define CHECK_ERROR(command) G_STMT_START {\ + if ((command) < 0) { \ + GST_ERROR_OBJECT (twolame, "setup failed: " G_STRINGIFY (command)); \ + return FALSE; \ + } \ +}G_STMT_END + + int retval; + GstCaps *allowed_caps; + + GST_DEBUG_OBJECT (twolame, "starting setup"); + + /* check if we're already setup; if we are, we might want to check + * if this initialization is compatible with the previous one */ + /* FIXME: do this */ + if (twolame->setup) { + GST_WARNING_OBJECT (twolame, "already setup"); + twolame->setup = FALSE; + } + + twolame->glopts = twolame_init (); + + if (twolame->glopts == NULL) + return FALSE; + + /* copy the parameters over */ + twolame_set_in_samplerate (twolame->glopts, twolame->samplerate); + + /* let twolame choose default samplerate unless outgoing sample rate is fixed */ + allowed_caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (twolame)); + + if (allowed_caps != NULL) { + GstStructure *structure; + gint samplerate; + + structure = gst_caps_get_structure (allowed_caps, 0); + + if (gst_structure_get_int (structure, "rate", &samplerate)) { + GST_DEBUG_OBJECT (twolame, + "Setting sample rate to %d as fixed in src caps", samplerate); + twolame_set_out_samplerate (twolame->glopts, samplerate); + } else { + GST_DEBUG_OBJECT (twolame, "Letting twolame choose sample rate"); + twolame_set_out_samplerate (twolame->glopts, 0); + } + gst_caps_unref (allowed_caps); + allowed_caps = NULL; + } else { + GST_DEBUG_OBJECT (twolame, + "No peer yet, letting twolame choose sample rate"); + twolame_set_out_samplerate (twolame->glopts, 0); + } + + /* force mono encoding if we only have one channel */ + if (twolame->num_channels == 1) + twolame->mode = 3; + + /* Fix bitrates and MPEG version */ + + CHECK_ERROR (twolame_set_num_channels (twolame->glopts, + twolame->num_channels)); + + CHECK_ERROR (twolame_set_mode (twolame->glopts, twolame->mode)); + CHECK_ERROR (twolame_set_psymodel (twolame->glopts, twolame->psymodel)); + CHECK_AND_FIXUP_BITRATE (twolame, "bitrate", twolame->bitrate); + CHECK_ERROR (twolame_set_bitrate (twolame->glopts, twolame->bitrate)); + CHECK_ERROR (twolame_set_padding (twolame->glopts, twolame->padding)); + CHECK_ERROR (twolame_set_energy_levels (twolame->glopts, + twolame->energy_level_extension)); + CHECK_ERROR (twolame_set_emphasis (twolame->glopts, twolame->emphasis)); + CHECK_ERROR (twolame_set_error_protection (twolame->glopts, + twolame->error_protection)); + CHECK_ERROR (twolame_set_copyright (twolame->glopts, twolame->copyright)); + CHECK_ERROR (twolame_set_original (twolame->glopts, twolame->original)); + CHECK_ERROR (twolame_set_VBR (twolame->glopts, twolame->vbr)); + CHECK_ERROR (twolame_set_VBR_level (twolame->glopts, twolame->vbr_level)); + CHECK_ERROR (twolame_set_ATH_level (twolame->glopts, twolame->ath_level)); + CHECK_AND_FIXUP_BITRATE (twolame, "vbr-max-bitrate", + twolame->vbr_max_bitrate); + CHECK_ERROR (twolame_set_VBR_max_bitrate_kbps (twolame->glopts, + twolame->vbr_max_bitrate)); + CHECK_ERROR (twolame_set_quick_mode (twolame->glopts, twolame->quick_mode)); + CHECK_ERROR (twolame_set_quick_count (twolame->glopts, + twolame->quick_mode_count)); + + /* initialize the twolame encoder */ + if ((retval = twolame_init_params (twolame->glopts)) >= 0) { + twolame->setup = TRUE; + /* FIXME: it would be nice to print out the mode here */ + GST_INFO ("twolame encoder setup (%d kbit/s, %d Hz, %d channels)", + twolame->bitrate, twolame->samplerate, twolame->num_channels); + } else { + GST_ERROR_OBJECT (twolame, "twolame_init_params returned %d", retval); + } + + GST_DEBUG_OBJECT (twolame, "done with setup"); + + return twolame->setup; +#undef CHECK_ERROR +} + +static gboolean +gst_two_lame_get_default_settings (void) +{ + twolame_options *glopts = NULL; + + glopts = twolame_init (); + if (glopts == NULL) { + GST_ERROR ("Couldn't initialize TwoLAME"); + return FALSE; + } + + twolame_set_num_channels (glopts, 2); + twolame_set_in_samplerate (glopts, 44100); + + if (twolame_init_params (glopts) != 0) { + GST_ERROR ("Couldn't set default parameters"); + return FALSE; + } + + gst_two_lame_default_settings.mode = TWOLAME_JOINT_STEREO; /* twolame_get_mode (glopts); */ + gst_two_lame_default_settings.psymodel = twolame_get_psymodel (glopts); + gst_two_lame_default_settings.bitrate = twolame_get_bitrate (glopts); + gst_two_lame_default_settings.padding = twolame_get_padding (glopts); + gst_two_lame_default_settings.energy_level_extension = + twolame_get_energy_levels (glopts); + gst_two_lame_default_settings.emphasis = twolame_get_emphasis (glopts); + gst_two_lame_default_settings.error_protection = + twolame_get_error_protection (glopts); + gst_two_lame_default_settings.copyright = twolame_get_copyright (glopts); + gst_two_lame_default_settings.original = twolame_get_original (glopts); + gst_two_lame_default_settings.vbr = twolame_get_VBR (glopts); + gst_two_lame_default_settings.vbr_level = twolame_get_VBR_level (glopts); + gst_two_lame_default_settings.ath_level = twolame_get_ATH_level (glopts); + gst_two_lame_default_settings.vbr_max_bitrate = + twolame_get_VBR_max_bitrate_kbps (glopts); + gst_two_lame_default_settings.quick_mode = twolame_get_quick_mode (glopts); + gst_two_lame_default_settings.quick_mode_count = + twolame_get_quick_count (glopts); + + twolame_close (&glopts); + + return TRUE; +} + +static gboolean +plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (debug, "twolame", 0, "twolame mp2 encoder"); + + if (!gst_two_lame_get_default_settings ()) + return FALSE; + +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + + if (!gst_element_register (plugin, "twolamemp2enc", GST_RANK_PRIMARY, + GST_TYPE_TWO_LAME)) + return FALSE; + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + twolame, + "Encode MP2s with TwoLAME", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/ext/twolame/gsttwolamemp2enc.h b/ext/twolame/gsttwolamemp2enc.h new file mode 100644 index 0000000..72a6bea --- /dev/null +++ b/ext/twolame/gsttwolamemp2enc.h @@ -0,0 +1,88 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef __GST_TWO_LAME_H__ +#define __GST_TWO_LAME_H__ + + +#include <gst/gst.h> +#include <gst/audio/gstaudioencoder.h> + +G_BEGIN_DECLS + +#include <twolame.h> + +#define GST_TYPE_TWO_LAME \ + (gst_two_lame_get_type()) +#define GST_TWO_LAME(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TWO_LAME,GstTwoLame)) +#define GST_TWO_LAME_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TWO_LAME,GstTwoLameClass)) +#define GST_IS_TWO_LAME(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TWO_LAME)) +#define GST_IS_TWO_LAME_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TWO_LAME)) + +typedef struct _GstTwoLame GstTwoLame; +typedef struct _GstTwoLameClass GstTwoLameClass; + +/** + * GstTwoLame: + * + * Opaque data structure. + */ +struct _GstTwoLame { + GstAudioEncoder element; + + gint samplerate; + gint num_channels; + gboolean float_input; + gboolean setup; + + gint mode; + gint psymodel; + gint bitrate; + gint padding; + gboolean energy_level_extension; + gint emphasis; + gboolean error_protection; + gboolean copyright; + gboolean original; + gboolean vbr; + gfloat vbr_level; + gfloat ath_level; + gint vbr_max_bitrate; + gboolean quick_mode; + gint quick_mode_count; + + twolame_options *glopts; +}; + +struct _GstTwoLameClass { + GstAudioEncoderClass parent_class; +}; + +GType gst_two_lame_get_type(void); + +G_END_DECLS + + +#endif /* __GST_TWO_LAME_H__ */ |