import sys
import gst
from glitch.gst import Video, VideoFileTexture
import glitch, glitch.gtk

if __name__ == '__main__':
    v = VideoFileTexture(path=sys.argv[1])

    pipeline = gst.Pipeline()
    pipeline.add(v.bin)
    pipeline.set_state(gst.STATE_PLAYING)

    camera = glitch.gtk.GtkCamera(eye=[0.5, 0.5, 1], ref=[0.5, 0.5, 0],
        children=[Video(v)])
    v.connect('new-buffer', lambda *args: camera.refresh())
    camera.run()
    v.stop()

