[pitivi] pipeline: clamp seek values between [0, duration]



commit 2bcb56552ae098190aef2aa5ac1fb5847d358f68
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri May 15 15:33:32 2009 -0700

    pipeline: clamp seek values between [0, duration]
---
 pitivi/pipeline.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pitivi/pipeline.py b/pitivi/pipeline.py
index 77a8217..3c27164 100644
--- a/pitivi/pipeline.py
+++ b/pitivi/pipeline.py
@@ -403,6 +403,10 @@ class Pipeline(Signallable, Loggable):
         # FIXME : temporarily deactivate position listener
         #self._listenToPosition(False)
 
+        # clamp between [0, duration]
+        if format==gst.FORMAT_TIME:
+            position = max(0, min(position, self.getDuration()))
+
         res = self._pipeline.seek(1.0, format, gst.SEEK_FLAG_FLUSH,
                                   gst.SEEK_TYPE_SET, position,
                                   gst.SEEK_TYPE_NONE, -1)



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