X-Git-Url: https://git.slaskete.net/python-gstreamer-examples/blobdiff_plain/f61c6e101a8ccc6559c475b33d2fa0a7ba0a96ba..e54cedc5dd480d947f7051b50184f4bb355a841b:/example3.py diff --git a/example3.py b/example3.py index f5af59b..3ee0eb5 100755 --- a/example3.py +++ b/example3.py @@ -13,12 +13,12 @@ import signal class Main: def __init__(self): - + # Create gui bits and bobs self.mainwindow = Gtk.Builder() self.mainwindow.add_from_file("example3.glade") - + signals = { "on_play_clicked" : self.OnPlay, "on_stop_clicked" : self.OnStop, @@ -37,12 +37,12 @@ class Main: self.videotestsrc = Gst.ElementFactory.make("videotestsrc", "videosource") self.videotestsrc.set_property("pattern", "snow") self.pipeline.add(self.videotestsrc) - + # Add a capsfilter that we want to apply to our videotestsrc self.videotestcaps = Gst.ElementFactory.make("capsfilter", "videotestcaps") self.videotestcaps.set_property("caps",Gst.Caps.from_string("video/x-raw,width=640,height=480")) self.pipeline.add(self.videotestcaps) - + # Link the capsfilter to the videotestsrc self.videotestsrc.link(self.videotestcaps) @@ -52,17 +52,17 @@ class Main: # Link the already linked videotestcaps to the sink self.videotestcaps.link(self.videosink) - + # Set up a bus to our pipeline to get notified when the video is ready self.bus = self.pipeline.get_bus() self.bus.enable_sync_message_emission() self.bus.connect("sync-message::element", self.OnSyncElement) - + # Summon the window and connect the window's close button to quit self.window = self.mainwindow.get_object("mainwindow") self.window.connect("delete-event", Gtk.main_quit) self.window.show_all() - + # Get window ID of the viewport widget from the GUI self.win_id = self.mainwindow.get_object("viewport").get_window().get_xid() @@ -81,7 +81,7 @@ class Main: def OnStop(self, widget): print("stop") self.pipeline.set_state(Gst.State.READY) - + def OnQuit(self, widget): print("quit") Gtk.main_quit()