GStreamer java application receives JNA access error

279 views
Skip to first unread message

Le Xu

unread,
Apr 28, 2016, 9:49:09 AM4/28/16
to gstreamer-java
I am trying to build a simple Gstreamer java according to this tutorial and I found GStreamer cannot be used even if I have already linked both gstreamer library and jna library jar to my file. 
The code is simply:

    import org.gstreamer.Gst;
    
    
    public class PlayBack {
    public static void main(String[] args) {
        args = Gst.init("MyMediaPlayer", args);
    
       
    }
    }


and I got an error saying the library is not found

    Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'gst_date_get_type': dlsym(0x7fd7d9c1fa70, gst_date_get_type): symbol not found
    at com.sun.jna.Function.<init>(Function.java:208)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
    at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
    at com.sun.jna.Library$Handler.invoke(Library.java:199)
    at com.sun.proxy.$Proxy2.gst_date_get_type(Unknown Source)
    at org.gstreamer.glib.GDate.<clinit>(GDate.java:40)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
    at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1057)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:1038)
    at java.lang.reflect.Field.get(Field.java:379)
    at org.gstreamer.Gst.getField(Gst.java:447)
    at org.gstreamer.Gst.registerClass(Gst.java:460)
    at org.gstreamer.Gst.loadAllClasses(Gst.java:471)
    at org.gstreamer.Gst.init(Gst.java:338)
    at PlayBack.main(PlayBack.java:6)


And I got the same type of errors when I was trying to build gstreamer-java using mvn install. I may have missed something important here as a beginner but I'm not sure what it is.

Neil C Smith

unread,
Apr 28, 2016, 9:57:46 AM4/28/16
to gstream...@googlegroups.com
Hi

On 28 April 2016 at 06:29, Le Xu <sharo...@gmail.com> wrote:
> I am trying to build a simple Gstreamer java according to this tutorial and
> I found GStreamer cannot be used even if I have already linked both
> gstreamer library and jna library jar to my file.

Which version of GStreamer and which version of the bindings?

For GStreamer 0.10 you'll need to use gstreamer-java from
https://github.com/gstreamer-java/gstreamer-java

For GStreamer 1.x you'll need to use gst1-java-core from
https://github.com/gstreamer-java/gst1-java-core

The stack trace looks like you're using gstreamer-java - are you sure
you're using GStreamer 0.10?

Best wishes,

Neil

--
Neil C Smith
Artist : Technologist : Adviser
http://neilcsmith.net

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Digital Prisoners - interactive spaces and projections -
www.digitalprisoners.co.uk

Le Xu

unread,
Apr 28, 2016, 3:28:26 PM4/28/16
to gstreamer-java
I have both version installed but I suspect the default version is set to 1.0. Is there anyway I can reset the default version to 0.1?

Thanks!

Le

Neil C Smith

unread,
Apr 28, 2016, 4:21:16 PM4/28/16
to gstream...@googlegroups.com

Hi,

On 28 Apr 2016 20:28, "Le Xu" <sharo...@gmail.com> wrote:
>
> I have both version installed but I suspect the default version is set to 1.0. Is there anyway I can reset the default version to 0.1?

There's no such thing as a default version. They are parallel installable and shouldn't conflict with each other. It looks more like you don't have library paths set up correctly and JNA can't find GStreamer.

Best wishes,

Neil

Le Xu

unread,
Apr 28, 2016, 4:46:52 PM4/28/16
to gstreamer-java
Thanks I think you're right. There are definitely some problems of me using the library. 

When I was testing the CameraTest.java from the repo https://github.com/gstreamer-java/gst1-java-examples/tree/master/src/main/java/org/freedesktop/gstreamer/examples and the default video source works fine. However since I'm working on a Mac, and when I change the launch using "Bin.launch("qtkitvideosrc " instead of Bin.launch("autovideosrc  it reports 
"Exception in thread "AWT-EventQueue-0" org.freedesktop.gstreamer.GstException: no element "qtkitvideosrc"

However this library definitely shows up in my GStreamer:

"Les-MacBook-Pro:~ lexu$ gst-inspect-0.10 |grep video | grep src
ximagesrc:  ximagesrc: Ximage video source
videotestsrc:  videotestsrc: Video test source
inter:  intervideosrc: FIXME Long name
gsettings:  gsettingsvideosrc: GSettings video src
gconfelements:  gconfvideosrc: GConf video source
autodetect:  autovideosrc: Auto video source
applemedia:  qtkitvideosrc: Video Source (QTKit)
applemedia:  miovideosrc: Video Source (MIO)"

I compile this code directly from my command line as 
 - sudo mvn clean package
 Then in the target folder I do:

java -cp gst1-java-examples-0.9-SNAPSHOT.jar:../libs/gst1-java-core-0.9-SNAPSHOT.jar:../libs/jna.jar org.freedesktop.gstreamer.examples.CameraTest

The example works for autovideosrc but not qtkitvideosrc, which is strange. When I run this tests from Eclipse it also seems that all my plugin cannot be recognized.

Please let me know if there seem to be any problems for me to use these libraries (or if there are any tutorials good for beginner like me.) Many thanks!

Neil C Smith

unread,
Apr 28, 2016, 5:52:58 PM4/28/16
to gstream...@googlegroups.com

On 28 Apr 2016 21:46, "Le Xu" <sharo...@gmail.com> wrote:
> However this library definitely shows up in my GStreamer:
>

> gst-inspect-0.10 ...

gst1-java-core is a binding to GStreamer 1.x so it's no good using gst-inspect from GStreamer 0.10

Le Xu

unread,
Apr 28, 2016, 7:13:36 PM4/28/16
to gstream...@googlegroups.com
Sorry I should be using gst-inspect-1.0 -
But it looks like I have plugin for both versions installed, strangely:

Les-MacBook-Pro:~ lexu$ gst-inspect-1.0 |grep video | grep src
ximagesrc:  ximagesrc: Ximage video source
videotestsrc:  videotestsrc: Video test source
inter:  intervideosrc: Internal video source
decklink:  decklinkvideosrc: Decklink Video Source
autodetect:  autovideosrc: Auto video source
applemedia:  avfvideosrc: Video Source (AVFoundation)
applemedia:  qtkitvideosrc: Video Source (QTKit)
--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.
To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

Le Xu

unread,
Apr 28, 2016, 7:14:53 PM4/28/16
to gstreamer-java
Sorry I should be using gst-inspect-1.0 -
But it looks like I have plugin for both versions installed, strangely:


Les-MacBook-Pro:~ lexu$ gst-inspect-1.0 |grep video | grep src
ximagesrc:  ximagesrc: Ximage video source
videotestsrc:  videotestsrc: Video test source
inter:  intervideosrc: Internal video source
decklink:  decklinkvideosrc: Decklink Video Source
autodetect:  autovideosrc: Auto video source
applemedia:  avfvideosrc: Video Source (AVFoundation)
applemedia:  qtkitvideosrc: Video Source (QTKit)

On Thursday, April 28, 2016 at 8:49:09 AM UTC-5, Le Xu wrote:

Neil C Smith

unread,
Apr 29, 2016, 3:12:04 AM4/29/16
to gstream...@googlegroups.com


On 29 Apr 2016 00:14, "Le Xu" <sharo...@gmail.com> wrote:
> But it looks like I have plugin for both versions installed, strangely:
>
> Les-MacBook-Pro:~ lexu$ gst-inspect-1.0 |grep video | grep src
> ximagesrc:  ximagesrc: Ximage video source
> videotestsrc:  videotestsrc: Video test source
> inter:  intervideosrc: Internal video source
> decklink:  decklinkvideosrc: Decklink Video Source
> autodetect:  autovideosrc: Auto video source
> applemedia:  avfvideosrc: Video Source (AVFoundation)
> applemedia:  qtkitvideosrc: Video Source (QTKit)

Please try any non-working pipeline from the command line using gst-launch before posting to check where the issue is. If autovideosrc is working but qtkitvideosrc isn't then I strongly suspect autovideosrc isn't using qtkitvideosrc! ;-) Maybe try avfvideosrc?

Reply all
Reply to author
Forward
0 new messages