[pitivi] validate: Listen to pipeline position in PAUSED when running scenarios



commit d127eb61bde6573ed4803afa08f89f43abb5ad8b
Author: Thibault Saunier <tsaunier gnome org>
Date:   Wed Dec 10 20:39:17 2014 +0100

    validate: Listen to pipeline position in PAUSED when running scenarios
    
    So that we can see precisely what seek action are being executed

 pitivi/project.py        |    5 +++++
 pitivi/utils/pipeline.py |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index ca19128..ea362ac 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -781,6 +781,9 @@ class Project(Loggable, GES.Project):
         self._acodecsettings_cache = {}
         self._has_rendering_values = False
 
+    def _scenarioDoneCb(self, scenario):
+        self.pipeline.setForcePositionListener(False)
+
     def setupValidateScenario(self):
         from gi.repository import GstValidate
 
@@ -790,6 +793,8 @@ class Project(Loggable, GES.Project):
             self.pipeline, self.runner, None)
         self._scenario = GstValidate.Scenario.factory_create(
             self.runner, self.pipeline, self.scenario)
+        self.pipeline.setForcePositionListener(True)
+        self._scenario.connect("done", self._scenarioDoneCb)
 
     # --------------- #
     # Our properties  #
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 6dcd498..f53f9fa 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -191,6 +191,7 @@ class SimplePipeline(GObject.Object, Loggable):
         self._waiting_for_async_done = False
         self._next_seek = None
         self._timeout_async_id = 0
+        self._force_position_listener = False
 
         # Create a cluttersink element used for display. Subclasses must connect
         # it to self._pipeline themselves
@@ -200,6 +201,9 @@ class SimplePipeline(GObject.Object, Loggable):
         else:
             self._pipeline.set_property("video_sink", self.video_sink)
 
+    def setForcePositionListener(self, force):
+        self._force_position_listener = force
+
     def release(self):
         """
         Release the L{Pipeline} and all used L{ObjectFactory} and
@@ -357,7 +361,7 @@ class SimplePipeline(GObject.Object, Loggable):
             return True
         self._listening = True
         self._listeningInterval = interval
-        # if we're in paused or playing, switch it on
+        # if we're in playing, switch it on
         self._listenToPosition(self.getState() == Gst.State.PLAYING)
         return True
 
@@ -482,10 +486,11 @@ class SimplePipeline(GObject.Object, Loggable):
                             self.simple_seek(self._last_position)
                             self.info(
                                 "Seeked back to the last position after pipeline recovery")
+                    self._listenToPosition(self._force_position_listener)
                 elif prev == Gst.State.PAUSED and new == Gst.State.PLAYING:
                     self._listenToPosition(True)
                 elif prev == Gst.State.PLAYING and new == Gst.State.PAUSED:
-                    self._listenToPosition(False)
+                    self._listenToPosition(self._force_position_listener)
 
                 if emit_state_change:
                     self.emit('state-change', new, prev)


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