[pitivi: 4/6] ui/previewer: handle seek failures.



commit 9f8ab2ecddb897dd435d83a4f7a3ec3da4347e6a
Author: Alessandro Decina <alessandro d gmail com>
Date:   Fri Sep 10 16:08:01 2010 +0200

    ui/previewer: handle seek failures.

 pitivi/ui/previewer.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/previewer.py b/pitivi/ui/previewer.py
index 97c2e1e..22c9972 100644
--- a/pitivi/ui/previewer.py
+++ b/pitivi/ui/previewer.py
@@ -303,7 +303,9 @@ class RandomAccessPreviewer(Previewer):
         the next thumbnail in the queue. This should always be called from the
         main application thread."""
         if self._queue:
-            self._startThumbnail(self._queue[0])
+            if not self._startThumbnail(self._queue[0]):
+                self._queue.pop(0)
+                self._nextThumbnail()
         return False
 
     def _requestThumbnail(self, segment):
@@ -386,7 +388,7 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
 
     def _startThumbnail(self, timestamp):
         RandomAccessPreviewer._startThumbnail(self, timestamp)
-        self.videopipeline.seek(1.0,
+        return self.videopipeline.seek(1.0,
             gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE,
             gst.SEEK_TYPE_SET, timestamp,
             gst.SEEK_TYPE_NONE, -1)
@@ -453,13 +455,17 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
     def _startThumbnail(self, (timestamp, duration)):
         RandomAccessPreviewer._startThumbnail(self, (timestamp, duration))
         self._audio_cur = timestamp, duration
-        self.audioPipeline.seek(1.0,
+        res = self.audioPipeline.seek(1.0,
             gst.FORMAT_TIME,
             gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE | gst.SEEK_FLAG_SEGMENT,
             gst.SEEK_TYPE_SET, timestamp,
             gst.SEEK_TYPE_SET, timestamp + duration)
+        if not res:
+            self.warning("seek failed %s", timestamp)
         self.audioPipeline.set_state(gst.STATE_PLAYING)
 
+        return res
+
     def _finishWaveform(self):
         surfaces = []
         surface = cairo.ImageSurface(cairo.FORMAT_A8,



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