From: Antonio Ospite Date: Wed, 7 Dec 2016 16:01:02 +0000 (+0100) Subject: vidi/Timeline.py: support setting the canvas size X-Git-Url: https://git.ao2.it/vidi-player.git/commitdiff_plain/f74787f4bc5d288f0853000145e96d3a077c9c6a?ds=sidebyside vidi/Timeline.py: support setting the canvas size --- diff --git a/vidi/Timeline.py b/vidi/Timeline.py index da8e83c..ef04c99 100755 --- a/vidi/Timeline.py +++ b/vidi/Timeline.py @@ -35,13 +35,20 @@ TITLE_OUTLINE_COLOR = 0x00000000 TITLE_FONT_DESC = "Georgia, 24" class Timeline(object): - def __init__(self): + def __init__(self, canvas_size=None): self.project = GES.Project(extractable_type=GES.Timeline) self.timeline = GES.Asset.extract(self.project) audio_track = GES.AudioTrack.new() video_track = GES.VideoTrack.new() + if canvas_size: + width, height = canvas_size + caps = Gst.Caps.new_empty_simple("video/x-raw") + caps.set_value("width", width) + caps.set_value("height", height) + video_track.set_restriction_caps(caps) + self.timeline.add_track(audio_track) self.timeline.add_track(video_track)