X-Git-Url: https://git.ao2.it/vidi-player.git/blobdiff_plain/81266999b597eeac96b846034444f4b240da72bb..f778b0ade9ac49e0deab3f694c7e4a0905388f1b:/vidi/Timeline.py diff --git a/vidi/Timeline.py b/vidi/Timeline.py index 48c6181..59c891a 100755 --- a/vidi/Timeline.py +++ b/vidi/Timeline.py @@ -43,17 +43,31 @@ class Timeline(object): self.layer = self.timeline.append_layer() - def add_clip(self, clip_uri, start_time, duration): + 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) self.layer.add_asset(asset, start_time * Gst.SECOND, 0, duration * Gst.SECOND, GES.TrackType.UNKNOWN) + def add_layer_clip(self, clip_path, start_time, duration): + """Add a clip on its own layer""" + clip_uri = Gst.filename_to_uri(clip_path) + asset = GES.UriClipAsset.request_sync(clip_uri) + new_layer = self.timeline.append_layer() + new_layer.add_asset(asset, start_time * Gst.SECOND, 0, + duration * Gst.SECOND, GES.TrackType.UNKNOWN) + def play(self): self.timeline.commit() + self.player.play() - ges_pipeline = GES.Pipeline() - ges_pipeline.set_timeline(self.timeline) - Player(ges_pipeline).play() + def stop(self): + self.player.stop() - def save(self, uri): + def save(self, path): + uri = Gst.filename_to_uri(path) self.project.save(self.timeline, uri, None, False)