vidi/Timeline.py: move pipeline player initialization to the __init__ method
authorAntonio Ospite <ao2@ao2.it>
Mon, 28 Nov 2016 12:32:17 +0000 (13:32 +0100)
committerAntonio Ospite <ao2@ao2.it>
Mon, 28 Nov 2016 12:32:17 +0000 (13:32 +0100)
vidi/Timeline.py

index 43bb9c9..c1e9698 100755 (executable)
@@ -43,6 +43,10 @@ class Timeline(object):
 
         self.layer = self.timeline.append_layer()
 
 
         self.layer = self.timeline.append_layer()
 
+        ges_pipeline = GES.Pipeline()
+        ges_pipeline.set_timeline(self.timeline)
+        self.player = Player(ges_pipeline)
+
     def add_clip(self, clip_path, start_time, duration):
         clip_uri = Gst.filename_to_uri(clip_path)
         asset = GES.UriClipAsset.request_sync(clip_uri)
     def add_clip(self, clip_path, start_time, duration):
         clip_uri = Gst.filename_to_uri(clip_path)
         asset = GES.UriClipAsset.request_sync(clip_uri)
@@ -51,10 +55,7 @@ class Timeline(object):
 
     def play(self):
         self.timeline.commit()
 
     def play(self):
         self.timeline.commit()
-
-        ges_pipeline = GES.Pipeline()
-        ges_pipeline.set_timeline(self.timeline)
-        Player(ges_pipeline).play()
+        self.player.play()
 
     def save(self, path):
         uri = Gst.filename_to_uri(path)
 
     def save(self, path):
         uri = Gst.filename_to_uri(path)