From 2dd1aeb937bf1bb9a30ed830b0d90f6134afa21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 18 Feb 2015 02:28:43 +0100 Subject: Initial import of akode 2.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- akode/plugins/alsa_sink/Makefile.am | 7 + akode/plugins/alsa_sink/Makefile.in | 659 ++++++++++++++++++++++++++++++++++ akode/plugins/alsa_sink/alsa_sink.cpp | 311 ++++++++++++++++ akode/plugins/alsa_sink/alsa_sink.h | 63 ++++ 4 files changed, 1040 insertions(+) create mode 100644 akode/plugins/alsa_sink/Makefile.am create mode 100644 akode/plugins/alsa_sink/Makefile.in create mode 100644 akode/plugins/alsa_sink/alsa_sink.cpp create mode 100644 akode/plugins/alsa_sink/alsa_sink.h (limited to 'akode/plugins/alsa_sink') diff --git a/akode/plugins/alsa_sink/Makefile.am b/akode/plugins/alsa_sink/Makefile.am new file mode 100644 index 0000000..e1254f1 --- /dev/null +++ b/akode/plugins/alsa_sink/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = -I$(top_srcdir)/akode/lib -I$(top_builddir)/akode/lib $(all_includes) + +lib_LTLIBRARIES = libakode_alsa_sink.la + +libakode_alsa_sink_la_SOURCES = alsa_sink.cpp +libakode_alsa_sink_la_LDFLAGS = -module -avoid-version -no-undefined +libakode_alsa_sink_la_LIBADD = ../../lib/libakode.la $(ALSA_LIBS) diff --git a/akode/plugins/alsa_sink/Makefile.in b/akode/plugins/alsa_sink/Makefile.in new file mode 100644 index 0000000..d4dadc8 --- /dev/null +++ b/akode/plugins/alsa_sink/Makefile.in @@ -0,0 +1,659 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision: 483858 $ +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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 = akode/plugins/alsa_sink +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/akode/lib/akode_export.h +CONFIG_CLEAN_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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libakode_alsa_sink_la_DEPENDENCIES = ../../lib/libakode.la \ + $(am__DEPENDENCIES_1) +am_libakode_alsa_sink_la_OBJECTS = alsa_sink.lo +#>- libakode_alsa_sink_la_OBJECTS = $(am_libakode_alsa_sink_la_OBJECTS) +#>+ 1 +libakode_alsa_sink_la_OBJECTS = alsa_sink.lo +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/akode/lib +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ +#>- $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(KDE_CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libakode_alsa_sink_la_SOURCES) +DIST_SOURCES = $(libakode_alsa_sink_la_SOURCES) +ETAGS = etags +CTAGS = ctags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 1 +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) +ACLOCAL = @ACLOCAL@ +AKODE_LIBDL = @AKODE_LIBDL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AVCODEC_CFLAGS = @AVCODEC_CFLAGS@ +AVCODEC_LDFLAGS = @AVCODEC_LDFLAGS@ +AVCODEC_LIBADD = @AVCODEC_LIBADD@ +AVFORMAT_CFLAGS = @AVFORMAT_CFLAGS@ +AVFORMAT_LDFLAGS = @AVFORMAT_LDFLAGS@ +AVFORMAT_LIBADD = @AVFORMAT_LIBADD@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_PERMISSIVE_FLAG = @ENABLE_PERMISSIVE_FLAG@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAVE_GCC_VISIBILITY = @HAVE_GCC_VISIBILITY@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LDFLAGS = @JACK_LDFLAGS@ +JACK_LIBADD = @JACK_LIBADD@ +KDE_CHECK_PLUGIN = @KDE_CHECK_PLUGIN@ +KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@ +KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_AS_NEEDED = @LDFLAGS_AS_NEEDED@ +LDFLAGS_NEW_DTAGS = @LDFLAGS_NEW_DTAGS@ +LIBFLAC = @LIBFLAC@ +LIBOBJS = @LIBOBJS@ +LIBOGGFLAC = @LIBOGGFLAC@ +LIBOSSAUDIO = @LIBOSSAUDIO@ +LIBPTHREAD = @LIBPTHREAD@ +LIBS = @LIBS@ +LIBSAMPLERATE = @LIBSAMPLERATE@ +LIBSEM = @LIBSEM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MADLIBS = @MADLIBS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POLYP_CFLAGS = @POLYP_CFLAGS@ +POLYP_LDFLAGS = @POLYP_LDFLAGS@ +POLYP_LIBADD = @POLYP_LIBADD@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPEEXLIBS = @SPEEXLIBS@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +VORBIS_LIBS = @VORBIS_LIBS@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +akode_SUBDIR_included_FALSE = @akode_SUBDIR_included_FALSE@ +akode_SUBDIR_included_TRUE = @akode_SUBDIR_included_TRUE@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +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@ +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@ +include_alsa_sink_FALSE = @include_alsa_sink_FALSE@ +include_alsa_sink_TRUE = @include_alsa_sink_TRUE@ +include_ffmpeg_decoder_FALSE = @include_ffmpeg_decoder_FALSE@ +include_ffmpeg_decoder_TRUE = @include_ffmpeg_decoder_TRUE@ +include_jack_sink_FALSE = @include_jack_sink_FALSE@ +include_jack_sink_TRUE = @include_jack_sink_TRUE@ +include_mpeg_decoder_FALSE = @include_mpeg_decoder_FALSE@ +include_mpeg_decoder_TRUE = @include_mpeg_decoder_TRUE@ +include_oss_sink_FALSE = @include_oss_sink_FALSE@ +include_oss_sink_TRUE = @include_oss_sink_TRUE@ +include_polyp_sink_FALSE = @include_polyp_sink_FALSE@ +include_polyp_sink_TRUE = @include_polyp_sink_TRUE@ +include_src_resampler_FALSE = @include_src_resampler_FALSE@ +include_src_resampler_TRUE = @include_src_resampler_TRUE@ +include_sun_sink_FALSE = @include_sun_sink_FALSE@ +include_sun_sink_TRUE = @include_sun_sink_TRUE@ +include_xiph_decoder_FALSE = @include_xiph_decoder_FALSE@ +include_xiph_decoder_TRUE = @include_xiph_decoder_TRUE@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +unsermake_enable_pch_FALSE = @unsermake_enable_pch_FALSE@ +unsermake_enable_pch_TRUE = @unsermake_enable_pch_TRUE@ +INCLUDES = -I$(top_srcdir)/akode/lib -I$(top_builddir)/akode/lib $(all_includes) +lib_LTLIBRARIES = libakode_alsa_sink.la +libakode_alsa_sink_la_SOURCES = alsa_sink.cpp +#>- libakode_alsa_sink_la_LDFLAGS = -module -avoid-version -no-undefined +#>+ 1 +libakode_alsa_sink_la_LDFLAGS = -module -avoid-version -no-undefined $(KDE_NO_UNDEFINED) +libakode_alsa_sink_la_LIBADD = ../../lib/libakode.la $(ALSA_LIBS) +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +#>- @for dep in $?; do \ +#>- case '$(am__configure_deps)' in \ +#>- *$$dep*) \ +#>- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ +#>- && exit 0; \ +#>- exit 1;; \ +#>- esac; \ +#>- done; \ +#>- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile'; \ +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile +#>+ 12 + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/alsa_sink/Makefile.in +.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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +#>- libakode_alsa_sink.la: $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_DEPENDENCIES) +#>+ 2 +@KDE_USE_CLOSURE_TRUE@libakode_alsa_sink.la: libakode_alsa_sink.la.closure $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_DEPENDENCIES) +@KDE_USE_CLOSURE_FALSE@libakode_alsa_sink.la: $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libakode_alsa_sink_la_LDFLAGS) $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsa_sink.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-closures clean-bcheck clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +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-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# 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: + +#>+ 8 +libakode_alsa_sink.la.closure: $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_DEPENDENCIES) + @echo "int main() {return 0;}" > libakode_alsa_sink_la_closure.cpp + @$(LTCXXCOMPILE) -c libakode_alsa_sink_la_closure.cpp + $(CXXLINK) libakode_alsa_sink_la_closure.lo $(libakode_alsa_sink_la_LDFLAGS) $(libakode_alsa_sink_la_OBJECTS) $(libakode_alsa_sink_la_LIBADD) $(LIBS) + @rm -f libakode_alsa_sink_la_closure.* libakode_alsa_sink.la.closure + @echo "timestamp" > libakode_alsa_sink.la.closure + + +#>+ 2 +KDE_DIST=alsa_sink.h Makefile.in Makefile.am + +#>+ 3 +clean-closures: + -rm -f libakode_alsa_sink.la.closure + +#>+ 2 +docs-am: + +#>+ 15 +force-reedit: + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu akode/plugins/alsa_sink/Makefile + cd $(top_srcdir) && perl admin/am_edit akode/plugins/alsa_sink/Makefile.in + + +#>+ 21 +clean-bcheck: + rm -f *.bchecktest.cc *.bchecktest.cc.class a.out + +bcheck: bcheck-am + +bcheck-am: + @for i in ; do \ + if test $(srcdir)/$$i -nt $$i.bchecktest.cc; then \ + echo "int main() {return 0;}" > $$i.bchecktest.cc ; \ + echo "#include \"$$i\"" >> $$i.bchecktest.cc ; \ + echo "$$i"; \ + if ! $(CXXCOMPILE) --dump-class-hierarchy -c $$i.bchecktest.cc; then \ + rm -f $$i.bchecktest.cc; exit 1; \ + fi ; \ + echo "" >> $$i.bchecktest.cc.class; \ + perl $(top_srcdir)/admin/bcheck.pl $$i.bchecktest.cc.class || { rm -f $$i.bchecktest.cc; exit 1; }; \ + rm -f a.out; \ + fi ; \ + done + + +#>+ 3 +final: + $(MAKE) all-am + +#>+ 3 +final-install: + $(MAKE) install-am + +#>+ 3 +no-final: + $(MAKE) all-am + +#>+ 3 +no-final-install: + $(MAKE) install-am + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo + +#>+ 3 +nmcheck: +nmcheck-am: nmcheck diff --git a/akode/plugins/alsa_sink/alsa_sink.cpp b/akode/plugins/alsa_sink/alsa_sink.cpp new file mode 100644 index 0000000..2abad2e --- /dev/null +++ b/akode/plugins/alsa_sink/alsa_sink.cpp @@ -0,0 +1,311 @@ +/* aKode: ALSA Sink + + Copyright (C) 2004-2005 Allan Sandfeld Jensen + + 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; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include + +#include +#include "alsa_sink.h" + +/* + * resume from suspend + */ +static int resume(snd_pcm_t *pcm) +{ + int res; + while ((res = snd_pcm_resume(pcm)) == -EAGAIN) + sleep(1); + if (! res) + return 0; + return snd_pcm_prepare(pcm); +} + +namespace aKode { + +extern "C" { ALSASinkPlugin alsa_sink; } + +struct ALSASink::private_data +{ + private_data() : pcm_playback(0), buffer(0), error(false), can_pause(false) {}; + + snd_pcm_t *pcm_playback; + + AudioConfiguration config; + int scale; + int filled, fragmentSize; + int sampleSize; + char* buffer; + bool error; + bool can_pause; +}; + +ALSASink::ALSASink() +{ + m_data = new private_data; +} + +ALSASink::~ALSASink() +{ + close(); + delete m_data; +} + +bool ALSASink::open() +{ + int err = 0; + // open is non-blocking to make it possible to fail when occupied + err = snd_pcm_open(&m_data->pcm_playback, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + if (err < 0) { + m_data->error = true; + return false; + } + + // Set to blocking + snd_pcm_nonblock(m_data->pcm_playback, 0); + + m_data->error = false; + return true; +} + +void ALSASink::close() +{ + if (m_data->pcm_playback) { + snd_pcm_drain(m_data->pcm_playback); + snd_pcm_close(m_data->pcm_playback); + } + m_data->pcm_playback = 0; + m_data->error = false; +} + +int ALSASink::setAudioConfiguration(const AudioConfiguration* config) +{ + if (m_data->error) return -1; + + // Get back to OPEN state (is SETUP state enough with snd_pcm_drop?) + snd_pcm_state_t state = snd_pcm_state( m_data->pcm_playback ); + if (state != SND_PCM_STATE_OPEN) { + close(); + if (!open()) return -1; + } + + int res = 0; + int wid = 1; + m_data->config = *config; + snd_pcm_hw_params_t *hw; + snd_pcm_hw_params_alloca(&hw); + snd_pcm_hw_params_any(m_data->pcm_playback, hw); + snd_pcm_hw_params_set_access(m_data->pcm_playback, hw, SND_PCM_ACCESS_RW_INTERLEAVED); + // Detect format: + snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN; + // Test for float, 24 and 32 bit integer. Fall back to 16bit + if (m_data->config.sample_width<0) { + if (snd_pcm_hw_params_test_format(m_data->pcm_playback, hw, SND_PCM_FORMAT_FLOAT ) == 0) { + format = SND_PCM_FORMAT_FLOAT; + m_data->scale = 1; + wid = 4; + goto found_format; + } + // Try 16bit then + m_data->config.sample_width = 16; + res = 1; + } + if (m_data->config.sample_width > 24 && m_data->config.sample_width <=32) { + if (snd_pcm_hw_params_test_format(m_data->pcm_playback, hw, SND_PCM_FORMAT_S32) == 0) { + format = SND_PCM_FORMAT_S32; + m_data->scale = 1<<(32-config->sample_width); + wid = 4; + goto found_format; + } + // Try 24bit then + m_data->config.sample_width = 24; + res = 1; + } + if (m_data->config.sample_width > 16 && m_data->config.sample_width <= 24) { + if (snd_pcm_hw_params_test_format(m_data->pcm_playback, hw, SND_PCM_FORMAT_S24 ) == 0) { + format = SND_PCM_FORMAT_S24; + m_data->scale = 1<<(24-config->sample_width); + wid = 4; + goto found_format; + } + // Try 16bit then + m_data->config.sample_width = 16; + } + // If the driver doesnt support 8 or 16 bit, we will fail completly + if (m_data->config.sample_width<=8) { + format = SND_PCM_FORMAT_S8; + m_data->scale = 1<<(8-config->sample_width); + wid = 1; + goto found_format; + } + else + if (m_data->config.sample_width<=16) { + format = SND_PCM_FORMAT_S16; + m_data->scale = 1<<(16-config->sample_width); + wid = 2; + goto found_format; + } + +found_format: + if (format != SND_PCM_FORMAT_UNKNOWN) + snd_pcm_hw_params_set_format(m_data->pcm_playback, hw, format); + else + return -1; + + unsigned int rate = config->sample_rate; + snd_pcm_hw_params_set_rate_near(m_data->pcm_playback, hw, &rate, 0); + if (m_data->config.sample_rate != rate) { + m_data->config.sample_rate = rate; + res = 1; + } + + snd_pcm_hw_params_set_channels(m_data->pcm_playback, hw, config->channels); + + + m_data->fragmentSize = 1024; + snd_pcm_uframes_t period_size = m_data->fragmentSize / (wid*config->channels); + snd_pcm_hw_params_set_period_size_near(m_data->pcm_playback, hw, &period_size, 0); + + m_data->fragmentSize = period_size * (wid*config->channels); +// std::cerr << "akode: ALSA fragment-size: " << m_data->fragmentSize << "\n"; + + delete m_data->buffer; + m_data->buffer = new char [m_data->fragmentSize]; + m_data->filled = 0; + + if (snd_pcm_hw_params(m_data->pcm_playback, hw) < 0) { + return -1; + } + else { + m_data->can_pause = (snd_pcm_hw_params_can_pause(hw) == 1); + return res; + } +} + +const AudioConfiguration* ALSASink::audioConfiguration() const +{ + return &m_data->config; +} + +template +bool ALSASink::_writeFrame(AudioFrame* frame) +{ + int channels = m_data->config.channels; + + long i = 0; + T* buffer = (T*)m_data->buffer; + T** data = (T**)frame->data; + while(true) { + if (m_data->filled >= m_data->fragmentSize) + xrun: + { + int frames = snd_pcm_bytes_to_frames(m_data->pcm_playback, m_data->filled); + int status = snd_pcm_writei(m_data->pcm_playback, m_data->buffer, frames); + if (status == -EPIPE) { + snd_pcm_prepare(m_data->pcm_playback); + //std::cerr << "akode: ALSA xrun\n"; + goto xrun; + } + else if (status < 0) return false; + int bytes = snd_pcm_frames_to_bytes(m_data->pcm_playback, status); + if (m_data->filled != bytes) { + int rest = m_data->filled - bytes; + //std::cerr << "akode: ALSA write-remainder: " << rest << "\n"; + memmove(m_data->buffer, m_data->buffer + bytes, rest); + m_data->filled = rest; + } else + m_data->filled = 0; + + } + if (i >= frame->length) break; + for(int j=0; jfilled/sizeof(T)] = (data[j][i])*m_data->scale; + m_data->filled+=sizeof(T); + } + i++; + } + + if (snd_pcm_state( m_data->pcm_playback ) == SND_PCM_STATE_PREPARED) + snd_pcm_start(m_data->pcm_playback); + + return true; +} + +bool ALSASink::writeFrame(AudioFrame* frame) +{ + if (m_data->error) return false; + if (!frame) return false; + + if ( frame->sample_width != m_data->config.sample_width + || frame->channels != m_data->config.channels + || frame->sample_rate != m_data->config.sample_rate) + { + if (setAudioConfiguration(frame) < 0) + return false; + } + + if ( snd_pcm_state(m_data->pcm_playback) == SND_PCM_STATE_SUSPENDED ) { + int res = ::resume(m_data->pcm_playback); + if (res < 0) + return false; + } + else + if (snd_pcm_state( m_data->pcm_playback ) == SND_PCM_STATE_PAUSED) + snd_pcm_pause(m_data->pcm_playback, 0); + + if (snd_pcm_state( m_data->pcm_playback ) == SND_PCM_STATE_SETUP) + snd_pcm_prepare(m_data->pcm_playback); + + if (frame->sample_width<0) + return _writeFrame(frame); + else + if (frame->sample_width<=8) + return _writeFrame(frame); + else + if (frame->sample_width<=16) + return _writeFrame(frame); + else + if (frame->sample_width<=32) + return _writeFrame(frame); + + return false; +} + +void ALSASink::pause() +{ + if (m_data->error) return; + + if (m_data->can_pause) { + snd_pcm_pause(m_data->pcm_playback, 1); + } + +} + +// Do not confuse this with snd_pcm_resume which is used to resume from a suspend +void ALSASink::resume() +{ + if (m_data->error) return; + + if (snd_pcm_state( m_data->pcm_playback ) == SND_PCM_STATE_PAUSED) + snd_pcm_pause(m_data->pcm_playback, 0); +} + +} // namespace diff --git a/akode/plugins/alsa_sink/alsa_sink.h b/akode/plugins/alsa_sink/alsa_sink.h new file mode 100644 index 0000000..cd8da4e --- /dev/null +++ b/akode/plugins/alsa_sink/alsa_sink.h @@ -0,0 +1,63 @@ +/* aKode: ALSA-Sink + + Copyright (C) 2004 Allan Sandfeld Jensen + + 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; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _AKODE_ALSA_SINK_H +#define _AKODE_ALSA_SINK_H + +#include "sink.h" + +#include "akode_export.h" + +namespace aKode { + +class AudioConfiguration; +class AudioFrame; + +class ALSASink : public Sink { +public: + ALSASink(); + ~ALSASink(); + bool open(); + void close(); + int setAudioConfiguration(const AudioConfiguration *config); + const AudioConfiguration* audioConfiguration() const; + // Writes blocking + bool writeFrame(AudioFrame *frame); + void pause(); + void resume(); + + struct private_data; +private: + template bool _writeFrame(AudioFrame *frame); + private_data *m_data; +}; + +class ALSASinkPlugin : public SinkPlugin { +public: + virtual ALSASink* openSink() { + return new ALSASink(); + } +}; + +extern "C" AKODE_EXPORT ALSASinkPlugin alsa_sink; + +} // namespace + +#endif -- cgit v1.2.3