[pitivi] pipeline: Emit 'position' on ASYNC done
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pipeline: Emit 'position' on ASYNC done
- Date: Sat, 20 Jun 2015 08:53:53 +0000 (UTC)
commit 7a88a97474e376b98719b592f3efac142bde6e20
Author: Thibault Saunier <tsaunier gnome org>
Date: Tue Jun 16 21:27:16 2015 +0200
pipeline: Emit 'position' on ASYNC done
pitivi/utils/pipeline.py | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 55bf109..c4c2df5 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -286,18 +286,6 @@ class SimplePipeline(GObject.Object, Loggable):
"""
self.setState(Gst.State.PAUSED)
- # When the pipeline has been paused we need to update the
- # timeline/playhead position, as the 'position' signal
- # is only emitted every 300ms and the playhead jumps
- # during the playback.
- try:
- position = self.getPosition()
- except PipelineError as e:
- self.warning("Getting the position failed: %s", e)
- return
- if position != Gst.CLOCK_TIME_NONE and position >= 0:
- self.emit("position", position)
-
def stop(self):
"""
Sets the L{Pipeline} to READY
@@ -509,6 +497,7 @@ class SimplePipeline(GObject.Object, Loggable):
self._recovery_state = self.RecoveryState.NOT_RECOVERING
self._attempted_recoveries = 0
self._waiting_for_async_done = False
+ self.__emitPosition()
if self._next_seek is not None:
self.simple_seek(self._next_seek)
self._next_seek = None
@@ -516,6 +505,22 @@ class SimplePipeline(GObject.Object, Loggable):
else:
self.log("%s [%r]", message.type, message.src)
+ def __emitPosition(self):
+ # When the pipeline has been paused we need to update the
+ # timeline/playhead position, as the 'position' signal
+ # is only emitted every 300ms and the playhead jumps
+ # during the playback.
+ try:
+ position = self.getPosition()
+ except PipelineError as e:
+ self.warning("Getting the position failed: %s", e)
+ return None
+
+ if position != Gst.CLOCK_TIME_NONE and position >= 0:
+ self.emit("position", position)
+
+ return position
+
@property
def _waiting_for_async_done(self):
return self.__waiting_for_async_done
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]