VLC-1.1.0: libvlc_media_player_set_xwindow

This forum is about all development around libVLC.
juraj
Blank Cone
Blank Cone
Posts: 27
Joined: 05 Dec 2009 10:41

VLC-1.1.0: libvlc_media_player_set_xwindow

Postby juraj » 23 Jan 2010 20:02

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

dstieglitz
New Cone
New Cone
Posts: 4
Joined: 23 Jan 2010 22:09

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby dstieglitz » 23 Jan 2010 22:13

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

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

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby Rémi Denis-Courmont » 24 Jan 2010 10:57

It works fine from the command line (vlc --drawable-xid $WINDOWID). Are you sure you built VLC correctly?
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

dstieglitz
New Cone
New Cone
Posts: 4
Joined: 23 Jan 2010 22:09

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby dstieglitz » 24 Jan 2010 17:12

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

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

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby Rémi Denis-Courmont » 24 Jan 2010 19:16

You have to pass a X Window ID (a 32-bits integer). VLC has no idea what a canvas is.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

dstieglitz
New Cone
New Cone
Posts: 4
Joined: 23 Jan 2010 22:09

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby dstieglitz » 24 Jan 2010 20:49

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)); }

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

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby Rémi Denis-Courmont » 24 Jan 2010 21:03

I doubt that JVLC embedding has ever supported MacOS.

That's not the point of this thread anyway.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

juraj
Blank Cone
Blank Cone
Posts: 27
Joined: 05 Dec 2009 10:41

Re: VLC-1.1.0: libvlc_media_player_set_xwindow

Postby juraj » 24 Jan 2010 22:24

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


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 27 guests