[pitivi] Change getDuration and getPosition as the pipeline.query* don't return the same



commit 570e213dd2fb0aa74ee62e200913bc6acc2795da
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date:   Fri Aug 10 08:56:10 2012 +0200

    Change getDuration and getPosition as the pipeline.query* don't return the same

 pitivi/utils/pipeline.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 72fcf43..ef08f97 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -268,11 +268,14 @@ class SimplePipeline(Loggable, Signallable):
         """
         self.log("format %r" % format)
         try:
-            cur, format = self._pipeline.query_position(format)
+            res, cur = self._pipeline.query_position(format)
         except Exception, e:
             self.handleException(e)
             raise PipelineError("Couldn't get position")
 
+        if not res:
+            raise PipelineError("Couldn't get position")
+
         self.log("Got position %s" % gst.TIME_ARGS(cur))
         return cur
 
@@ -282,12 +285,15 @@ class SimplePipeline(Loggable, Signallable):
         """
         self.log("format %r" % format)
         try:
-            dur, format = self._pipeline.query_duration(format)
+            res, dur = self._pipeline.query_duration(format)
         except Exception, e:
 
             self.handleException(e)
             raise PipelineError("Couldn't get duration")
 
+        if not res:
+            raise PipelineError("Couldn't get duration")
+
         self.log("Got duration %s" % gst.TIME_ARGS(dur))
         if self._duration != dur:
             self.emit("duration-changed", dur)



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