[vlc-devel] problem with libvlc_media_player_set_xwindow and a X window created by XCB

Rémi Denis-Courmont remi at remlab.net
Sun Feb 28 19:23:27 CET 2010


Le dimanche 28 février 2010 20:01:13 Mathieu SCHROETER, vous avez écrit :
> > That said, your sample code looks wrong in several ways. First, I fail to
> > see what warrants that the window was created before you start VLC
> > playback.
> 
> I use several backends, like MPlayer for example. The winid can be
> passed only with the parameter "-wid", when MPlayer is executed
> (note that MPlayer is used in idle mode, and not re-executed for every
> playback).

VLC supports this with --drawable-xid, but it's best to use libvlc_*().

> And for the xine backend, the XCB connection, the screen
> and the window must be passed to xine-lib with the init of the video
> driver.

I don't want to do that. VLC still needs to process a few incoming X11 events 
in its own thread(s), so it pretty much requires its own connection to the 
same server.

Besides, the LibVLC model is most flexible. You are free to use XCB, Xlib, 
Qt4, GDK/Gtk or anything else to create the window.

> > In practice, the X server most likely already did create the window. But
> > you have a race there. LibVLC will be using *another* X11 connection, so
> > the create_window request must be acknowledged first to ensure correct
> > sequencing.
> 
> Thanks to have pointed this out.. I was not aware that XCB is unable
> to handle safely a window in this context.

XCB can do that. You need to use the corresponding *_checked() function, and 
then get the result with xcb_request_check(). Then you're sure the X11 server 
has created the window, since it responded to the request.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list