changeset 144:0faf2fa7fc85 trunk

[svn] More thread safety, less XMMS braindamage.
author nenolod
date Thu, 10 Nov 2005 16:48:36 -0800
parents 32c320bba8a6
children 8794a4781a15
files audacious/playback.c audacious/playback.h
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/playback.c	Thu Nov 10 16:40:09 2005 -0800
+++ b/audacious/playback.c	Thu Nov 10 16:48:36 2005 -0800
@@ -125,6 +125,8 @@
 void
 bmp_playback_pause(void)
 {
+    g_mutex_lock(ip_data.playback_mutex);
+
     if (!bmp_playback_get_playing())
         return;
 
@@ -139,6 +141,8 @@
         playstatus_set_status(mainwin_playstatus, STATUS_PLAY);
 
     get_current_input_plugin()->pause(ip_data.paused);
+
+    g_mutex_unlock(ip_data.playback_mutex);
 }
 
 void
@@ -171,6 +175,32 @@
     g_mutex_free(ip_data.playback_mutex);
 }
 
+void
+bmp_playback_stop_reentrant(void)
+{
+    g_mutex_lock(ip_data.playback_mutex);
+
+    if (ip_data.playing && get_current_input_plugin()) {
+        ip_data.playing = FALSE;
+
+        if (bmp_playback_get_paused())
+            bmp_playback_pause();
+
+        free_vis_data();
+        ip_data.paused = FALSE;
+
+        if (input_info_text) {
+            g_free(input_info_text);
+            input_info_text = NULL;
+            mainwin_set_info_text();
+        }
+    }
+
+    ip_data.playing = FALSE;
+
+    g_mutex_unlock(ip_data.playback_mutex);
+    g_mutex_free(ip_data.playback_mutex);
+}
 
 static void
 run_no_output_plugin_dialog(void)
--- a/audacious/playback.h	Thu Nov 10 16:40:09 2005 -0800
+++ b/audacious/playback.h	Thu Nov 10 16:48:36 2005 -0800
@@ -26,6 +26,7 @@
 void bmp_playback_initiate(void);
 void bmp_playback_pause(void);
 void bmp_playback_stop(void);
+void bmp_playback_stop_reentrant(void);
 gboolean bmp_playback_play_file(const gchar * filename);
 gboolean bmp_playback_get_playing(void);
 gboolean bmp_playback_get_paused(void);