git.slaskete.net
/
python-gstreamer-examples
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Lots of patches to work with most recent python3/GTK/Gst
[python-gstreamer-examples]
/
example3.py
diff --git
a/example3.py
b/example3.py
index dd99993b96d8ee0318eb381ab7ce2c1f58157e6f..f5af59b29b05e6d6915fa254bb72e1deac1a9cce 100755
(executable)
--- a/
example3.py
+++ b/
example3.py
@@
-4,6
+4,10
@@
# http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-1.0
# GdkX11 to get access to xid, GstVideo to get access to set_window_handle
# http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-1.0
# GdkX11 to get access to xid, GstVideo to get access to set_window_handle
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version('Gst', '1.0')
+gi.require_version('GstVideo', '1.0')
from gi.repository import Gtk, Gst, GdkX11, GstVideo
import signal
from gi.repository import Gtk, Gst, GdkX11, GstVideo
import signal
@@
-27,7
+31,7
@@
class Main:
# Initiate the pipeline
Gst.init(None)
# Initiate the pipeline
Gst.init(None)
- self.pipeline = Gst.Pipeline(
"mypipeline"
)
+ self.pipeline = Gst.Pipeline()
# Add a videotestsrc element to the pipeline, set it to pattern "snow."
self.videotestsrc = Gst.ElementFactory.make("videotestsrc", "videosource")
# Add a videotestsrc element to the pipeline, set it to pattern "snow."
self.videotestsrc = Gst.ElementFactory.make("videotestsrc", "videosource")
@@
-63,23
+67,23
@@
class Main:
self.win_id = self.mainwindow.get_object("viewport").get_window().get_xid()
self.win_id = self.mainwindow.get_object("viewport").get_window().get_xid()
- # When we get a message that video is ready to display, set the
+ # When we get a message that video is ready to display, set the
# correct window id to hook it to our viewport
def OnSyncElement(self, bus, message):
if message.get_structure().get_name() == "prepare-window-handle":
# correct window id to hook it to our viewport
def OnSyncElement(self, bus, message):
if message.get_structure().get_name() == "prepare-window-handle":
- print
"prepare-window-handle"
+ print
("prepare-window-handle")
message.src.set_window_handle(self.win_id)
def OnPlay(self, widget):
message.src.set_window_handle(self.win_id)
def OnPlay(self, widget):
- print
"play"
+ print
("play")
self.pipeline.set_state(Gst.State.PLAYING)
def OnStop(self, widget):
self.pipeline.set_state(Gst.State.PLAYING)
def OnStop(self, widget):
- print
"stop"
+ print
("stop")
self.pipeline.set_state(Gst.State.READY)
def OnQuit(self, widget):
self.pipeline.set_state(Gst.State.READY)
def OnQuit(self, widget):
- print
"quit"
+ print
("quit")
Gtk.main_quit()
# Workaround to get Ctrl+C to terminate from command line
Gtk.main_quit()
# Workaround to get Ctrl+C to terminate from command line