[pitivi] utils/pipeline: Save the position of the last compressed seek



commit 9067227541f20628066b8f6bbcebe8ad991570bb
Author: Luis de Bethencourt <luis debethencourt com>
Date:   Mon Sep 16 13:06:03 2013 -0400

    utils/pipeline: Save the position of the last compressed seek
    
    This ensures we actually seek to the correct position, the one requested last.

 pitivi/utils/pipeline.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 58ce0cb..7050a6a 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -73,6 +73,7 @@ class Seeker(Signallable, Loggable):
         self.position = None
         self.format = None
         self._time = None
+        self.pending_position = None
 
     def seek(self, position, format=Gst.Format.TIME, on_idle=False):
         self.format = format
@@ -83,6 +84,8 @@ class Seeker(Signallable, Loggable):
                 self.pending_seek_id = self._scheduleSeek(self.timeout, self._seekTimeoutCb)
             else:
                 self._seekTimeoutCb()
+        else:
+            self.pending_position = position
 
     def seekRelative(self, time, on_idle=False):
         if self.pending_seek_id is None:
@@ -100,6 +103,7 @@ class Seeker(Signallable, Loggable):
 
     def _seekTimeoutCb(self, relative=False):
         self.pending_seek_id = None
+
         if relative:
             try:
                 self.emit('seek-relative', self._time)
@@ -121,6 +125,11 @@ class Seeker(Signallable, Loggable):
                 # if an exception happened while seeking, properly
                 # reset ourselves
                 return False
+
+        if self.pending_position:
+            self.seek(self.pending_position, on_idle=True)
+            self.pending_position = None
+
         return False
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]