mirror of
https://github.com/matthew1000/gstreamer-cheat-sheet.git
synced 2024-11-22 00:10:59 +00:00
Tidy up and first python example
This commit is contained in:
parent
eb221ec9d1
commit
48a3a3530a
1 changed files with 21 additions and 0 deletions
21
python_examples/playbin.py
Normal file
21
python_examples/playbin.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Make sure the environment variable SRC is set to a playable file
|
||||||
|
# e.g.
|
||||||
|
# export SRC='/tmp/me.mp4'
|
||||||
|
#
|
||||||
|
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gst', '1.0')
|
||||||
|
from gi.repository import GObject, Gst
|
||||||
|
import os
|
||||||
|
|
||||||
|
Gst.init()
|
||||||
|
mainloop = GObject.MainLoop()
|
||||||
|
|
||||||
|
pl = Gst.ElementFactory.make("playbin", "player")
|
||||||
|
pl.set_property('uri','file://'+os.environ['SRC'])
|
||||||
|
|
||||||
|
#running the playbin
|
||||||
|
pl.set_state(Gst.State.PLAYING)
|
||||||
|
mainloop.run()
|
Loading…
Reference in a new issue