Hi folks,
I have noticed a fair few posts on combining wxPython with GStreamer,
so hopefully someone on here can help me out.
I am having trouble combining the wx.App.MainLoop() and the GStreamer
event system. Only taking code from the GStreamer tutorial (
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html ), I typically
have something like this in my code:
<inside class>
self.bus = self.player.get_bus()
self.bus.add_signal_watch()
self.bus.enable_sync_message_emission()
self.bus.connect("message", self.on_message)
self.bus.glib.threads_init()
def on_message(self, bus, message):
t = message.type
print t
if t == gst.MESSAGE_EOS: # track is finished
self.player.set_state(gst.STATE_NULL)
elif t == gst.MESSAGE_ERROR:
self.player.set_state(gst.STATE_NULL)
err, debug = message.parse_error()
print "Error: %s" % err, debug
Now, if I run the wx.App.MainLoop() first, I can't get to the
gst.events and if I run the gobject.Mainloop(), the GUI doesn't show
(obviously). I am still new to this, so I would be glad if one of you
could nudge me into the right direction. So far I have tried to use
threads of any kind with no luck (which does not necessarily mean I
used the threads correctly in the first place) and I did some research
and the best I could come up with were the following links:
http://stackoverflow.com/questions/815255/using-threads-and-pygst-in-a-wx-python-app
http://www.jejik.com/articles/2007/01/python-gstreamer_threading_and_the_main_loop/
but unfortunately, I do not understand, how this helps me with my two
mainloops problem. Now if this is at all possible, I am very grateful
for any help, you guys can offer.
Thanks a lot,