[gst-devel] gst-python and GstXOverlay

Martin Soto soto at informatik.uni-kl.de
Tue Nov 9 03:35:01 CET 2004


Hi!

First, the general problem: I'm trying to write a Python application
that creates a video playing pipeline (gst-python rocks!) and displays
the video on a Gtk window (pygtk also rocks, by the way :-).

I already managed to access the GstXOverlay interface in the xvimagesink
element inside my pipeline, and can invoke the set_xwindow_id on it.
However, as soon as I do that, the program dies with the following
message:

  The program 'main.py' received an X Window System error.
  This probably reflects a bug in the program.
  The error was 'BadWindow (invalid Window parameter)'.
    (Details: serial 32 error_code 3 request_code 3 minor_code 0)
    (Note to programmers: normally, X errors are reported asynchronously;
     that is, you will receive the error a while after causing it.
     To debug your program, run it with the --sync command line
     option to change this behavior. You can then get a meaningful
     backtrace from your debugger if you break on the gdk_x_error()
  function.)

I was able to trace the error to the following code in xvimagesink.c,
(end of the gst_xvimagesink_set_xwindow_id function, line 1633):

    /* We get window geometry, set the event we want to receive,
       and create a GC */
    g_mutex_lock (xvimagesink->x_lock);
    XGetWindowAttributes (xvimagesink->xcontext->disp, xwindow->win, &attr);
    ^^^^^^^^^^^^^^^^^^^^^^^^
    <<<Error happens here>>>
    xwindow->width = attr.width;
    xwindow->height = attr.height;
    xwindow->internal = FALSE;
    XSelectInput (xvimagesink->xcontext->disp, xwindow->win, ExposureMask |
        StructureNotifyMask | PointerMotionMask | KeyPressMask |
        KeyReleaseMask);

    xwindow->gc = XCreateGC (xvimagesink->xcontext->disp,
        xwindow->win, 0, NULL);
    g_mutex_unlock (xvimagesink->x_lock);
  }

As far as I can tell, XGetWindowAttributes only fails this way if it
gets an XID that doesn't correspond to a window. I checked the XID
directly before passing it to XGetWindowAttributes, and it actually
corresponds to the window, as xwininfo shows.

The python code I'm using to create the window is the following:

        self.drawing = gtk.DrawingArea()
        self.window.add(self.drawing)
        self.drawing.set_size_request(400, 400)
        self.drawing.show()

        self.videoWin = gtk.gdk.Window (
            self.drawing.window,
            300, 300,
            gtk.gdk.WINDOW_CHILD,
            gtk.gdk.EXPOSURE_MASK,
            gtk.gdk.INPUT_OUTPUT,
            "",
            0, 0)
        self.videoWin.show()

set_xwindow_id will later be called with self.videoWin.xid as parameter.

I have no idea what else to check. I'd really appreciate some help with
this issue.

Thanks a lot,

M. S.
-- 
Martin Soto <soto at informatik.uni-kl.de>
Universität Kaiserslautern





More information about the gstreamer-devel mailing list