projects
/
experiments
/
gstreamer.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
python: update python examples to modern python, Gst, and Glib versions
[experiments/gstreamer.git]
/
python
/
gst-test-perspective.py
diff --git
a/python/gst-test-perspective.py
b/python/gst-test-perspective.py
index
1b094c2
..
e40217d
100755
(executable)
--- a/
python/gst-test-perspective.py
+++ b/
python/gst-test-perspective.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
# test program for the "perspective" geometric transform element
# test program for the "perspective" geometric transform element
@@
-11,8
+11,8
@@
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
from gi.repository import Gst
Gst.init(None)
+from gi.repository import GLib
from gi.repository import GObject
from gi.repository import GObject
-GObject.threads_init()
def calc_matrix():
def calc_matrix():
@@
-57,15
+57,18
@@
def main():
perspective = Gst.ElementFactory.make("perspective", None)
pipeline.add(perspective)
perspective = Gst.ElementFactory.make("perspective", None)
pipeline.add(perspective)
- print
perspective.get_property("matrix"
)
+ print
(perspective.get_property("matrix")
)
M = calc_rotation_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])
# 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)
videoconvert = Gst.ElementFactory.make("autovideoconvert", None)
pipeline.add(videoconvert)
@@
-82,7
+85,7
@@
def main():
pipeline.set_state(Gst.State.PLAYING)
pipeline.set_state(Gst.State.PLAYING)
- loop = G
Object
.MainLoop()
+ loop = G
Lib
.MainLoop()
loop.run()
loop.run()