[pitivi] Pipeline: Fix trimming preview
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Pipeline: Fix trimming preview
- Date: Thu, 7 Apr 2016 12:40:00 +0000 (UTC)
commit 111f57a5f3a99573bbca3d6535b5f9bba92fe778
Author: Thibault Saunier <tsaunier gnome org>
Date: Fri Apr 1 10:18:35 2016 +0200
Pipeline: Fix trimming preview
* Remove pipeline async timeout setting pipeline back to READY
* Never fail getting GESPipeline position when the goal is to trim the clip
because in that case using the _last_pipeline_position is more than
good enough
Otherwise while trimming the GES pipeline will end up time outing
pitivi/utils/pipeline.py | 19 +++++++++++--------
pitivi/viewer/viewer.py | 2 +-
pre-commit.hook | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 44e29e9..ca1a040 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -226,7 +226,7 @@ class SimplePipeline(GObject.Object, Loggable):
# Position and Seeking methods
- def getPosition(self, blocks=False):
+ def getPosition(self, fails=True):
"""
Get the current position of the L{Pipeline}.
@@ -234,12 +234,6 @@ class SimplePipeline(GObject.Object, Loggable):
@rtype: L{long}
@raise PipelineError: If the position couldn't be obtained.
"""
- maincontext = GLib.main_context_default()
- if blocks and self._recovery_state == self.RecoveryState.NOT_RECOVERING:
- while self._waiting_for_async_done and self._recovery_state == self.RecoveryState.NOT_RECOVERING:
- self.info("Iterating mainloop waiting for the pipeline to be ready to be queried")
- maincontext.iteration(True)
-
try:
res, cur = self._pipeline.query_position(Gst.Format.TIME)
except Exception as e:
@@ -247,7 +241,10 @@ class SimplePipeline(GObject.Object, Loggable):
raise PipelineError("Couldn't get position")
if not res:
- raise PipelineError("Position not available")
+ if fails:
+ raise PipelineError("Position not available")
+
+ cur = self._last_position
self.log("Got position %s", format_ns(cur))
return cur
@@ -566,6 +563,12 @@ class Pipeline(GES.Pipeline, SimplePipeline):
def _getDuration(self):
return self._timeline.get_duration()
+ def do_change_state(self, state):
+ if state == Gst.StateChange.PAUSED_TO_READY:
+ self._removeWaitingForAsyncDoneTimeout()
+
+ return GES.Pipeline.do_change_state(self, state)
+
def set_timeline(self, timeline):
if not GES.Pipeline.set_timeline(self, timeline):
raise PipelineError("Cannot set the timeline to the pipeline")
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index dce04fa..6a26fcf 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -434,7 +434,7 @@ class ViewerContainer(Gtk.Box, Loggable):
if self.pipeline == self.app.project_manager.current_project.pipeline:
self.debug("Creating temporary pipeline for clip %s, position %s",
clip_uri, format_ns(position))
- self._oldTimelinePos = self.pipeline.getPosition(True)
+ self._oldTimelinePos = self.pipeline.getPosition(False)
self.pipeline.set_state(Gst.State.NULL)
self.setPipeline(AssetPipeline(clip))
self.__owning_pipeline = True
diff --git a/pre-commit.hook b/pre-commit.hook
index d85126d..54062a1 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -54,7 +54,7 @@ pitivi/dialogs/filelisterrordialog.py \
pitivi/transitions.py \
pitivi/application.py \
pitivi/effects.py \
-pitivi/viewer.py \
+pitivi/viewer/viewer.py \
pitivi/clipproperties.py \
pitivi/timeline/timeline.py \
pitivi/timeline/layer.py \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]