-#!/usr/bin/env python
+#!/usr/bin/env python3
# test program for the "perspective" geometric transform element
from gi.repository import Gst
Gst.init(None)
+from gi.repository import GLib
from gi.repository import GObject
-GObject.threads_init()
def calc_matrix():
perspective = Gst.ElementFactory.make("perspective", None)
pipeline.add(perspective)
- print perspective.get_property("matrix")
+ print(perspective.get_property("matrix"))
M = calc_rotation_matrix()
- perspective.set_property("matrix", M)
- print perspective.get_property("matrix")
+ M2 = GObject.ValueArray()
+ for v in M:
+ M2.append(float(v))
+ perspective.set_property("matrix", M2)
+ print(perspective.get_property("matrix"))
# This should fail!
perspective.set_property("matrix", [0])
- print perspective.get_property("matrix")
+ print(perspective.get_property("matrix"))
videoconvert = Gst.ElementFactory.make("autovideoconvert", None)
pipeline.add(videoconvert)
pipeline.set_state(Gst.State.PLAYING)
- loop = GObject.MainLoop()
+ loop = GLib.MainLoop()
loop.run()