Code: Select all
// Windows
@Override
protected void nativeSetVideoSurface(libvlc_media_player_t mediaPlayerInstance, Canvas videoSurface) {
Logger.debug("nativeSetVideoSurface(mediaPlayerInstance={},videoSurface={})", mediaPlayerInstance, videoSurface);
// The video surface component must be realised (visible and laid out etc)
// at this point
long drawable = Native.getComponentID(videoSurface);
Logger.debug("drawable={}", drawable);
Pointer ptr = Pointer.createConstant(drawable);
libvlc.libvlc_media_player_set_hwnd(mediaPlayerInstance, ptr);
}
// Linux
@Override
protected void nativeSetVideoSurface(libvlc_media_player_t mediaPlayerInstance, Canvas videoSurface) {
Logger.debug("nativeSetVideoSurface(mediaPlayerInstance={},videoSurface={})", mediaPlayerInstance, videoSurface);
// The video surface component must be realised (visible and laid out etc)
// at this point
long drawable = Native.getComponentID(videoSurface);
Logger.debug("drawable={}", drawable);
libvlc.libvlc_media_player_set_xwindow(mediaPlayerInstance, (int)drawable);
}
// Mac
@Override
protected void nativeSetVideoSurface(libvlc_media_player_t mediaPlayerInstance, Canvas videoSurface) {
Logger.debug("nativeSetVideoSurface(mediaPlayerInstance={},videoSurface={})", mediaPlayerInstance, videoSurface);
// FIXME how?
throw new UnsupportedOperationException("Send patches!");
}
That is correct.Back in 2010-07, sherington said he didn't have access to a MacOS machine. viewtopic.php?f=32&t=56939&start=140#p257334. I don't think the situation has changed....
There's not much to go on, but it was posted here: http://code.google.com/p/vlcj/wiki/Usage - look for the post dated 7th December.Hello,
is it possible to send me this code so i can try my luck with it
Georg
Code: Select all
/**
* Set the NSView handler where the media player should render its video output.
*
* Use the vout called "macosx".
*
* The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
* protocol:
*
* @begincode
* \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
* - (void)addVoutSubview:(NSView *)view;
* - (void)removeVoutSubview:(NSView *)view;
* \@end
* @endcode
*
* Or it can be an NSView object.
*
* If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
* the following code should work:
* @begincode
* {
* NSView *video = [[NSView alloc] init];
* QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
* libvlc_media_player_set_nsobject(mp, video);
* [video release];
* }
* @endcode
*
* You can find a live example in VLCVideoView in VLCKit.framework.
*
* \param p_mi the Media Player
* \param drawable the drawable that is either an NSView or an object following
* the VLCOpenGLVideoViewEmbedding protocol.
*/
What happens if instead of Pointer.createConstant(drawable), you do this:Code: Select all
Pointer ptr = Pointer.createConstant(drawable); libvlc.libvlc_media_player_set_nsobject(mediaPlayerInstance, ptr);
Code: Select all
Pointer ptr = Native.getComponentPointer(drawable);
libvlc.libvlc_media_player_set_nsobject(mediaPlayerInstance, ptr);
I do not know if this is a correct statement or not, as I do not have a Mac so I can't test it, but it looks like Java on MacOS may be using 64 bit window handles, whereas the libvlc API expects 32-bit window handles.Hello,
when i change this, i get the same result, the audio plays but no videoscreen.
Georg
Code: Select all
long drawable = Native.getComponentID(canvas);
System.out.println("bad value: " + (drawable < Integer.MIN_VALUE || drawable > Integer.MAX_VALUE));
So we can't use this?That's not true. LibVLC expects NSObjects pointers.
Code: Select all
void libvlc_media_player_set_agl( libvlc_media_player_t *p_mi, uint32_t drawable )
{
#ifdef __APPLE__
var_SetInteger (p_mi, "drawable-agl", drawable);
#else
(void) p_mi; (void)drawable;
#endif
}
Hi, one problem is that the handle does indeed seem to contain a 64-bit value on MacOS. According to the documentation of the toolkit I'm using, there is no reason why the native window handle can't be 64-bit.Oh, if you want to use AGL, then it's a 32-bits handle. But insofar as it is a handle (not a pointer), I don't see how 32-bits would be a problem.
Code: Select all
libvlc.libvlc_media_player_set_nsobject(mediaPlayer.mediaPlayerInstance(), Native.getComponentPointer(osxCanvas));
Code: Select all
libvlc.libvlc_media_player_get_nsobject(...) ,
libvlc.libvlc_media_player_get_agl(...), ....
Code: Select all
* The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
* protocol:
*
* @begincode
* \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
* - (void)addVoutSubview:(NSView *)view;
* - (void)removeVoutSubview:(NSView *)view;
* \@end
* @endcode
*
* Or it can be an NSView object.
*
* If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
* the following code should work:
* @begincode
* {
* NSView *video = [[NSView alloc] init];
* QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
* libvlc_media_player_set_nsobject(mp, video);
* [video release];
* }
* @endcode
*
* You can find a live example in VLCVideoView in VLCKit.framework.
Code: Select all
* The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
* protocol:
Code: Select all
java[3411:80f] *** -[NSViewAWT addVoutSubview:]: unrecognized selector sent to instance 0x1b491f80
Return to “Development around libVLC”
Users browsing this forum: No registered users and 5 guests