changeset 666:a06edd6bfde6 trunk

[svn] - some further adjustments
author nenolod
date Sat, 17 Feb 2007 20:50:45 -0800
parents 86570de2f4e6
children 836cbe95ec5d
files ChangeLog src/wav/wav-sndfile.c
diffstat 2 files changed, 31 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 17 20:42:10 2007 -0800
+++ b/ChangeLog	Sat Feb 17 20:50:45 2007 -0800
@@ -1,3 +1,17 @@
+2007-02-18 04:42:10 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1416]
+  Rewrote the entire plugin:
+     - now uses conditional variables to ensure that sndfile mutex is
+       entirely protected.
+     - pausing works now
+     - fixed some potential race conditions when dealing with NFS.
+     - TITLE_LEN removed
+  
+  trunk/src/wav/wav-sndfile.c |  143 ++++++++++++++++++++++++++++++--------------
+  trunk/src/wav/wav-sndfile.h |    2 
+  2 files changed, 100 insertions(+), 45 deletions(-)
+
+
 2007-02-18 03:58:29 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1414]
   - wav-sndfile engine: correctly compute the bitrate
--- a/src/wav/wav-sndfile.c	Sat Feb 17 20:42:10 2007 -0800
+++ b/src/wav/wav-sndfile.c	Sat Feb 17 20:50:45 2007 -0800
@@ -147,8 +147,8 @@
 	int samples;
 	InputPlayback *playback = arg;
 
-	do
-	{
+	for (;;)
+ 	{
 		GTimeVal sleeptime;
 
 		g_get_current_time(&sleeptime);
@@ -199,21 +199,33 @@
 
 		/* Do seek if seek_time is valid. */
 		if (seek_time > 0)
-		{	sf_seek (sndfile, seek_time * sfinfo.samplerate, SEEK_SET);
+		{
+			sf_seek (sndfile, seek_time * sfinfo.samplerate, SEEK_SET);
 			playback->output->flush (seek_time * 1000);
 			seek_time = -1;
    		}
 
+		g_cond_timed_wait(decode_cond,
+			decode_mutex, &sleeptime);
+
+		if (playback->playing == FALSE)
+		{
+			g_mutex_unlock(decode_mutex);
+			break;	
+		}
+
 		g_mutex_unlock(decode_mutex);
-	} while (playback->playing == TRUE);
+	}
 
 	sf_close (sndfile);
 	sndfile = NULL;
 	seek_time = -1;
 
+	playback->output->close_audio();
+
 	g_thread_exit (NULL);
 	return NULL;
-} /* play_loop */
+}
 
 static void
 play_start (InputPlayback *playback)