#1823 Problem using java gstreamer bindings via FFI

anderssakoul Thu 8 Mar 2012

I'm trying to create a media player with Fantom on Linux, so I'm using the Java gstreamer bindings. As a first step I tried the following:

using [java]org.gstreamer::Gst
using [java]org.gstreamer::Pipeline as GsPipe

class Main {
    static Void main(Str[] args) {
        args = Gst.init("SimplePipeline", args);
        echo(args)
        pipe := GsPipe("SimplePipeline");
    }
}

The fan compiler dies on me with no explanation, just Failed. If I comment out the line that starts with pipe, it compiles and runs.

The equivalent naked Java compiles and runs fine on the same JVM.

I have jna.jar (3.1.0) and the gstreamer-java jar (1.5) in my classpath, and the native libraries for jna installed via apt-get. It makes no difference if I make each jar into a pod as dependencies, or include them in ext. There's the same result on openjdk 6 on 32-bit Ubuntu Lucid and 64-bit Debian Squeeze. Even changing to JDK5 makes no difference.

Anyone enlighten me? Thanks.

brian Thu 8 Mar 2012

Hi @anderssakoul,

Sorry that you're seeing that failure. Can you post the full output you are seeing? Does it really just say Failed?

There could be some internal compiler error that isn't getting reported properly, but it should dump a stack trace.

Also do you have links those jars so I could test it out on my machine?

Thanks

anderssakoul Thu 8 Mar 2012

Hi - thanks - here's the compiler output after commenting the offending line out, and after uncommenting it:-

$ fan build.fan
compile [pivui]
Compile [pivui]
  FindSourceFiles [1 files]
  WritePod [file:/........../fantom/fantom-1.0.62/lib/fan/pivui.pod]
BUILD SUCCESS [2523ms]!
$ vim fan/gstreamer.fan 
$ fan build.fan
compile [pivui]
  Compile [pivui]
    FindSourceFiles [1 files]
BUILD FAILED [3248ms]!

The gstreamer Java binding jar is here: http://code.google.com/p/gstreamer-java/

The JNA jar is best installed by a package manager as it has corresponding binary libraries, but there's a link on the above page.

Is there a way of enabling more diagnostic output?

brian Thu 8 Mar 2012

Okay I was able to reproduce that. There are actually two problems.

The first was an unlogged compiler error slipped thru which is why you got a silent failure. I added a safety hook to make sure that doesn't happen again.

The real problem was I was making a blanket assumption to hide all "com.sun" packages as internal to the runtime. But you're actually trying to use a public com.sun package, so I fixed that to only skip com.sun packages in rt.jar.

The changeset is here.

If you aren't setup to do a bootstrap build (which is sort of complicated) you can send me an email and I'll just email you fixed the pod so you can get on with your work.

Login or Signup to reply.