]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/pulse.c
Fix assertions. (dts-dynrng and spdif are boolean parameters)
[vlc] / modules / audio_output / pulse.c
index 8ef3e4cccfbffa824373714f3a1210be506336c4..852e41802a6097566ace3e4efa140c154de7610a 100644 (file)
@@ -34,6 +34,9 @@
 #include <vlc_cpu.h>
 
 #include <pulse/pulseaudio.h>
+#ifdef HAVE_X11_XLIB_H
+# include <X11/Xlib.h>
+#endif
 
 #include <assert.h>
 
@@ -104,7 +107,6 @@ vlc_module_begin ()
     add_shortcut( "pulseaudio" )
     add_shortcut( "pa" )
     set_callbacks( Open, Close )
-    linked_with_a_crap_library_which_uses_atexit()
 vlc_module_end ()
 
 /*****************************************************************************
@@ -119,6 +121,10 @@ static int Open ( vlc_object_t *p_this )
     struct pa_buffer_attr a;
     struct pa_channel_map map;
 
+#ifdef HAVE_X11_XLIB_H
+    if( !XInitThreads() )
+        return VLC_EGENERIC;
+#endif
     /* Allocate structures */
     p_aout->output.p_sys = p_sys = calloc( 1, sizeof( aout_sys_t ) );
     if( p_sys == NULL )
@@ -338,7 +344,6 @@ static void Close ( vlc_object_t *p_this )
     msg_Dbg(p_aout, "Pulse Close");
 
     if(p_sys->stream){
-        pa_operation *o;
         pa_threaded_mainloop_lock(p_sys->mainloop);
         pa_stream_set_write_callback(p_sys->stream, NULL, NULL);
 
@@ -347,7 +352,8 @@ static void Close ( vlc_object_t *p_this )
  * And disabling this speeds up closing pulseaudio quite a lot (atleast for me).
  */
 #if 0
-        if((o = pa_stream_drain(p_sys->stream, success_cb, p_aout))){
+        pa_operation *o = pa_stream_drain(p_sys->stream, success_cb, p_aout);
+        if(o){
             while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
                 CHECK_DEAD_GOTO(fail);
                 pa_threaded_mainloop_wait(p_sys->mainloop);