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

Mathieu SCHROETER mathieu.schroeter at gamesover.ch
Sun Feb 28 19:03:07 CET 2010


Rémi Denis-Courmont a écrit :
> Le samedi 27 février 2010 13:59:06 Mathieu SCHROETER, vous avez écrit :
>> Hello,
>>
>> I tried to use libvlc 1.1 (tested against [1]) to play a video in a
>> X window created directly by XCB. But unfortunately, it returns
>> some errors. I don't know if there is a bug somewhere in libvlc..
>> or maybe my use of libvlc is wrong?!
>>
>> I've attached a small test app to reproduce the problem.. it creates
>> a window in fullscreen, plays a video, and waits 2 sec. The window
>> stays black and there are some errors printed by libvlc. Note that
>> a window created in this way is perfectly usable with `mplayer -wid`
>> and xine-lib.
> 
> Your sample code works fine here. Maybe you did not build the xcb_window 
> plugin.

Mmmh.. yes..

libxcb-keysmy1-dev is needed for this module.. thanks


> 
> 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). 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.


> 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.


> Do note that xcb_flush() only sends request to the server, just like 
> XFlush()). It makes no warranty that the server processed the request, 
> contrary to XSync().
> 
> Then, resetting the plugin cache is very slow, and not a very good idea.
> 
> --no-one-instance is pointless, as it is the default anyway. Worse yet, it 
> makes your code fail if VLC was built without single instance support (i.e. 
> without DBus).
> 
> Similarly --ignore-config is also default, and useless.
> 
> Last, --intf=dummy has no effects as libvlc_add_intf() is not used.
> 

Thanks for the explanations!


Regards,
-- 
Mathieu SCHROETER



More information about the vlc-devel mailing list