Page 1 of 1

VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 23 Jan 2010 20:02
by juraj
Hi guys,

We want to switch from vlc-1.0.3 to vlc-1.1.0. I compiled sources of vlc-1.1.0 from git on Ubuntu 9.04 and want to use it in our application, which used vlc-1.0.3 so far. I embed video output in Qt widget this way:

Code: Select all

libvlc_media_player_set_xwindow(_mediaplayer, _displayWidget->winId(), &_vlcexception );
However when I start our application with new vlc-1.1.0 distribution vlc video is rendered in its own window, which vlc opens and not in my Qt Widget. With vlc-1.0.3 it is working correctly. Is there some other way to embed video output in vlc-1.1.0 or is it just not implemented yet?

Thanks.
Juraj

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 23 Jan 2010 22:13
by dstieglitz
I've been playing with the JVLC bindings, and after a bit of work and debugging it seems that after a libvlc_media_player_set_xwindow call, a new system-level window object is created and returned. The pointer passed in to the set_xwindow method, at least in my case, is ignored.

Does anyone know where in the code this happens? I've confirmed that the pointers are different by printing them to the console.

I know I'm working with a different wrapper (and on Mac OS X to boot) but I think the issues are related.

Dan

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 10:57
by Rémi Denis-Courmont
It works fine from the command line (vlc --drawable-xid $WINDOWID). Are you sure you built VLC correctly?

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 17:12
by dstieglitz
I'm pretty sure the build was correct. The built executable works, and I can use JVLC to open a player window that plays video and audio fine, it's just that the player opens in its own window instead of being embedded in a java.awt.Canvas (even though jvlc.setVideoOutput() is called with a properly-constructed canvas).

I thought I read somewhere that if libvlc can't confirm the validity of the window ID passed into media_player_set_xwindow it will create a new window, and I'm wondering if that's what's happening here?

How would I determine the drawable_id to pass into the command line when using Java?

Dan

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 19:16
by Rémi Denis-Courmont
You have to pass a X Window ID (a 32-bits integer). VLC has no idea what a canvas is.

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 20:49
by dstieglitz
Right... so here's the bit of JVLC Java code that I've been playing with. We obtain the native system handle using JNA. When this code runs, we see "GOT DRAWABLE ID 'X'" and "GOT HANDLE 'Y'" printed to the screen, and X != Y. I've tried calling set_xwindow, set_nsobject, etc. with the same results.

Code: Select all

public void setParent(Canvas canvas) { long drawable = Native.getComponentID(canvas); System.out.println("GOT DRAWABLE ID " + drawable); libvlc_exception_t exception = new libvlc_exception_t(); if (Platform.isWindows()) { libvlc.libvlc_media_player_set_hwnd(instance, drawable, exception); } else { System.out.println("SETTING DRAWABLE " + instance + "," + drawable + "," + exception); libvlc.libvlc_media_player_set_xwindow(instance, drawable, exception); } System.out.println("GOT HANDLE "+libvlc.libvlc_media_player_get_xwindow(instance)); }

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 21:03
by Rémi Denis-Courmont
I doubt that JVLC embedding has ever supported MacOS.

That's not the point of this thread anyway.

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Posted: 24 Jan 2010 22:24
by juraj
@Remi: Yes, I think I built everything correctly. 374 plugins are loaded at run-time, no "cannot load plugin" warning at run-time. I will further investigate this problem, I just wanted to know if there is not some change in functions between versions like libvlc_media_player_set_xwindow (1.0) and libvlc_media_player_set_drawable (0.9).

@dstieglitz: VLC on mac has some problems and I found the integration more difficult than on windows or linux. See this thread: viewtopic.php?f=32&t=61157&p=230582&hil ... et#p230582. At the end I managed to embed video output to my Qt widget, but I didn't do that with libvlc_media_player_set_xwindow but as it is described in attachPlayerToWnd() in the aforementioned thread. It is a workaround with objective C, cocoa framework and VLCKit. I had to managed fullscreen on my own also. I don't know, if this is possible in JVLC - I have no experiences with JVLC.