Embed VLC video output into a Scene Graph

Eli Tsikel Eli.Tsikel at sandisk.com
Sun Jul 15 04:32:49 PDT 2012


Hello,

I'm trying to embed a VLC player in a JavaFX 2.2 application.
For that I'm using the libvlc.dll library's API.

VLC provided two ways to render a video:
1. Call API function that takes HWND: libvlc_media_player_set_hwnd (libvlc_media_player_t *p_mi, void *drawable) Set a Win32/Win64 API window handle (HWND) where the media player should render its video output.
2. Register a callback that gets called every time a frame should be rendered: libvlc_video_display_cb (void *opaque, void *picture) Callback prototype to display a picture.

With the HWND approach, I managed to extract an HWND pointer of the Scene using Glass framework, causing the video to render on the whole scene, no other nodes are visible.
With the Callback approach, and by using JavaFX 2.2 new javafx.scene.canvas.Canvas node, I was able to throw pixels at the canvas, but it turns to be very inefficient in terms of memory and thread usage.

I would love to have a solution as with AWT + JNA: the HWND can be extracted from java.awt.Canvas component (using JNA), and be given to libvlc API function. This canvas can be placed anywhere in the frame, not occupying all the entire window.

Hard Guidelines:
1. Integrating AWT/Swing with FX application is not an option, I want it to be a pure JavaFX application.
2. Using JavaFX Media API for playback is not an option, since I have a requirement to modify the media player's source code.
3. The video must not occupy the entire window, allowing other components to be visible.

Possible solution is to create my own node or control that will wrap Glass component View that has a HWND but I don't know how to bind and make it work with other Glass components.

Any help would be appreciated.

Thank you.

Eli.

________________________________

PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).



More information about the openjfx-dev mailing list