Problem with libvlc_media_player_set_xwindow failing.

This forum is about all development around libVLC.
jwest68
New Cone
New Cone
Posts: 7
Joined: 15 Oct 2012 19:38

Problem with libvlc_media_player_set_xwindow failing.

Postby jwest68 » 14 Jun 2013 22:08

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.

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: Problem with libvlc_media_player_set_xwindow failing.

Postby erwan10 » 15 Jun 2013 00:16

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Problem with libvlc_media_player_set_xwindow failing.

Postby Rémi Denis-Courmont » 15 Jun 2013 09:08

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 17 guests