Collabora and Fluendo have recently announced the availability of GStreamer’s Software Development Kit for Android, which allows developers to create multimedia playback applications for Android smartphones and tablets using Gstreamer and the Android NDK..
The GStreamer SDK for Android targets Android 2.3.1 Gingerbread or higher (API Level 9 or greater). However, due to some of the restrictions of previous versions of Android, some features such as hardware acceleration are only available on Android 4.1 Jelly Bean (API Level 16 up).
Normally, you’d need the GStreamer SDK which can be installed on Linux (Ubuntu, Fedora and Debian), Windows (XP/Vista/7/8) and Mac OS X (10.6 to 10.8). But for developing Android applications using Gstreamer, you don’t. What you do need first is a typical Android development environment with the latest Android SDK, the latest Android NDK, and optionally, but recommended, the Eclipse IDE with Android ADT and NDK plugins. Once everything is setup correctly, and you have made sure you can build NDK apps, you can download and install GStreamer SDK for Android (ARM only).
I’ve tried the instructions in Eclipse 4.2.1 with Android NDK 8b and Android Tools SDK 21 following the the instructions to install GStreamer for Android development. In Eclipse IDE, make sure the Android SDK and NDK paths are correctly setup (Window->Preferences->Android->NDK), and set GSTREAMER_SDK_ROOT_ANDROID to the folder where you unzipped the SDK, by going to Window->Preferences->C/C++->Build->Build Variables and defining GSTREAMER_SDK_ROOT_ANDROID.
There are 5 tutorials provided in the GStreamer SDK for Android:
- Tutorial 1: Link against GStreamer
- Tutorial 2: A running pipeline
- Tutorial 3: Video
- Tutorial 4: A basic media player
- Tutorial 5: A Complete media player
Eventually, it will be possible to add GStreamer code to Java apps, but language bindings for the GStreamer API are not complete yet. The tutorial are written in both C and Java code with Java used for the User Interface, and C for the GStreamer code, with both parts interacting through JNI.
To import a tutorial into the Eclipse workspace, click on File->New->Project… ->Android->Android Project from Existing Code, and select the folder android-tutorial-1 in GSTREAMER_SDK_ROOT_ANDROID/share/gst-sdk/tutorials.
At this stage, Eclipse might complain about missing files, but this is normal, and we need to add native development support by right-clicking on the project tutorial1 and selecting Android tools->Add Native Support… The NDK plugin should ask for a library name, just keep the default (libTutorial1.so) and accept. Click on Project->Build Project in the top menu. Once the build is complete, run the project: Run->Run, and after a little while, the demo should appear in the emulator or your Android device.
You should be able to reproduce the same steps with tutorial 2 to 5. Details are available on GStreamer’s Android tutorials page.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress