gstreamer/bindings/python/examples/simple.py
2013-04-23 20:22:31 -03:00

31 lines
794 B
Python

from gi.repository import Gst, GES, GLib
class Simple:
def __init__(self, uri):
timeline = GES.Timeline()
trackv = GES.Track.video_raw_new()
layer = GES.Layer()
self.pipeline = GES.TimelinePipeline()
self.pipeline.add_timeline(timeline)
timeline.add_track(trackv)
timeline.add_layer(layer)
src = GES.UriClip.new(uri=uri)
src.set_start(long(0))
src.set_duration(long(10 * Gst.SECOND))
print src
layer.add_object(src)
def start(self):
self.pipeline.set_state(Gst.State.PLAYING)
if __name__ == "__main__":
if len(os.sys.argv) < 2:
print "You must specify a file URI"
exit(-1)
loop = GLib.MainLoop()
widget = Simple()
widget.start()
loop.run()