changeset 1656:d05836d18d42 trunk

[svn] Hook PulseAudio into the build system and clean it up a little.
author chainsaw
date Fri, 08 Sep 2006 16:55:47 -0700
parents fd657c404f0b
children 81e057e03c1f
files ChangeLog Plugins/Output/pulse_audio/pulse_audio.c configure.ac
diffstat 3 files changed, 50 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 08 16:00:10 2006 -0700
+++ b/ChangeLog	Fri Sep 08 16:55:47 2006 -0700
@@ -1,3 +1,12 @@
+2006-09-08 23:00:10 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [2247]
+  PulseAudio output plugin. Ported from the XMMS plugin by Lennart Poettering.
+
+  Changes:        Modified:
+  +15 -0          trunk/Plugins/Output/pulse_audio/Makefile.in  
+  +760 -0         trunk/Plugins/Output/pulse_audio/pulse_audio.c  
+
+
 2006-09-08 17:55:02 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2245]
   - remove this
--- a/Plugins/Output/pulse_audio/pulse_audio.c	Fri Sep 08 16:00:10 2006 -0700
+++ b/Plugins/Output/pulse_audio/pulse_audio.c	Fri Sep 08 16:55:47 2006 -0700
@@ -13,7 +13,7 @@
  
   You should have received a copy of the GNU General Public License
   along with xmms-pulse; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
   USA.
 ***/
 
@@ -23,7 +23,6 @@
 
 #include <stdio.h>
 #include <assert.h>
-/* #include <pthread.h> */
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
@@ -184,8 +183,6 @@
     pa_cvolume v;
     int b = 0;
 
-/*     g_message("get_volume"); */
-
     *l = *r = 100;
 
     if (connected) {
@@ -227,8 +224,6 @@
 
 static void pulse_set_volume(int l, int r) {
 
-/*     g_message("set_volume"); */
-
     if (connected) {
         pa_threaded_mainloop_lock(mainloop);
         CHECK_DEAD_GOTO(fail, 1);
@@ -260,8 +255,6 @@
     pa_operation *o = NULL;
     int success = 0;
 
-/*     g_message("pause"); */
-
     CHECK_CONNECTED();
 
     pa_threaded_mainloop_lock(mainloop);
@@ -292,8 +285,6 @@
     size_t l = 0;
     pa_operation *o = NULL;
 
-/*     g_message("free"); */
-
     CHECK_CONNECTED(0);
 
     pa_threaded_mainloop_lock(mainloop);
@@ -337,8 +328,6 @@
 static int pulse_get_written_time(void) {
     int r = 0;
     
-/*     g_message("get_written_time"); */
-
     CHECK_CONNECTED(0);
 
     pa_threaded_mainloop_lock(mainloop);
@@ -346,8 +335,6 @@
     
     r = (int) (((double) written*1000) / pa_bytes_per_second(pa_stream_get_sample_spec(stream)));
 
-/*     g_message("written_time = %i", r); */
-
 fail:
     pa_threaded_mainloop_unlock(mainloop);
 
@@ -358,8 +345,6 @@
     int r = 0;
     pa_usec_t t;
     
-/*     g_message("get_output_time"); */
-
     CHECK_CONNECTED(0);
 
     pa_threaded_mainloop_lock(mainloop);
@@ -387,8 +372,6 @@
 
     r += time_offset_msec;
 
-/*     g_message("output_time = %i", r); */
-    
 fail:
     pa_threaded_mainloop_unlock(mainloop);
     
@@ -401,8 +384,6 @@
 
     CHECK_CONNECTED(0);
     
-/*     g_message("playing"); */
-
     pa_threaded_mainloop_lock(mainloop);
 
     for (;;) {
@@ -431,8 +412,6 @@
     pa_operation *o = NULL;
     int success = 0;
 
-/*     g_message("flush"); */
-
     CHECK_CONNECTED();
 
     pa_threaded_mainloop_lock(mainloop);
@@ -464,8 +443,6 @@
 
 static void pulse_write(void* ptr, int length) {
 
-/*     g_message("write"); */
-    
     CHECK_CONNECTED();
 
     pa_threaded_mainloop_lock(mainloop);
@@ -515,8 +492,6 @@
 
 static void pulse_close(void) {
 
-/*     g_message("close"); */
-    
     drain();
 
     connected = 0;
@@ -549,8 +524,6 @@
     pa_operation *o = NULL;
     int success;
 
-/*     g_message("open"); */
-
     g_assert(!mainloop);
     g_assert(!context);
     g_assert(!stream);
@@ -694,9 +667,6 @@
     return FALSE;
 }
 
-static void pulse_init(void) {
-}
-
 static void pulse_about(void) {
     static GtkWidget *dialog;
     
@@ -718,7 +688,7 @@
             "\n"
             "You should have received a copy of the GNU General Public License\n"
             "along with this program; if not, write to the Free Software\n"
-            "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n"
+            "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
             "USA.",
             "OK",
             FALSE,
@@ -732,16 +702,15 @@
             &dialog);
 }
 
-
 OutputPlugin *get_oplugin_info(void) {
     static OutputPlugin pulse_plugin = {
         NULL,
         NULL,
         "PulseAudio Output Plugin",
-        pulse_init,
+        NULL,
 	NULL,                        
         pulse_about,
-        NULL,                       /* pulse_configure, */
+        NULL,
         pulse_get_volume,
         pulse_set_volume,
         pulse_open,                         
--- a/configure.ac	Fri Sep 08 16:00:10 2006 -0700
+++ b/configure.ac	Fri Sep 08 16:55:47 2006 -0700
@@ -316,6 +316,25 @@
     have_esd=no
 fi
 
+dnl Check for PulseAudio
+
+AC_ARG_ENABLE( pulse,
+    [  --disable-pulse         disable PulseAudio output plugin [default=enabled]],
+    [enable_pulse=$enableval],
+    [enable_pulse="yes"]
+)
+
+if test "$enable_pulse" = "yes"; then
+    PKG_CHECK_MODULES(PULSE, [libpulse >= 0.9.3],
+         [have_pulse=yes
+          OUTPUT_PLUGINS="$OUTPUT_PLUGINS pulse_audio"],
+         [have_pulse=no]
+    )
+else
+    AC_MSG_RESULT([*** esound plugin disabled per user request ***])
+    have_pulse=no
+fi
+
 dnl *** AltiVec
 
 AC_CHECK_HEADERS(altivec.h,
@@ -1060,26 +1079,27 @@
 AC_SUBST(CONTAINER_PLUGINS)
 
 AC_CONFIG_FILES([
-        audacious.1
-        audacious.spec
-        audacious.pc
-        audacious/audacious.desktop
+	audacious.1
+	audacious.spec
+	audacious.pc
+	audacious/audacious.desktop
 	audacious/images/Makefile
-        libaudacious/Makefile
-        libguess/Makefile
+	libaudacious/Makefile
+	libguess/Makefile
 	librcd/Makefile
 	Plugins/Makefile
-        Plugins/Output/Makefile
-        Plugins/Output/OSS/Makefile
-        Plugins/Output/esd/Makefile
-        Plugins/Output/alsa/Makefile
+	Plugins/Output/Makefile
+	Plugins/Output/OSS/Makefile
+	Plugins/Output/esd/Makefile
+	Plugins/Output/alsa/Makefile
 	Plugins/Output/jack/Makefile
 	Plugins/Output/arts/Makefile
 	Plugins/Output/arts/arts_helper/Makefile
 	Plugins/Output/disk_writer/Makefile
+	Plugins/Output/pulse_audio/Makefile
 	Plugins/Output/sun/Makefile
-        Plugins/Input/Makefile
-        Plugins/Input/mpg123/Makefile
+	Plugins/Input/Makefile
+	Plugins/Input/mpg123/Makefile
 	Plugins/Input/aac/Makefile
 	Plugins/Input/aac/mp4ff/Makefile
 	Plugins/Input/aac/libfaad2/Makefile
@@ -1122,10 +1142,10 @@
 	Plugins/Effect/stereo_plugin/Makefile
 	Plugins/Effect/voice_removal/Makefile
 	Plugins/Container/Makefile
-        po/Makefile.in
-        intl/Makefile
-        icons/Makefile
-        skin/Makefile
+	po/Makefile.in
+	intl/Makefile
+	icons/Makefile
+	skin/Makefile
 	mk/rules.mk
 ])
 
@@ -1163,6 +1183,7 @@
 echo "  Jack Audio Connection Kit (jack):       $have_jack"
 echo "  Analog Realtime Synthesizer (arts):     $have_arts"
 echo "  BSD/SUN audio output (sun):             $have_sun"
+echo "  PulseAudio sound server (pulse_audio):  $have_pulse"
 echo
 echo "  Input Plugins"
 echo "  -------------"