Getting started with multimedia
Introduction
This document has been reviewed for maemo 4.x.
This document explains how to get started developing multimedia applications and plugins in the maemo SDK.
This assumes you are familiar with the maemo SDK, if you are not, then read maemo tutorial.
Also it's recommended to read GStreamer's documentation.
Here is a diagram of the multimedia architecture from the device's Media Player point of view. It's important if you plan to develop GStreamer plugins that can be used by the Media Player.
Application development
This example demonstrates how to use GStreamer's API to play PCM audio.
You can fetch the code from the maemo-examples package:
apt-get source maemo-examples
The source code is here example_wavlaunch.c.
Building and running
cd maemo-examples-2.0 make af-sb-init.sh start run-standalone.sh ./example_wavlaunch
To use simply:
- Click Open to open the File Chooser.
- Browse to a wav file and select Open.
- Play to start playing.
Screenshot:
Many aspects of GStreamer's application development are described in the Application Developer Manual.
For more information about how to use GStreamer's API see the Core API Reference.
Plugin development
To have support for the new media format in the maemo SDK you need to compile a codec for that format and compile GStreamer plug-in supporting that codec.
Codecs are libraries that enable the use of compression for digital audio and video. GStreamer plugins are loadable libraries that provide GStreamer elements that process video and audio streams. Some plugins have the codec embedded and therefore do not need an additional library.
To play some formats one usually needs a demuxer GStreamer plugin as well. More information about the internals of GStreamer plugins can be found in the Plugin Writers Guide.
The list of plugins for GStreamer is available here.
To add support for the new media format, you need:
- Codec from the codec's manufacturer.
- GStreamer plugins from the GStreamer website.
- Extract packages to the Scratchbox environment and follow the compiling instructions for the codec and the GStreamer plugins package
Install OGG Vorbis
To enable playback for ogg-vorbis audio files on the platform, take the following steps:
-
Get the integer-only implementation from here.
svn co http://svn.xiph.org/trunk/Tremor/
-
Build and install in Scratchbox.
./autogen.sh --prefix=/usr make install
- Get gst-plugins-bad-0.10.5.
-
Build and install in Scratchbox:
./configure --prefix=/usr make -C ext/ivorbis install
-
Check that it's there (if you have gstreamer-tools):
gst-inspect-0.10 tremor
-
If you want to try it:
gst-launch-0.10 filesrc location=test.ogg ! application/ogg ! tremor ! alsasink
Deployment
Copy files from scratchbox to the device (into the same directory):
-
/usr/lib/libvorbisidec.so* -> /usr/lib/
-
/usr/lib/gstreamer-0.10/libgstivorbis.so -> /usr/lib/gstreamer-0.10
-
If you want to try it:
gst-launch-0.10 filesrc location=test.ogg ! application/ogg ! tremor ! dsppcmsink
The next step is to tell the file-manager and the media-player about the new format.
-
Edit /usr/share/mime/packages/ogg-vorbis.xml:
<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="audio/x-vorbis"> <glob pattern="*.ogg"/> <magic priority="50"> <match type="string" value="OggS" offset="0"/> </magic> <comment>OGG Vorbis audio</comment> </mime-type> </mime-info>
Note that the mime-type needs to start with "audio/" to be properly recognized. The same applies to video codecs ("video/").
Update the MIME database:
update-mime-database /usr/share/mime
-
Add "audio/x-vorbis" to /usr/share/applications/hildon/mp_ui.desktop
Update the Desktop database:
update-desktop-database
-
Add ogg to the libmetalayer configuration /usr/share/libmetalayer/metadata_lib.conf
ogg libmtext_gst
Reload metalayer crawler
/etc/init.d/metalayer-crawler0 restart
That's it!
Improve this page