[pitivi] pipeline: Remove the _timeline field



commit 7acd33c5ba8d99684eb52c2577d861e118829146
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Dec 13 14:48:39 2016 +0100

    pipeline: Remove the _timeline field
    
    The timeline is available as props.timeline.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1552

 pitivi/project.py        |    6 ++----
 pitivi/utils/pipeline.py |   28 +++++++++-------------------
 2 files changed, 11 insertions(+), 23 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 7e1f0dc..060bd5f 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1237,10 +1237,8 @@ class Project(Loggable, GES.Project):
 
         self.ges_timeline.commit = self._commit
         self.pipeline = Pipeline(self.app)
-        try:
-            self.pipeline.set_timeline(self.ges_timeline)
-        except PipelineError as e:
-            self.warning("Failed to set the pipeline's timeline: %s", e)
+        if not self.pipeline.set_timeline(self.ges_timeline):
+            self.warning("Failed to set the pipeline's timeline: %s", self.ges_timeline)
             return False
 
         return True
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 5c8f7b6..323aeb2 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -494,8 +494,8 @@ class AssetPipeline(SimplePipeline):
     """Pipeline for playing a single clip."""
 
     def __init__(self, clip=None, name=None):
-        bPipeline = Gst.ElementFactory.make("playbin", name)
-        SimplePipeline.__init__(self, bPipeline)
+        ges_pipeline = Gst.ElementFactory.make("playbin", name)
+        SimplePipeline.__init__(self, ges_pipeline)
 
         self.create_sink()
 
@@ -525,8 +525,6 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         self._was_empty = False
         self._commit_wanted = False
 
-        self._timeline = None
-
         if "watchdog" in os.environ.get("PITIVI_UNSTABLE_FEATURES", ''):
             watchdog = Gst.ElementFactory.make("watchdog", None)
             if watchdog:
@@ -545,7 +543,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         return GES.Pipeline.set_mode(self, mode)
 
     def _getDuration(self):
-        return self._timeline.get_duration()
+        return self.props.timeline.get_duration()
 
     def do_change_state(self, state):
         if state == Gst.StateChange.PAUSED_TO_READY:
@@ -553,11 +551,6 @@ class Pipeline(GES.Pipeline, SimplePipeline):
 
         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")
-        self._timeline = timeline
-
     def stepFrame(self, framerate, frames_offset):
         """Seeks backwards or forwards the specified amount of frames.
 
@@ -587,7 +580,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         self.simple_seek(new_pos)
 
     def simple_seek(self, position):
-        if self._timeline.is_empty():
+        if self.props.timeline.is_empty():
             # Nowhere to seek.
             return
 
@@ -617,29 +610,26 @@ class Pipeline(GES.Pipeline, SimplePipeline):
                 self._commit_wanted:
             self.debug("Commiting now that ASYNC is DONE")
             self._addWaitingForAsyncDoneTimeout()
-            self._timeline.commit()
+            self.props.timeline.commit()
             self._commit_wanted = False
         else:
             SimplePipeline._busMessageCb(self, bus, message)
 
     def commit_timeline(self):
         if self._waiting_for_async_done and not self._was_empty\
-                and not self._timeline.is_empty():
+                and not self.props.timeline.is_empty():
             self._commit_wanted = True
             self._was_empty = False
             self.debug("commit wanted")
         else:
             self._addWaitingForAsyncDoneTimeout()
-            self._timeline.commit()
+            self.props.timeline.commit()
             self.debug("Commiting right now")
-            if self._timeline.is_empty():
-                self._was_empty = True
-            else:
-                self._was_empty = False
+            self._was_empty = self.props.timeline.is_empty()
 
     def setState(self, state):
         SimplePipeline.setState(self, state)
-        if state >= Gst.State.PAUSED and self._timeline.is_empty():
+        if state >= Gst.State.PAUSED and self.props.timeline.is_empty():
             self.debug("No ASYNC_DONE will be emited on empty timelines")
             self._was_empty = True
             self._removeWaitingForAsyncDoneTimeout()


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