diff options
Diffstat (limited to 'ext/lame')
-rw-r--r-- | ext/lame/Makefile.am | 11 | ||||
-rw-r--r-- | ext/lame/Makefile.in | 839 | ||||
-rw-r--r-- | ext/lame/gstlamemp3enc.c | 933 | ||||
-rw-r--r-- | ext/lame/gstlamemp3enc.h | 83 | ||||
-rw-r--r-- | ext/lame/plugin.c | 44 |
5 files changed, 1910 insertions, 0 deletions
diff --git a/ext/lame/Makefile.am b/ext/lame/Makefile.am new file mode 100644 index 0000000..c7124dd --- /dev/null +++ b/ext/lame/Makefile.am @@ -0,0 +1,11 @@ +plugin_LTLIBRARIES = libgstlame.la + +libgstlame_la_SOURCES = gstlamemp3enc.c plugin.c +libgstlame_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LAME_CFLAGS) +libgstlame_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \ + $(GST_BASE_LIBS) $(GST_LIBS) $(LAME_LIBS) +libgstlame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstlame_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) + +noinst_HEADERS = gstlamemp3enc.h diff --git a/ext/lame/Makefile.in b/ext/lame/Makefile.in new file mode 100644 index 0000000..6689dc6 --- /dev/null +++ b/ext/lame/Makefile.in @@ -0,0 +1,839 @@ +# 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/lame +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 = +libgstlame_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libgstlame_la_OBJECTS = libgstlame_la-gstlamemp3enc.lo \ + libgstlame_la-plugin.lo +libgstlame_la_OBJECTS = $(am_libgstlame_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 = +libgstlame_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(libgstlame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(libgstlame_la_CFLAGS) $(CFLAGS) \ + $(libgstlame_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 = $(libgstlame_la_SOURCES) +DIST_SOURCES = $(libgstlame_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 = libgstlame.la +libgstlame_la_SOURCES = gstlamemp3enc.c plugin.c +libgstlame_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LAME_CFLAGS) + +libgstlame_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \ + $(GST_BASE_LIBS) $(GST_LIBS) $(LAME_LIBS) + +libgstlame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstlame_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) +noinst_HEADERS = gstlamemp3enc.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/lame/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu ext/lame/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}; \ + } + +libgstlame.la: $(libgstlame_la_OBJECTS) $(libgstlame_la_DEPENDENCIES) $(EXTRA_libgstlame_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgstlame_la_LINK) -rpath $(plugindir) $(libgstlame_la_OBJECTS) $(libgstlame_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlame_la-gstlamemp3enc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlame_la-plugin.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 $@ $< + +libgstlame_la-gstlamemp3enc.lo: gstlamemp3enc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlame_la_CFLAGS) $(CFLAGS) -MT libgstlame_la-gstlamemp3enc.lo -MD -MP -MF $(DEPDIR)/libgstlame_la-gstlamemp3enc.Tpo -c -o libgstlame_la-gstlamemp3enc.lo `test -f 'gstlamemp3enc.c' || echo '$(srcdir)/'`gstlamemp3enc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlame_la-gstlamemp3enc.Tpo $(DEPDIR)/libgstlame_la-gstlamemp3enc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstlamemp3enc.c' object='libgstlame_la-gstlamemp3enc.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 $(libgstlame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlame_la_CFLAGS) $(CFLAGS) -c -o libgstlame_la-gstlamemp3enc.lo `test -f 'gstlamemp3enc.c' || echo '$(srcdir)/'`gstlamemp3enc.c + +libgstlame_la-plugin.lo: plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlame_la_CFLAGS) $(CFLAGS) -MT libgstlame_la-plugin.lo -MD -MP -MF $(DEPDIR)/libgstlame_la-plugin.Tpo -c -o libgstlame_la-plugin.lo `test -f 'plugin.c' || echo '$(srcdir)/'`plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlame_la-plugin.Tpo $(DEPDIR)/libgstlame_la-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='plugin.c' object='libgstlame_la-plugin.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 $(libgstlame_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlame_la_CFLAGS) $(CFLAGS) -c -o libgstlame_la-plugin.lo `test -f 'plugin.c' || echo '$(srcdir)/'`plugin.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/lame/gstlamemp3enc.c b/ext/lame/gstlamemp3enc.c new file mode 100644 index 0000000..ee528be --- /dev/null +++ b/ext/lame/gstlamemp3enc.c @@ -0,0 +1,933 @@ +/* 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) <2009> 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. + */ + +/** + * SECTION:element-lamemp3enc + * @see_also: lame, mad, vorbisenc + * + * This element encodes raw integer audio into an MPEG-1 layer 3 (MP3) stream. + * Note that <ulink url="http://en.wikipedia.org/wiki/MP3">MP3</ulink> is not + * a free format, there are licensing and patent issues to take into + * consideration. See <ulink url="http://www.vorbis.com/">Ogg/Vorbis</ulink> + * for a royalty free (and often higher quality) alternative. + * + * <refsect2> + * <title>Output sample rate</title> + * If no fixed output sample rate is negotiated on the element's src pad, + * the element will choose an optimal sample rate to resample to internally. + * For example, a 16-bit 44.1 KHz mono audio stream encoded at 48 kbit will + * get resampled to 32 KHz. Use filter caps on the src pad to force a + * particular sample rate. + * </refsect2> + * <refsect2> + * <title>Example pipelines</title> + * |[ + * gst-launch -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! lamemp3enc ! filesink location=sine.mp3 + * ]| Encode a test sine signal to MP3. + * |[ + * gst-launch -v alsasrc ! audioconvert ! lamemp3enc target=bitrate bitrate=192 ! filesink location=alsasrc.mp3 + * ]| Record from a sound card using ALSA and encode to MP3 with an average bitrate of 192kbps + * |[ + * gst-launch -v filesrc location=music.wav ! decodebin ! audioconvert ! audioresample ! lamemp3enc target=quality quality=0 ! id3v2mux ! filesink location=music.mp3 + * ]| Transcode from a .wav file to MP3 (the id3v2mux element is optional) with best VBR quality + * |[ + * gst-launch -v cdda://5 ! audioconvert ! lamemp3enc target=bitrate cbr=true bitrate=192 ! filesink location=track5.mp3 + * ]| Encode Audio CD track 5 to MP3 with a constant bitrate of 192kbps + * |[ + * gst-launch -v audiotestsrc num-buffers=10 ! audio/x-raw,rate=44100,channels=1 ! lamemp3enc target=bitrate cbr=true bitrate=48 ! filesink location=test.mp3 + * ]| Encode to a fixed sample rate + * </refsect2> + * + * Since: 0.10.12 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <string.h> +#include "gstlamemp3enc.h" +#include <gst/gst-i18n-plugin.h> + +/* lame < 3.98 */ +#ifndef HAVE_LAME_SET_VBR_QUALITY +#define lame_set_VBR_quality(flags,q) lame_set_VBR_q((flags),(int)(q)) +#endif + +GST_DEBUG_CATEGORY_STATIC (debug); +#define GST_CAT_DEFAULT debug + +/* elementfactory information */ + +/* LAMEMP3ENC can do MPEG-1, MPEG-2, and MPEG-2.5, so it has 9 possible + * sample rates it supports */ +static GstStaticPadTemplate gst_lamemp3enc_sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw, " + "format = (string) " GST_AUDIO_NE (S16) ", " + "layout = (string) interleaved, " + "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) 1; " + "audio/x-raw, " + "format = (string) " GST_AUDIO_NE (S16) ", " + "layout = (string) interleaved, " + "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) 2, " "channel-mask = (bitmask) 0x3") + ); + +static GstStaticPadTemplate gst_lamemp3enc_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) 3, " + "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) [ 1, 2 ]") + ); + +/********** Define useful types for non-programmatic interfaces **********/ +enum +{ + LAMEMP3ENC_TARGET_QUALITY = 0, + LAMEMP3ENC_TARGET_BITRATE +}; + +#define GST_TYPE_LAMEMP3ENC_TARGET (gst_lamemp3enc_target_get_type()) +static GType +gst_lamemp3enc_target_get_type (void) +{ + static GType lame_target_type = 0; + static GEnumValue lame_targets[] = { + {LAMEMP3ENC_TARGET_QUALITY, "Quality", "quality"}, + {LAMEMP3ENC_TARGET_BITRATE, "Bitrate", "bitrate"}, + {0, NULL, NULL} + }; + + if (!lame_target_type) { + lame_target_type = + g_enum_register_static ("GstLameMP3EncTarget", lame_targets); + } + return lame_target_type; +} + +enum +{ + LAMEMP3ENC_ENCODING_ENGINE_QUALITY_FAST = 0, + LAMEMP3ENC_ENCODING_ENGINE_QUALITY_STANDARD, + LAMEMP3ENC_ENCODING_ENGINE_QUALITY_HIGH +}; + +#define GST_TYPE_LAMEMP3ENC_ENCODING_ENGINE_QUALITY (gst_lamemp3enc_encoding_engine_quality_get_type()) +static GType +gst_lamemp3enc_encoding_engine_quality_get_type (void) +{ + static GType lame_encoding_engine_quality_type = 0; + static GEnumValue lame_encoding_engine_quality[] = { + {0, "Fast", "fast"}, + {1, "Standard", "standard"}, + {2, "High", "high"}, + {0, NULL, NULL} + }; + + if (!lame_encoding_engine_quality_type) { + lame_encoding_engine_quality_type = + g_enum_register_static ("GstLameMP3EncEncodingEngineQuality", + lame_encoding_engine_quality); + } + return lame_encoding_engine_quality_type; +} + +/********** Standard stuff for signals and arguments **********/ + +enum +{ + ARG_0, + ARG_TARGET, + ARG_BITRATE, + ARG_CBR, + ARG_QUALITY, + ARG_ENCODING_ENGINE_QUALITY, + ARG_MONO +}; + +#define DEFAULT_TARGET LAMEMP3ENC_TARGET_QUALITY +#define DEFAULT_BITRATE 128 +#define DEFAULT_CBR FALSE +#define DEFAULT_QUALITY 4 +#define DEFAULT_ENCODING_ENGINE_QUALITY LAMEMP3ENC_ENCODING_ENGINE_QUALITY_STANDARD +#define DEFAULT_MONO FALSE + +static gboolean gst_lamemp3enc_start (GstAudioEncoder * enc); +static gboolean gst_lamemp3enc_stop (GstAudioEncoder * enc); +static gboolean gst_lamemp3enc_set_format (GstAudioEncoder * enc, + GstAudioInfo * info); +static GstFlowReturn gst_lamemp3enc_handle_frame (GstAudioEncoder * enc, + GstBuffer * in_buf); +static void gst_lamemp3enc_flush (GstAudioEncoder * enc); + +static void gst_lamemp3enc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_lamemp3enc_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static gboolean gst_lamemp3enc_setup (GstLameMP3Enc * lame, GstTagList ** tags); + +#define gst_lamemp3enc_parent_class parent_class +G_DEFINE_TYPE (GstLameMP3Enc, gst_lamemp3enc, GST_TYPE_AUDIO_ENCODER); + +static void +gst_lamemp3enc_release_memory (GstLameMP3Enc * lame) +{ + if (lame->lgf) { + lame_close (lame->lgf); + lame->lgf = NULL; + } +} + +static void +gst_lamemp3enc_finalize (GObject * obj) +{ + gst_lamemp3enc_release_memory (GST_LAMEMP3ENC (obj)); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static void +gst_lamemp3enc_class_init (GstLameMP3EncClass * klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstAudioEncoderClass *base_class; + + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + base_class = (GstAudioEncoderClass *) klass; + + gobject_class->set_property = gst_lamemp3enc_set_property; + gobject_class->get_property = gst_lamemp3enc_get_property; + gobject_class->finalize = gst_lamemp3enc_finalize; + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_lamemp3enc_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_lamemp3enc_sink_template)); + + gst_element_class_set_static_metadata (gstelement_class, + "L.A.M.E. mp3 encoder", "Codec/Encoder/Audio", + "High-quality free MP3 encoder", + "Sebastian Dröge <sebastian.droege@collabora.co.uk>"); + + base_class->start = GST_DEBUG_FUNCPTR (gst_lamemp3enc_start); + base_class->stop = GST_DEBUG_FUNCPTR (gst_lamemp3enc_stop); + base_class->set_format = GST_DEBUG_FUNCPTR (gst_lamemp3enc_set_format); + base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_lamemp3enc_handle_frame); + base_class->flush = GST_DEBUG_FUNCPTR (gst_lamemp3enc_flush); + + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TARGET, + g_param_spec_enum ("target", "Target", + "Optimize for quality or bitrate", GST_TYPE_LAMEMP3ENC_TARGET, + DEFAULT_TARGET, + G_PARAM_CONSTRUCT | 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 (Only valid if target is bitrate, for CBR one " + "of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, " + "256 or 320)", 8, 320, DEFAULT_BITRATE, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CBR, + g_param_spec_boolean ("cbr", "CBR", "Enforce constant bitrate encoding " + "(Only valid if target is bitrate)", DEFAULT_CBR, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, + g_param_spec_float ("quality", "Quality", + "VBR Quality from 0 to 10, 0 being the best " + "(Only valid if target is quality)", 0.0, 9.999, + DEFAULT_QUALITY, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), + ARG_ENCODING_ENGINE_QUALITY, g_param_spec_enum ("encoding-engine-quality", + "Encoding Engine Quality", "Quality/speed of the encoding engine, " + "this does not affect the bitrate!", + GST_TYPE_LAMEMP3ENC_ENCODING_ENGINE_QUALITY, + DEFAULT_ENCODING_ENGINE_QUALITY, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MONO, + g_param_spec_boolean ("mono", "Mono", "Enforce mono encoding", + DEFAULT_MONO, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +static void +gst_lamemp3enc_init (GstLameMP3Enc * lame) +{ +} + +static gboolean +gst_lamemp3enc_start (GstAudioEncoder * enc) +{ + GstLameMP3Enc *lame = GST_LAMEMP3ENC (enc); + + GST_DEBUG_OBJECT (lame, "start"); + + if (!lame->adapter) + lame->adapter = gst_adapter_new (); + gst_adapter_clear (lame->adapter); + + return TRUE; +} + +static gboolean +gst_lamemp3enc_stop (GstAudioEncoder * enc) +{ + GstLameMP3Enc *lame = GST_LAMEMP3ENC (enc); + + GST_DEBUG_OBJECT (lame, "stop"); + + if (lame->adapter) { + g_object_unref (lame->adapter); + lame->adapter = NULL; + } + + gst_lamemp3enc_release_memory (lame); + return TRUE; +} + +static gboolean +gst_lamemp3enc_set_format (GstAudioEncoder * enc, GstAudioInfo * info) +{ + GstLameMP3Enc *lame; + gint out_samplerate; + gint version; + GstCaps *othercaps; + GstClockTime latency; + GstTagList *tags = NULL; + + lame = GST_LAMEMP3ENC (enc); + + /* parameters already parsed for us */ + lame->samplerate = GST_AUDIO_INFO_RATE (info); + lame->num_channels = GST_AUDIO_INFO_CHANNELS (info); + + /* but we might be asked to reconfigure, so reset */ + gst_lamemp3enc_release_memory (lame); + + GST_DEBUG_OBJECT (lame, "setting up lame"); + if (!gst_lamemp3enc_setup (lame, &tags)) + goto setup_failed; + + out_samplerate = lame_get_out_samplerate (lame->lgf); + if (out_samplerate == 0) + goto zero_output_rate; + if (out_samplerate != lame->samplerate) { + GST_WARNING_OBJECT (lame, + "output samplerate %d is different from incoming samplerate %d", + out_samplerate, lame->samplerate); + } + lame->out_samplerate = out_samplerate; + + version = lame_get_version (lame->lgf); + if (version == 0) + version = 2; + else if (version == 1) + version = 1; + else if (version == 2) + version = 3; + + othercaps = + gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "mpegaudioversion", G_TYPE_INT, version, + "layer", G_TYPE_INT, 3, + "channels", G_TYPE_INT, lame->mono ? 1 : lame->num_channels, + "rate", G_TYPE_INT, out_samplerate, NULL); + + /* and use these caps */ + gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (enc), othercaps); + gst_caps_unref (othercaps); + + /* base class feedback: + * - we will handle buffers, just hand us all available + * - report latency */ + latency = gst_util_uint64_scale_int (lame_get_framesize (lame->lgf), + GST_SECOND, lame->samplerate); + gst_audio_encoder_set_latency (enc, latency, latency); + + if (tags) { + gst_audio_encoder_merge_tags (enc, tags, GST_TAG_MERGE_REPLACE); + gst_tag_list_unref (tags); + } + + return TRUE; + +zero_output_rate: + { + if (tags) + gst_tag_list_unref (tags); + GST_ELEMENT_ERROR (lame, LIBRARY, SETTINGS, (NULL), + ("LAME mp3 audio decided on a zero sample rate")); + return FALSE; + } +setup_failed: + { + GST_ELEMENT_ERROR (lame, LIBRARY, SETTINGS, + (_("Failed to configure LAME mp3 audio encoder. Check your encoding parameters.")), (NULL)); + return FALSE; + } +} + +/* <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 == 0) { \ + ___rate = rate; \ + } else if (rate <= 64) { \ + maxrate = 64; multiplier = 8; \ + if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \ + } else if (rate <= 128) { \ + maxrate = 128; 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 <= 320) { \ + maxrate = 320; 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_lamemp3enc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstLameMP3Enc *lame; + + lame = GST_LAMEMP3ENC (object); + + switch (prop_id) { + case ARG_TARGET: + lame->target = g_value_get_enum (value); + break; + case ARG_BITRATE: + lame->bitrate = g_value_get_int (value); + break; + case ARG_CBR: + lame->cbr = g_value_get_boolean (value); + break; + case ARG_QUALITY: + lame->quality = g_value_get_float (value); + break; + case ARG_ENCODING_ENGINE_QUALITY: + lame->encoding_engine_quality = g_value_get_enum (value); + break; + case ARG_MONO: + lame->mono = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_lamemp3enc_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstLameMP3Enc *lame; + + lame = GST_LAMEMP3ENC (object); + + switch (prop_id) { + case ARG_TARGET: + g_value_set_enum (value, lame->target); + break; + case ARG_BITRATE: + g_value_set_int (value, lame->bitrate); + break; + case ARG_CBR: + g_value_set_boolean (value, lame->cbr); + break; + case ARG_QUALITY: + g_value_set_float (value, lame->quality); + break; + case ARG_ENCODING_ENGINE_QUALITY: + g_value_set_enum (value, lame->encoding_engine_quality); + break; + case ARG_MONO: + g_value_set_boolean (value, lame->mono); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/* **** credits go to mpegaudioparse **** */ + +static const guint mp3types_bitrates[2][3][16] = { + { + {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,}, + {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,}, + {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,} + }, + { + {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} + }, +}; + +static const guint mp3types_freqs[3][3] = { {44100, 48000, 32000}, +{22050, 24000, 16000}, +{11025, 12000, 8000} +}; + +static inline guint +mp3_type_frame_length_from_header (GstLameMP3Enc * lame, guint32 header, + guint * put_version, guint * put_layer, guint * put_channels, + guint * put_bitrate, guint * put_samplerate, guint * put_mode, + guint * put_crc) +{ + guint length; + gulong mode, samplerate, bitrate, layer, channels, padding, crc; + gulong version; + gint lsf, mpg25; + + if (header & (1 << 20)) { + lsf = (header & (1 << 19)) ? 0 : 1; + mpg25 = 0; + } else { + lsf = 1; + mpg25 = 1; + } + + version = 1 + lsf + mpg25; + + layer = 4 - ((header >> 17) & 0x3); + + crc = (header >> 16) & 0x1; + + bitrate = (header >> 12) & 0xF; + bitrate = mp3types_bitrates[lsf][layer - 1][bitrate] * 1000; + /* The caller has ensured we have a valid header, so bitrate can't be + zero here. */ + g_assert (bitrate != 0); + + samplerate = (header >> 10) & 0x3; + samplerate = mp3types_freqs[lsf + mpg25][samplerate]; + + padding = (header >> 9) & 0x1; + + mode = (header >> 6) & 0x3; + channels = (mode == 3) ? 1 : 2; + + switch (layer) { + case 1: + length = 4 * ((bitrate * 12) / samplerate + padding); + break; + case 2: + length = (bitrate * 144) / samplerate + padding; + break; + default: + case 3: + length = (bitrate * 144) / (samplerate << lsf) + padding; + break; + } + + GST_DEBUG_OBJECT (lame, "Calculated mp3 frame length of %u bytes", length); + GST_DEBUG_OBJECT (lame, "samplerate = %lu, bitrate = %lu, version = %lu, " + "layer = %lu, channels = %lu", samplerate, bitrate, version, + layer, channels); + + if (put_version) + *put_version = version; + if (put_layer) + *put_layer = layer; + if (put_channels) + *put_channels = channels; + if (put_bitrate) + *put_bitrate = bitrate; + if (put_samplerate) + *put_samplerate = samplerate; + if (put_mode) + *put_mode = mode; + if (put_crc) + *put_crc = crc; + + return length; +} + +static gboolean +mp3_sync_check (GstLameMP3Enc * lame, unsigned long head) +{ + GST_DEBUG_OBJECT (lame, "checking mp3 header 0x%08lx", head); + /* if it's not a valid sync */ + if ((head & 0xffe00000) != 0xffe00000) { + GST_WARNING_OBJECT (lame, "invalid sync"); + return FALSE; + } + /* if it's an invalid MPEG version */ + if (((head >> 19) & 3) == 0x1) { + GST_WARNING_OBJECT (lame, "invalid MPEG version: 0x%lx", (head >> 19) & 3); + return FALSE; + } + /* if it's an invalid layer */ + if (!((head >> 17) & 3)) { + GST_WARNING_OBJECT (lame, "invalid layer: 0x%lx", (head >> 17) & 3); + return FALSE; + } + /* if it's an invalid bitrate */ + if (((head >> 12) & 0xf) == 0x0) { + GST_WARNING_OBJECT (lame, "invalid bitrate: 0x%lx." + "Free format files are not supported yet", (head >> 12) & 0xf); + return FALSE; + } + if (((head >> 12) & 0xf) == 0xf) { + GST_WARNING_OBJECT (lame, "invalid bitrate: 0x%lx", (head >> 12) & 0xf); + return FALSE; + } + /* if it's an invalid samplerate */ + if (((head >> 10) & 0x3) == 0x3) { + GST_WARNING_OBJECT (lame, "invalid samplerate: 0x%lx", (head >> 10) & 0x3); + return FALSE; + } + + if ((head & 0x3) == 0x2) { + /* Ignore this as there are some files with emphasis 0x2 that can + * be played fine. See BGO #537235 */ + GST_WARNING_OBJECT (lame, "invalid emphasis: 0x%lx", head & 0x3); + } + + return TRUE; +} + +/* **** end mpegaudioparse **** */ + +static GstFlowReturn +gst_lamemp3enc_finish_frames (GstLameMP3Enc * lame) +{ + gint av; + guint header; + GstFlowReturn result = GST_FLOW_OK; + + /* limited parsing, we don't expect to lose sync here */ + while ((result == GST_FLOW_OK) && + ((av = gst_adapter_available (lame->adapter)) > 4)) { + guint rate, version, layer, size; + GstBuffer *mp3_buf; + const guint8 *data; + guint samples_per_frame; + + data = gst_adapter_map (lame->adapter, 4); + header = GST_READ_UINT32_BE (data); + gst_adapter_unmap (lame->adapter); + + if (!mp3_sync_check (lame, header)) + goto invalid_header; + + size = mp3_type_frame_length_from_header (lame, header, &version, &layer, + NULL, NULL, &rate, NULL, NULL); + + if (G_UNLIKELY (layer != 3 || rate != lame->out_samplerate)) { + GST_DEBUG_OBJECT (lame, + "unexpected mp3 header with rate %u, version %u, layer %u", + rate, version, layer); + goto invalid_header; + } + + if (size > av) { + /* pretty likely to occur when lame is holding back on us */ + GST_LOG_OBJECT (lame, "frame size %u (> %d)", size, av); + break; + } + + /* Account for the internal resampling, finish frame really wants to + * know about the number of incoming samples + */ + samples_per_frame = (version == 1) ? 1152 : 576; + samples_per_frame *= lame->samplerate; + samples_per_frame /= lame->out_samplerate; + + /* should be ok now */ + mp3_buf = gst_adapter_take_buffer (lame->adapter, size); + /* number of samples for MPEG-1, layer 3 */ + result = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (lame), + mp3_buf, samples_per_frame); + } + +exit: + return result; + + /* ERRORS */ +invalid_header: + { + GST_ELEMENT_ERROR (lame, STREAM, ENCODE, + ("invalid lame mp3 sync header %08X", header), (NULL)); + result = GST_FLOW_ERROR; + goto exit; + } +} + +static GstFlowReturn +gst_lamemp3enc_flush_full (GstLameMP3Enc * lame, gboolean push) +{ + GstBuffer *buf; + GstMapInfo map; + gint size; + GstFlowReturn result = GST_FLOW_OK; + gint av; + + if (!lame->lgf) + return GST_FLOW_OK; + + buf = gst_buffer_new_and_alloc (7200); + gst_buffer_map (buf, &map, GST_MAP_WRITE); + size = lame_encode_flush (lame->lgf, map.data, 7200); + + if (size > 0) { + gst_buffer_unmap (buf, &map); + gst_buffer_resize (buf, 0, size); + GST_DEBUG_OBJECT (lame, "collecting final %d bytes", size); + gst_adapter_push (lame->adapter, buf); + } else { + gst_buffer_unmap (buf, &map); + GST_DEBUG_OBJECT (lame, "no final packet (size=%d, push=%d)", size, push); + gst_buffer_unref (buf); + result = GST_FLOW_OK; + } + + if (push) { + result = gst_lamemp3enc_finish_frames (lame); + } else { + /* never mind */ + gst_adapter_clear (lame->adapter); + } + + /* either way, we expect nothing left */ + if ((av = gst_adapter_available (lame->adapter))) { + /* should this be more fatal ?? */ + GST_WARNING_OBJECT (lame, "unparsed %d bytes left after flushing", av); + /* clean up anyway */ + gst_adapter_clear (lame->adapter); + } + + return result; +} + +static void +gst_lamemp3enc_flush (GstAudioEncoder * enc) +{ + gst_lamemp3enc_flush_full (GST_LAMEMP3ENC (enc), FALSE); +} + +static GstFlowReturn +gst_lamemp3enc_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf) +{ + GstLameMP3Enc *lame; + gint mp3_buffer_size, mp3_size; + GstBuffer *mp3_buf; + GstFlowReturn result; + gint num_samples; + GstMapInfo in_map, mp3_map; + + lame = GST_LAMEMP3ENC (enc); + + /* squeeze remaining and push */ + if (G_UNLIKELY (in_buf == NULL)) + return gst_lamemp3enc_flush_full (lame, TRUE); + + gst_buffer_map (in_buf, &in_map, GST_MAP_READ); + + num_samples = in_map.size / 2; + + /* allocate space for output */ + mp3_buffer_size = 1.25 * num_samples + 7200; + mp3_buf = gst_buffer_new_allocate (NULL, mp3_buffer_size, NULL); + gst_buffer_map (mp3_buf, &mp3_map, GST_MAP_WRITE); + + /* lame seems to be too stupid to get mono interleaved going */ + if (lame->num_channels == 1) { + mp3_size = lame_encode_buffer (lame->lgf, + (short int *) in_map.data, + (short int *) in_map.data, num_samples, mp3_map.data, mp3_buffer_size); + } else { + mp3_size = lame_encode_buffer_interleaved (lame->lgf, + (short int *) in_map.data, + num_samples / lame->num_channels, mp3_map.data, mp3_buffer_size); + } + gst_buffer_unmap (in_buf, &in_map); + + GST_LOG_OBJECT (lame, "encoded %" G_GSIZE_FORMAT " bytes of audio " + "to %d bytes of mp3", in_map.size, mp3_size); + + if (G_LIKELY (mp3_size > 0)) { + /* unfortunately lame does not provide frame delineated output, + * so collect output and parse into frames ... */ + gst_buffer_unmap (mp3_buf, &mp3_map); + gst_buffer_resize (mp3_buf, 0, mp3_size); + gst_adapter_push (lame->adapter, mp3_buf); + result = gst_lamemp3enc_finish_frames (lame); + } else { + gst_buffer_unmap (mp3_buf, &mp3_map); + 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_lamemp3enc_setup (GstLameMP3Enc * lame, GstTagList ** tags) +{ + gboolean res; + +#define CHECK_ERROR(command) G_STMT_START {\ + if ((command) < 0) { \ + GST_ERROR_OBJECT (lame, "setup failed: " G_STRINGIFY (command)); \ + if (*tags) { \ + gst_tag_list_unref (*tags); \ + *tags = NULL; \ + } \ + return FALSE; \ + } \ +}G_STMT_END + + int retval; + GstCaps *allowed_caps; + + GST_DEBUG_OBJECT (lame, "starting setup"); + + lame->lgf = lame_init (); + + if (lame->lgf == NULL) + return FALSE; + + *tags = gst_tag_list_new_empty (); + + /* copy the parameters over */ + lame_set_in_samplerate (lame->lgf, lame->samplerate); + + /* let lame choose default samplerate unless outgoing sample rate is fixed */ + allowed_caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (lame)); + + 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 (lame, "Setting sample rate to %d as fixed in src caps", + samplerate); + lame_set_out_samplerate (lame->lgf, samplerate); + } else { + GST_DEBUG_OBJECT (lame, "Letting lame choose sample rate"); + lame_set_out_samplerate (lame->lgf, 0); + } + gst_caps_unref (allowed_caps); + allowed_caps = NULL; + } else { + GST_DEBUG_OBJECT (lame, "No peer yet, letting lame choose sample rate"); + lame_set_out_samplerate (lame->lgf, 0); + } + + CHECK_ERROR (lame_set_num_channels (lame->lgf, lame->num_channels)); + CHECK_ERROR (lame_set_bWriteVbrTag (lame->lgf, 0)); + + if (lame->target == LAMEMP3ENC_TARGET_QUALITY) { + CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_default)); + CHECK_ERROR (lame_set_VBR_quality (lame->lgf, lame->quality)); + } else { + if (lame->cbr) { + CHECK_AND_FIXUP_BITRATE (lame, "bitrate", lame->bitrate); + CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_off)); + CHECK_ERROR (lame_set_brate (lame->lgf, lame->bitrate)); + } else { + CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_abr)); + CHECK_ERROR (lame_set_VBR_mean_bitrate_kbps (lame->lgf, lame->bitrate)); + } + gst_tag_list_add (*tags, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE, + lame->bitrate * 1000, NULL); + } + + if (lame->encoding_engine_quality == LAMEMP3ENC_ENCODING_ENGINE_QUALITY_FAST) + CHECK_ERROR (lame_set_quality (lame->lgf, 7)); + else if (lame->encoding_engine_quality == + LAMEMP3ENC_ENCODING_ENGINE_QUALITY_HIGH) + CHECK_ERROR (lame_set_quality (lame->lgf, 2)); + /* else default */ + + if (lame->mono) + CHECK_ERROR (lame_set_mode (lame->lgf, MONO)); + + /* initialize the lame encoder */ + if ((retval = lame_init_params (lame->lgf)) >= 0) { + /* FIXME: it would be nice to print out the mode here */ + GST_INFO + ("lame encoder setup (target %s, quality %f, bitrate %d, %d Hz, %d channels)", + (lame->target == LAMEMP3ENC_TARGET_QUALITY) ? "quality" : "bitrate", + lame->quality, lame->bitrate, lame->samplerate, lame->num_channels); + res = TRUE; + } else { + GST_ERROR_OBJECT (lame, "lame_init_params returned %d", retval); + res = FALSE; + } + + GST_DEBUG_OBJECT (lame, "done with setup"); + return res; +#undef CHECK_ERROR +} + +gboolean +gst_lamemp3enc_register (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (debug, "lamemp3enc", 0, "lame mp3 encoder"); + + if (!gst_element_register (plugin, "lamemp3enc", GST_RANK_PRIMARY, + GST_TYPE_LAMEMP3ENC)) + return FALSE; + + return TRUE; +} diff --git a/ext/lame/gstlamemp3enc.h b/ext/lame/gstlamemp3enc.h new file mode 100644 index 0000000..25dbc46 --- /dev/null +++ b/ext/lame/gstlamemp3enc.h @@ -0,0 +1,83 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * Copyright (C) <2009> 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_LAMEMP3ENC_H__ +#define __GST_LAMEMP3ENC_H__ + + +#include <gst/gst.h> +#include <gst/audio/gstaudioencoder.h> +#include <gst/base/gstadapter.h> + +G_BEGIN_DECLS + +#include <lame/lame.h> + +#define GST_TYPE_LAMEMP3ENC \ + (gst_lamemp3enc_get_type()) +#define GST_LAMEMP3ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LAMEMP3ENC,GstLameMP3Enc)) +#define GST_LAMEMP3ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LAMEMP3ENC,GstLameMP3EncClass)) +#define GST_IS_LAMEMP3ENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LAMEMP3ENC)) +#define GST_IS_LAMEMP3ENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LAMEMP3ENC)) + +typedef struct _GstLameMP3Enc GstLameMP3Enc; +typedef struct _GstLameMP3EncClass GstLameMP3EncClass; + +/** + * GstLameMP3Enc: + * + * Opaque data structure. + */ +struct _GstLameMP3Enc { + GstAudioEncoder element; + + /*< private >*/ + gint samplerate; + gint out_samplerate; + gint num_channels; + + /* properties */ + gint target; + gint bitrate; + gboolean cbr; + gfloat quality; + gint encoding_engine_quality; + gboolean mono; + + lame_global_flags *lgf; + + GstAdapter *adapter; +}; + +struct _GstLameMP3EncClass { + GstAudioEncoderClass parent_class; +}; + +GType gst_lamemp3enc_get_type(void); +gboolean gst_lamemp3enc_register (GstPlugin * plugin); + +G_END_DECLS + +#endif /* __GST_LAMEMP3ENC_H__ */ diff --git a/ext/lame/plugin.c b/ext/lame/plugin.c new file mode 100644 index 0000000..6aae21e --- /dev/null +++ b/ext/lame/plugin.c @@ -0,0 +1,44 @@ +/* GStreamer + * Copyright (C) <2009> 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gst/gst.h> +#include <gst/gst-i18n-plugin.h> + +#include "gstlamemp3enc.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + + return gst_lamemp3enc_register (plugin); +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + lame, + "Encode MP3s with LAME", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); |