changeset 3000:b13c904dcd40

Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
author Tony Vroon <chainsaw@gentoo.org>
date Wed, 04 Mar 2009 12:48:43 +0000
parents e2e8f927a08a
children b2bc9ea8c99d
files src/vorbis/vorbis.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/vorbis/vorbis.c	Wed Mar 04 12:48:20 2009 +0000
+++ b/src/vorbis/vorbis.c	Wed Mar 04 12:48:43 2009 +0000
@@ -120,6 +120,7 @@
 
 static GThread *thread;
 static volatile int seekneeded = -1;
+static volatile char pause_flag;
 static int samplerate, channels;
 GMutex *vf_mutex;
 
@@ -228,6 +229,16 @@
     }
 }
 
+static void do_pause (InputPlayback * playback) {
+   playback->output->pause (1);
+   while (pause_flag) {
+      if (seekneeded != -1)
+         do_seek (playback);
+      g_usleep(50000);
+   }
+   playback->output->pause (0);
+}
+
 #define PCM_FRAMES 1024
 #define PCM_BUFSIZE PCM_FRAMES*2
 
@@ -338,6 +349,8 @@
 
         if (seekneeded != -1)
             do_seek(playback);
+        if (pause_flag)
+            do_pause (playback);
 
         
         int current_section = last_section;
@@ -488,7 +501,7 @@
 static void
 vorbis_pause(InputPlayback *playback, short p)
 {
-    playback->output->pause(p);
+    pause_flag = p;
 }
 
 static void