views:

194

answers:

0

I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA.

I would like to include a check in the code, to see whether the gstreamer library has been initialised. When I have left the "Gst.init()" code out (to mimic when the library has not been initialised correctly), the application throws out the following messages:

(process:21888): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function 
(process:21888): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

The app calls the gstreamer-java library. The error messages appear but the thread continues to run, hogging the CPU.

Is there any way to catch the error or to add a check to prevent it from happening?

An alternative would be to put the "Gst.init()" in the main class, but I am not sure if this would always guarantee the gstreamer library is initialised.