Playing with the Android NDK and GStreamer
GStreamer had been ported to android for a while by Prajnashi and Edward Hervey (see http://groups.google.com/group/prajnashi), but this has been done on a "platform" level. In other words, to use it, you need a custom firmware. What I would like to see is a way to embed GStreamer in an application that you can distribute for usage on any android phone. The big tasks I see to achieve this are the following:
So, hopefully, I will soon post updates on the advancement of these things, posting this might create some peer pressure to motivate me ;).
If you have any ideas/advice/comments/questions about all that, please feel free to leave a comment or contact me
- Compile GStreamer (and its dependencies) using the NDK
- Find a way to alleviate the limitations of android's dynamic linker on at least some versions of android (I've only tested with 1.5 so far, which is what I have on my phone), and compile, as properly as can be, all the gstreamer plugins that might be useful
- Write/port a binding that allows to use GStreamer from the java code of an android application.
- Conquer the world!
- compiled GLib and GStreamer with the NDK (see there: glib, gstreamer), branching from the work previously done for the "platform" port
- wrote a minimal binding using JNI (which seems to be the recommended way on android); for now, as it is generated by hand and I am lazy, it only binds gst_init() and gst_version_string()
- integrated all that in a modified version of the "Hello JNI" NDK example, that displays the result of gst_version_string():
So, hopefully, I will soon post updates on the advancement of these things, posting this might create some peer pressure to motivate me ;).
If you have any ideas/advice/comments/questions about all that, please feel free to leave a comment or contact me
11 Comments
From: Sanjeeth
2010-06-08 09:34:52
Hi Guijemont ,
i wanted to use gstreamer for my experimenting in NDK, could you please explain the build steps, i suppose i have to run some configure/install ?
Thanks and Regards, Sanjeeth
From: guijemont
2010-06-08 10:54:23
@Sanjeeth: there are no proper build steps that I know of (yet). As I say in the post, this is a work in progress, and I have nothing really functional yet (in particular: I dont have plugins working). If you want to experiment with the little already done, there are links in the blog post to my branches, and the way to build these is the typical NDK way, that is explained in the documentation of the NDK.
From: Sanjeeth
2010-06-10 11:53:46
@guijemont Thanks for the response, i was able to build gstreamer on ndk, thanks for your help, now my interest lies on the plugins, and currently i am more interested on audio plugins, to get raw mic input, encode decode into g711 alaw mlaw and play raw pcm, what are the plugins we need to port, any initial ideas on how we can achieve this?
Thanks and Regards Sanjeeth
From: saturne
2010-08-25 15:45:40
Hy Sanjeeth and guijemont
Can you tell me how I can build gstreamer on ndk
Thanks
From: Andy
2010-09-07 04:53:17
Hi there,
This is such a fantastic plan, really love the idea and your progress. Ive played around with porting ffmpeg just for this very reason.
Im interested in helping you with your goal. I was just wondering if you might be able to send me your source project with the Android.mk files for GStreamer and GLib? It would help me greatly.
Cheers, Andy
From: madmac2501
2010-09-08 15:05:46
I suggest to read this bug report about JNI bindings and GStreamer https://bugzilla.gnome.org/show_bug.cgi?id=583465
From: guijemont
2010-09-08 15:19:15
@sanjeeth: not sure about the plugins needed, but for now, I dont have plugins really working (OK, I should admit I havent touched this since this article, hopefully Ill have some time for this this month)
@saturne: I cant say much more than whats in the article and in my previous answer to sanjeeth
@andy: The Android.mk files are in the git branches, linked in the article
@madmac2501: doh, how did I miss this? Will definitely try it, thanks!
From: Andy
2010-09-14 06:43:41
Hi guijemont,
I noticed the Git repositories. Just wondering if you could share the example hello world project that linked these two examples together (e.g. one with them in the jni directory that I could run ndk-build on). Just having a little bit of trouble getting them compiled.
Also... have you considered to run a jni code generator on the GStreamer libraries to get a complete set of bindings (and save time?) I was thinking about something like GlueGen or Noodle Glue?
From: Matias Wilkman
2010-11-25 14:03:15
Hi, Thanks for getting the ball rolling on this effort. Have you read this article about building libraries that use autotools with the NDK: http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/ ?
Also, maybe Im slow, but I cant seem to figure out how to build the git source tree with NDK. Just running ndk-build in the root dir gave me "Android NDK: Could not find application project directory !". I then tried specifying the makefile (NDK_APPLICATION_MK) and project path (NDK_PROJECT_PATH) manually, but got errors about missing makefiles in jni/, which does not exist. However, the files seemed to exist under the root directory, so I created symlinks to the root from jni/, and got a build started. However, I get errors like "gstreamer-android/android/jni/tools/gst-inspect.c:28:42: error: gst/controller/gstcontroller.h: No such file or directory", even though I have gstcontroller.h in /usr/include/gstreamer-0.10/gst/controller/, and pass -I/usr/include/gstreamer-0.10 to ndk-build.
Any help would be appreciated.
From: Reynaldo
2011-11-09 14:51:05
Hi pal. Maybe a tad late but we have some work going on in this very same subject. Repositories available with full building instructions here:
http://gstreamer.freedesktop.org/wiki/GstreamerAndroid_InstallInstructions
From: guijemont
2011-11-09 14:59:57
Hey Reynaldo! Yeah, I saw your blog post (well, and your talk in Prague), thanks for the pointer, and good job! Hope I will manage to find some time soon to try it.
Post a comment
All comments are held for moderation; basic HTML formatting accepted.