changeset 2997:73ae33c89dc6

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:46:05 +0000
parents b7c181d0b325
children fc666525b410
files src/aac/libmp4.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/aac/libmp4.c	Wed Mar 04 12:45:16 2009 +0000
+++ b/src/aac/libmp4.c	Wed Mar 04 12:46:05 2009 +0000
@@ -76,6 +76,7 @@
 static GThread   *decodeThread;
 GStaticMutex     mutex = G_STATIC_MUTEX_INIT;
 static int       seekPosition = -1;
+static volatile char pause_flag;
 
 void getMP4info(char*);
 int getAACTrack(mp4ff_t *);
@@ -100,6 +101,7 @@
 {
     mp4cfg.file_type = FILE_UNKNOWN;
     seekPosition = -1;
+    pause_flag = 0;
     return;
 }
 
@@ -296,7 +298,7 @@
 
 static void mp4_pause(InputPlayback *playback, short flag)
 {
-    playback->output->pause(flag);
+   pause_flag = flag;
 }
 
 static void mp4_seek(InputPlayback *data, int time)
@@ -542,6 +544,19 @@
             seekPosition = -1;
         }
 
+        if (pause_flag) {
+           playback->output->pause (1);
+           while (pause_flag) {
+              if (seekPosition != -1) {
+                 playback->output->flush (seekPosition * 1000);
+                 sampleID = (long long) seekPosition * samplerate / (framesize - 1);
+                 seekPosition = -1;
+              }
+              g_usleep(50000);
+           }
+           playback->output->pause (0);
+        }
+
         /* Otherwise continue playing */
         buffer=NULL;
         bufferSize=0;