changeset 1447:195b5657303e

updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
author Giacomo Lozito <james@develia.org>
date Fri, 10 Aug 2007 22:00:07 +0200
parents 78de16e6989c
children 68c9906e0ac4
files src/aac/src/libmp4.c src/adplug/adplug-xmms.cc src/alac/plugin.c src/amidi-plug/amidi-plug.c src/cdaudio-ng/cdaudio-ng.c src/console/Audacious_Driver.cxx src/cue/cuesheet.c src/flacng/plugin.c src/madplug/plugin.c src/metronom/metronom.c src/modplug/modplugbmp.cxx src/modplug/modplugbmp.h src/modplug/plugin.cxx src/musepack/libmpc.cxx src/sexypsf/plugin.c src/sid/xmms-sid.c src/timidity/src/xmms-timidity.c src/tonegen/tonegen.c src/tta/libtta.c src/vorbis/vorbis.c src/vtx/vtx.c src/wav/wav.c src/wavpack/libwavpack.cxx src/wma/wma.c
diffstat 24 files changed, 25 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/aac/src/libmp4.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/aac/src/libmp4.c	Fri Aug 10 22:00:07 2007 +0200
@@ -117,6 +117,7 @@
     buffer_playing = TRUE;
     playback->playing = 1; //XXX should acquire lock?
     decodeThread = g_thread_self();
+    playback->set_pb_ready(playback);
     mp4_decode(playback);
 }
 
--- a/src/adplug/adplug-xmms.cc	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/adplug/adplug-xmms.cc	Fri Aug 10 22:00:07 2007 +0200
@@ -989,6 +989,7 @@
   // start player func
   dbg_printf ("play");
   plr.play_thread =  g_thread_self();
+  playback->set_pb_ready(playback);
   play_loop(playback);
   dbg_printf (".\n");
 }
--- a/src/alac/plugin.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/alac/plugin.c	Fri Aug 10 22:00:07 2007 +0200
@@ -180,6 +180,7 @@
     going = 1;
     playback = data;
     playback_thread = g_thread_self();
+    playback->set_pb_ready(playback);
     decode_thread(filename);
 }
 
--- a/src/amidi-plug/amidi-plug.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/amidi-plug/amidi-plug.c	Fri Aug 10 22:00:07 2007 +0200
@@ -139,24 +139,9 @@
 
 static void amidiplug_stop( InputPlayback * playback )
 {
-  gboolean is_error = FALSE;
   DEBUGMSG( "STOP request at tick: %i\n" , midifile.playing_tick );
 
   g_mutex_lock( amidiplug_playing_mutex );
-  if ( amidiplug_playing_status == AMIDIPLUG_ERR )
-    is_error = TRUE;
-  g_mutex_unlock( amidiplug_playing_mutex );
-  
-  if ( !is_error )
-  {
-    /* if stop wasn't called due to error condition,
-       wait until the play thread reach a 'safe state'
-       (that is, when amidiplug_play_thread exists) */
-    while ( !amidiplug_play_thread )
-      g_usleep( 20000 );
-  }
-
-  g_mutex_lock( amidiplug_playing_mutex );
   amidiplug_playing_status = AMIDIPLUG_STOP;
   g_cond_signal( amidiplug_pause_cond );
   g_mutex_unlock( amidiplug_playing_mutex );
@@ -476,6 +461,7 @@
       amidiplug_playing_status = AMIDIPLUG_PLAY;
       g_mutex_unlock( amidiplug_playing_mutex );
       amidiplug_play_thread = g_thread_self();
+      playback->set_pb_ready(playback);
       amidiplug_play_loop(playback);
       break;
     }
--- a/src/cdaudio-ng/cdaudio-ng.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/cdaudio-ng/cdaudio-ng.c	Fri Aug 10 22:00:07 2007 +0200
@@ -513,6 +513,7 @@
 		pdae_params->seektime = -1;
 		pdae_params->currlsn = trackinfo[trackno].startlsn;
 		pdae_params->thread = g_thread_self();
+		pinputplayback->set_pb_ready(pinputplayback);
 		dae_play_loop(pdae_params);
 	}
 	else {
--- a/src/console/Audacious_Driver.cxx	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/console/Audacious_Driver.cxx	Fri Aug 10 22:00:07 2007 +0200
@@ -405,6 +405,7 @@
 	pending_seek = -1;
 	console_ip_is_going = 1;
 	decode_thread = g_thread_self();
+	playback->set_pb_ready(playback);
         play_loop_track( playback );
 }
 
--- a/src/cue/cuesheet.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/cue/cuesheet.c	Fri Aug 10 22:00:07 2007 +0200
@@ -218,6 +218,7 @@
 		return;
 	}
 	play_thread = g_thread_self();
+	data->set_pb_ready(data);
 	play_cue_uri(data, uri);
 }
 
--- a/src/flacng/plugin.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/flacng/plugin.c	Fri Aug 10 22:00:07 2007 +0200
@@ -578,6 +578,7 @@
     flac_ip.set_info(get_title(input->filename, main_info), l, -1, main_info->stream.samplerate, main_info->stream.channels);
 
     thread = g_thread_self();
+    input->set_pb_ready(input);
     flac_play_loop(input);
 
     _LEAVE;
--- a/src/madplug/plugin.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/madplug/plugin.c	Fri Aug 10 22:00:07 2007 +0200
@@ -469,6 +469,7 @@
     g_mutex_unlock(pb_mutex);
 
     decode_thread = g_thread_self();
+    playback->set_pb_ready(playback);
     decode_loop(&info);
 }
 
--- a/src/metronom/metronom.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/metronom/metronom.c	Fri Aug 10 22:00:07 2007 +0200
@@ -199,6 +199,7 @@
 	g_free(name);
 	playback->data = pmetronom;
 	play_thread = g_thread_self();
+	playback->set_pb_ready(playback);
 	play_loop(playback);
 }
 
--- a/src/modplug/modplugbmp.cxx	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/modplug/modplugbmp.cxx	Fri Aug 10 22:00:07 2007 +0200
@@ -312,7 +312,7 @@
 	mStopped = true;
 }
 
-void ModplugXMMS::PlayFile(const string& aFilename)
+void ModplugXMMS::PlayFile(const string& aFilename, InputPlayback *ipb)
 {
 	mStopped = true;
 	mPaused = false;
@@ -446,6 +446,7 @@
 	);
 
 	mDecodeThread = g_thread_self();
+	ipb->set_pb_ready(ipb);
 	this->PlayLoop();
 }
 
--- a/src/modplug/modplugbmp.h	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/modplug/modplugbmp.h	Fri Aug 10 22:00:07 2007 +0200
@@ -88,7 +88,7 @@
 
 	void CloseConfigureBox();
 
-	void PlayFile(const string& aFilename);// Play the file.
+	void PlayFile(const string& aFilename, InputPlayback *data);// Play the file.
 	void Stop();                       // Stop playing.
 	void Pause(bool aPaused);              // Pause or unpause.
 
--- a/src/modplug/plugin.cxx	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/modplug/plugin.cxx	Fri Aug 10 22:00:07 2007 +0200
@@ -27,7 +27,7 @@
 {
         char* aFilename = data->filename;
 	gModplugXMMS.SetOutputPlugin(*data->output);
-	gModplugXMMS.PlayFile(aFilename);
+	gModplugXMMS.PlayFile(aFilename, data);
 }
 
 static void Stop(InputPlayback *data)
--- a/src/musepack/libmpc.cxx	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/musepack/libmpc.cxx	Fri Aug 10 22:00:07 2007 +0200
@@ -305,6 +305,7 @@
     mpcDecoder.isOutput = false;
     mpcDecoder.isPause  = false;
     threadHandle = g_thread_self();
+    data->set_pb_ready(data);
     decodeStream((void *) g_strdup(data->filename));
 }
 
--- a/src/sexypsf/plugin.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/sexypsf/plugin.c	Fri Aug 10 22:00:07 2007 +0200
@@ -159,6 +159,7 @@
 
         playing = 1;
         dethread = g_thread_self();
+        data->set_pb_ready(data);
         sexypsf_playloop(NULL);
     }
 }
--- a/src/sid/xmms-sid.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/sid/xmms-sid.c	Fri Aug 10 22:00:07 2007 +0200
@@ -572,6 +572,7 @@
 
 	/* Start the playing thread! */
 	xs_decode_thread = g_thread_self();
+	pb->set_pb_ready(pb);
 	xs_playthread(pb);
 
 	XSDEBUG("playback is done\n");
--- a/src/timidity/src/xmms-timidity.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/timidity/src/xmms-timidity.c	Fri Aug 10 22:00:07 2007 +0200
@@ -375,6 +375,7 @@
 	xmmstimid_seek_to = -1;
 
 	xmmstimid_decode_thread = g_thread_self();
+	playback->set_pb_ready(playback);
 	xmmstimid_play_loop(playback);
 }
 
--- a/src/tonegen/tonegen.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/tonegen/tonegen.c	Fri Aug 10 22:00:07 2007 +0200
@@ -202,6 +202,7 @@
 	g_free(name);
 	playback->data = frequencies;
 	play_thread = g_thread_self();
+	playback->set_pb_ready(playback);
 	play_loop(playback);
 }
 
--- a/src/tta/libtta.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/tta/libtta.c	Fri Aug 10 22:00:07 2007 +0200
@@ -521,6 +521,7 @@
 	read_samples = -1;
 
 	decode_thread = g_thread_self();
+	playback->set_pb_ready(playback);
 	play_loop(playback);
 }
 
--- a/src/vorbis/vorbis.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/vorbis/vorbis.c	Fri Aug 10 22:00:07 2007 +0200
@@ -571,6 +571,7 @@
     playback->error = FALSE;
 
     thread = g_thread_self();
+    playback->set_pb_ready(playback);
     vorbis_play_loop(playback);
 }
 
--- a/src/vtx/vtx.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/vtx/vtx.c	Fri Aug 10 22:00:07 2007 +0200
@@ -245,6 +245,7 @@
 
       playback->playing = TRUE;
       play_thread = g_thread_self();
+      playback->set_pb_ready(playback);
       play_loop(playback);
     }
 }
--- a/src/wav/wav.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/wav/wav.c	Fri Aug 10 22:00:07 2007 +0200
@@ -424,6 +424,7 @@
         g_free(name);
         wav_file->seek_to = -1;
         decode_thread = g_thread_self();
+        playback->set_pb_ready(playback);
         play_loop(playback);
     }
 }
--- a/src/wavpack/libwavpack.cxx	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/wavpack/libwavpack.cxx	Fri Aug 10 22:00:07 2007 +0200
@@ -352,6 +352,7 @@
     killDecodeThread = false;
     AudioError = false;
     thread_handle = g_thread_self();
+    data->set_pb_ready(data);
     DecodeThread((void *) data->filename);
     return;
 }
--- a/src/wma/wma.c	Fri Aug 10 12:42:07 2007 -0500
+++ b/src/wma/wma.c	Fri Aug 10 22:00:07 2007 +0200
@@ -433,6 +433,7 @@
     wma_decode = 1;
     playback->playing = 1;
     wma_decode_thread = g_thread_self();
+    playback->set_pb_ready(playback);
     wma_play_loop(playback);
 }