I have a video program that use gstreamer and wxwidgets. Before Ubuntu 9.10, the program works fine. But since I upgraded to 9.10 (or 10.04), it keeps getting crashes when trying to view video. The error is usually Fatal X11 IO error. I googled and found that GTK+ implementation is slightly changed in 9.10 and up and that caused the problem (from this thread https://bugzilla.gnome.org/show_bug.cgi?id=599885). It shows how to fixed the problem, but I don't see any GTK code in my code, so I'm not sure where I would put the gtk_window_ensure_native() method. My code essentially create a wxWindow and a wxPanel within it. Gstreamer is given the XID of the wxPanel to put the video in. I am a newbie when it comes to this stuff. Can someone help me fix this Fatal X11 error? Thanks.

Recommended Answers

All 4 Replies

No Code, No Help! (NCNH :D)
It's not a conceptual problem, it's from your code, and as long as you don't provide us the code, we can not help you.

Good luck!

Ah sorry, did not realize there's a NCNH policy :) Well the program is pretty long. I'll try and post the relevant parts.

class WxMain(wx.App):
  def OnInit(self):
    self.window = wx.Frame(None)
    self.movieWindow1 = wx.Panel(self.window)
    self.player1 = self.CreateVideoPlayer("souphttpsrc location=http://192.168.1.2 ! jpegdec ! ffmpegcolorspace ! ximagesink", self.OnSyncMessage1)
    try:
       self.player1.set_state(gst.STATE_PLAYING)
    except AttributeError:
       pass

  def CreateVideoPlayer(self, stream, syncFunc):
    try:
       player = gst.parse_launch(stream) 
       bus = player.get_bus() 
       bus.add_signal_watch() 
       bus.enable_sync_message_emission() 
       bus.connect('message', self.OnMessage) 
       bus.connect('sync-message::element', syncFunc)
       return player
    except:
       return False

    def OnMessage(self, bus, message): 
        type = message.type
        if ((type == gst.MESSAGE_EOS) or (type == gst.MESSAGE_ERROR)):
          try:
            player.set_state(gst.STATE_NULL)
          except AttributeError:
            pass

    def OnSyncMessage1(self, bus, message):
        if message.structure is None: 
            return 
        messageName = message.structure.get_name() 
        if messageName == 'prepare-xwindow-id': 
            imageSink = message.src 
            imageSink.set_property('force-aspect-ratio', True) 
            imageSink.set_xwindow_id(self.movieWindow1.GetHandle())

if __name__ == '__main__':
    app = WxMain()
    app.MainLoop()

Thanks in advance.

i too had the same problem.this command helped me out ...
execute this command export DISPLAY=:0 and then run your program.

Where does module gst come from?
Maybe it is written with a different version of GTK then Ubuntu uses.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.