Page 1 of 1

Problem with libvlc_media_player_set_xwindow failing.

Posted: 14 Jun 2013 22:08
by jwest68
I was having an issue in some of my code where if I called libvlc_media_player_set_xwindow, it would sometimes fail, and libvlc would then display in it's own default window instead of using my nice crisp new window (which was definately there). I could never get it to occur on my development computer, but it kept appearing on the production computer.

From my limited understanding of X, it seems that the window may not have been completely created yet (even though I had a valid handle for it), and so libvlc was rejecting it. If I place a call to "XSync(display,False)" just before calling libvlc_media_player_set_xwindow, it cleared up my problem.

This only seems to appear when the X-System is fairly busy in other windows doing some drawing.

Re: Problem with libvlc_media_player_set_xwindow failing.

Posted: 15 Jun 2013 00:16
by erwan10
Not sure XSync is enough. You need to wait till you received a notification that that window is created or mapped before sending the xid to vlc. And keep in mind that the Xserver merely transmits requests to the Window Manager. So, things may work differently depending on the Linux distrib and WM you run (KDE, Gnome, Unity, ...)

Re: Problem with libvlc_media_player_set_xwindow failing.

Posted: 15 Jun 2013 09:08
by RĂ©mi Denis-Courmont
The window needs to be created on the server. Allocating an X11 handle is a non-blocking client-side operation that is not visible to the X server and thus neither to the VLC rendering back-end.

How to do that depends on the framework used. If you use Xlib directly, then XSync() is good while XFlush() is insufficient.