libvlc_media_player_set_drawable failing (Java)
Posted: 31 Mar 2009 18:19
Hi,
I've been doing a lot of work to embed a vlc media player inside a Java application on Ubuntu 8.04. I already have something working with the latest available JVLC bindings.
However, I want to write my own Java binding rather than use JVLC - my own binding is a cut-down and simplified version that contains only the functions that I need and does not use any deprecated libvlc functions as JVLC does. I'm also trying to make a really robust binding that hides all libvlc implementation quirks from the calling Java application.
In particular, the existing JVLC uses libvlc_video_set_parent() which is deprecated in favour of libvlc_media_player_set_drawable(). My application works with libvlc_video_set_parent(), although I do see a seemingly harmless warning reported to the log (libvlc: no active input). The point is, it does work.
So, without using JVLC and using my own new Java binding, my sequence of (pseudo) code is this:
I've looked at some examples of media players that use vlc and they do seem to follow this same sequence.
My problem is with libvlc_media_player_set_drawable() - if I invoke this before calling play(), then I get a hard VM failure somewhere in the libvlc native library:
I then tried waiting after calling play() for video output to appear before calling set_drawable() - but this does not reliably work, the video still displays in a new window, unless I stop() and play() again at which point the video does indeed appear in my Canvas.
Can anyone offer any hints or ideas on my approach - is my usage of libvlc_media_player_set_drawable correct? Have I missed something?
I've been doing a lot of work to embed a vlc media player inside a Java application on Ubuntu 8.04. I already have something working with the latest available JVLC bindings.
However, I want to write my own Java binding rather than use JVLC - my own binding is a cut-down and simplified version that contains only the functions that I need and does not use any deprecated libvlc functions as JVLC does. I'm also trying to make a really robust binding that hides all libvlc implementation quirks from the calling Java application.
In particular, the existing JVLC uses libvlc_video_set_parent() which is deprecated in favour of libvlc_media_player_set_drawable(). My application works with libvlc_video_set_parent(), although I do see a seemingly harmless warning reported to the log (libvlc: no active input). The point is, it does work.
So, without using JVLC and using my own new Java binding, my sequence of (pseudo) code is this:
Code: Select all
createAndShowFrame(); // This creates a Canvas that will subsequently be used in set_drawable()
libvlc_new();
libvlc_media_new();
libvlc_media_player_from_media();
libvlc_media_release();
libvlc_media_player_set_drawable();
libvlc_media_player_play();
My problem is with libvlc_media_player_set_drawable() - if I invoke this before calling play(), then I get a hard VM failure somewhere in the libvlc native library:
Code: Select all
# Java VM: Java HotSpot(TM) Server VM (11.3-b02 mixed mode linux-x86)
# Problematic frame:
# C [libvlc.so+0x10e7a] libvlc_media_player_set_drawable+0x2a
Can anyone offer any hints or ideas on my approach - is my usage of libvlc_media_player_set_drawable correct? Have I missed something?