[pitivi/ges] viewer: Preview the clips being trimmed



commit e8e7296d9b7a29e729f462fdba8e9134ac87c2d7
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Mon Mar 5 16:41:29 2012 -0500

    viewer: Preview the clips being trimmed

 pitivi/viewer.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index f29bbcd..f86e395 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -89,6 +89,7 @@ class PitiviViewer(gtk.VBox, Loggable):
 
         self.action = action
         self.pipeline = None
+        self._tmp_pipeline = None  # Used for displaying a preview when trimming
 
         self.sink = None
         self.docked = True
@@ -481,6 +482,23 @@ class PitiviViewer(gtk.VBox, Loggable):
         self.positionCheck()
         return self.currentState != gst.STATE_PAUSED
 
+    def clipTrimPreview(self, clip_uri, position):
+        """
+        While a clip is being trimmed, show a live preview of it.
+        """
+        if not self._tmp_pipeline:
+            self._tmp_pipeline = gst.element_factory_make("playbin2")
+            self._tmp_pipeline.set_property("uri", clip_uri)
+            self.setPipeline(self._tmp_pipeline)
+        self._tmp_pipeline.seek_simple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, position)
+
+    def clipTrimPreviewFinished(self):
+        """
+        After trimming a clip, reset the project pipeline into the viewer.
+        """
+        self._tmp_pipeline = None  # Free the memory
+        self.setPipeline(self.app.current.pipeline)
+
     def pipelineStateChanged(self, state):
         """
         When playback starts/stops, update the viewer widget,



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