changeset 2067:0b0a12ea9dd9 trunk

[svn] - allow the output plugin to be changed while playing.
author nenolod
date Thu, 07 Dec 2006 22:56:55 -0800
parents 4f750b8d0127
children 31b5c59ed31b
files ChangeLog audacious/output.c audacious/prefswin.c
diffstat 3 files changed, 54 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 07 22:42:22 2006 -0800
+++ b/ChangeLog	Thu Dec 07 22:56:55 2006 -0800
@@ -1,3 +1,16 @@
+2006-12-08 06:42:22 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [3135]
+  Do not install signal handler for SIGSEGV if environmental variable
+  AUD_ENSURE_BACKTRACE is defined.
+  
+  In particular environment (maybe with glibc 2.5), core file through
+  signal handler does not contain application's backtrace but signal
+  handler's backtrace. :(
+  
+  trunk/audacious/main.c |   10 +++++++++-
+  1 file changed, 9 insertions(+), 1 deletion(-)
+
+
 2006-12-07 08:22:55 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3133]
   - no, this is not going to work
--- a/audacious/output.c	Thu Dec 07 22:42:22 2006 -0800
+++ b/audacious/output.c	Thu Dec 07 22:56:55 2006 -0800
@@ -1,4 +1,7 @@
-/*  BMP - Cross-platform multimedia player
+/*  Audacious
+ *  Copyright (C) 2005-2007  Audacious team
+ *
+ *  BMP - Cross-platform multimedia player
  *  Copyright (C) 2003-2004  BMP development team.
  *
  *  Based on XMMS:
@@ -74,11 +77,10 @@
 void
 set_current_output_plugin(gint i)
 {
-#if 0
     gint time;
     gint pos;
     gboolean playing;
-#endif
+    OutputPlugin *op = get_current_output_plugin();
 
     GList *node = g_list_nth(op_data.output_list, i);
     if (!node) {
@@ -88,44 +90,48 @@
 
     op_data.current_output_plugin = node->data;
 
+    playing = bmp_playback_get_playing();
 
-#if 0
-    playing = bmp_playback_get_playing();
-    if (playing) {
-        /* FIXME: we do all on our own here */
-        
-        guint min = 0, sec = 0, params, time, pos;
-        gchar timestr[10];
-        
-        bmp_playback_pause();
-        pos = get_playlist_position();
-        time = bmp_playback_get_time() / 1000;
-        g_snprintf(timestr, sizeof(timestr), "%u:%2.2u",
-                   time / 60, time % 60);
-        
-        params = sscanf(timestr, "%u:%u", &min, &sec);
-        if (params == 2)
-            time = (min * 60) + sec;
-        else if (params == 1)
-            time = min;
-        else
-            return;
-        
-        bmp_playback_stop();
+    if (playing == TRUE)
+    {
+	gint i = 99;
+        guint time, pos;
+	PlaylistEntry *entry;
+
+	/* don't stop yet, get the seek time and playlist position first */
+        pos = playlist_get_position();
+        time = op->output_time();
+
+	/* reset the audio system */
+        mainwin_stop_pushed();
+        op->close_audio();
+
+	g_usleep(300000);
+
+	/* wait for the playback thread to come online */
+        while (bmp_playback_get_playing())
+            g_message("waiting for audio system shutdown...");
+
+	/* wait for the playback thread to come online */
         playlist_set_position(pos);
-        bmp_playback_play_file(playlist_get_filename(pos));
-        
-        while (!bmp_playback_get_playing())
-            g_message("waiting...");
+	entry = playlist_get_entry_to_play();
+        bmp_playback_play_file(entry);
 
+	while (!bmp_playback_get_playing())
+	{
+	    gtk_main_iteration();
+            g_message("waiting for audio system startup...");
+	}
+
+	/* and signal a reseek */
         if (playlist_get_current_length() > -1 &&
-            time <= (playlist_get_current_length() / 1000)) {
-            /* Some time for things to cool down and heat up */
-            g_usleep(1000000);
-            bmp_playback_seek(time);
+            time <= (playlist_get_current_length()))
+	{
+	    gint i;
+
+            bmp_playback_seek(time / 1000);
         }
     }
-#endif
 }
 
 GList *
--- a/audacious/prefswin.c	Thu Dec 07 22:42:22 2006 -0800
+++ b/audacious/prefswin.c	Thu Dec 07 22:56:55 2006 -0800
@@ -397,10 +397,6 @@
     gint selected;
     selected = gtk_combo_box_get_active(combobox);
 
-    /* Force playback to stop. There is NO way to change the output
-       plugin in the middle of a playback, and NO way to know when the
-       user closes the output plugin settings dialog. */
-    mainwin_stop_pushed();
     set_current_output_plugin(selected);
 }