gstreamer running on Android app?

Enrique Ocaña González eocanha at igalia.com
Tue Jul 3 08:34:29 PDT 2012


On Martes, 3 de Julio de 2012 15:53:40 Anees Alappat escribió:

> We tried to write a script and used  setenv to set the PATH for environment
> variable but it is not working.
> We tried to call setenv inside gst-launch.c  and also inside the script
> file to set the PATH for the environment variables but it did not work.
> From the JNI layer from the native code from we tried to call the main
> function of the gst-launch.c passing the command line arguments for
> gst-launch command as string variables. Before calling the main function we
> have set all the environment variables using setenv.But still this option
> also didn't work.

I can tell you that calling setenv() in C code and then calling other 
functions *does* work. I'm using that method in my code (not related to 
Gstreamer) to set the XDG_DATA_DIRS environment variable and other variables 
that the lib I use needs to find its plugins, which are manually loaded with 
dlopen() internally.

However, seeing the kind of variables that you're setting, I'm not very 
comfident about LD_LIBRARY_PATH being honored. In [1] it says that for sure 
that variable wasn't honored in Android 1.5 (an ancient version). I don't know 
about more recent versions.

What I had to do manually in my code (not related to Gstreamer) was to 
manually load all the dependent shared libs from the Java class that invokes 
the native code:

    static {
        System.loadLibrary("glib-2.0");
        System.loadLibrary("gthread-2.0");
        System.loadLibrary("gobject-2.0");
        System.loadLibrary("gmodule-2.0");
        ...
    }

This way the linker doesn't have to do any work by itself. Note that the load 
order may be important if you have transitive dependencies among libs.

I'm sorry for not being able to help more, but maybe some of the topics I 
commented are useful to solve your problem.

Good luck!


[1] http://android.git.r3pek.org/?p=platform/ndk.git;a=blob;f=docs/SYSTEM-
ISSUES.html;h=04575b1dec1dec90f0dad6697cfb518c6ba25b4b;hb=refs/heads/ics

-- 
Enrique Ocaña


More information about the gstreamer-android mailing list