The ACCESS Linux Platform media engine is based on GStreamer, an open source multimedia framework (http://gstreamer.freedesktop.org/). Accordingly, any valid GStreamer plugin can be used with ACCESS Linux Platform; the media engine imposes no special requirements on the GStreamer plugins.
Codecs are added by wrapping them into a GStreamer plugin and ensuring that the plugin supports the autoplug feature.
IMPORTANT: In order to work with the ACCESS Linux Platform, plugins have to support the autoplug feature.
GStreamer, the creation of GStreamer plugins, and the GStreamer autoplugging feature are documented on the GStreamer website. In particular, you'll need to read the following:
- GStreamer Application Development Manual (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html)
- GStreamer Plugin Writer's Guide (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html).
Tips for Writing GStreamer Plugins
Beyond the fact that your GStreamer plugins are autopluggers, the following sections note certain aspects of the plugin that you'll want to pay careful attention to.
NOTE: In the following sections, the "mad" MP3 decoder is used as an example. This sample plugin can be found at: http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-0.10.5.tar.gz. When you have unpacked the archive, you'll find the source code for the mad plugin in the
ext/mad/ directory.
Codec Class
When specifying your codec's type and description, make sure that the codec's class includes either "Decoder", "Demux", or "Parse".
You specify the type and description of your codec by defining a GstElementDetails structure and using the GST_ELEMENT_DETAILS macro, as documented in the GStreamer Plugin Writer's Guide (see http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-boiler-details.html).
In the source code for the mad plugin, this is done early on in the file gstmad.c:
/* elementfactory information */ static const GstElementDetails gst_mad_details = GST_ELEMENT_DETAILS ("mad mp3 decoder", "Codec/Decoder/Audio", "Uses mad code to decode mp3 streams", "Wim Taymans < This e-mail address is being protected from spam bots, you need JavaScript enabled to view it >");
The second GST_ELEMENT_DETAILS argument, klass, must include "Decoder", "Demux", or "Parse".
Codec Rank
Your codec should have a rank greater than GST_RANK_MARGINAL. To have your codec be chosen first, specify a rank of GST_RANK_PRIMARY.
In the source code for the mad plugin, this is done in the plugin_init() function in the file gstid3tag.c:
static gboolean plugin_init (GstPlugin * plugin) {
if (!gst_element_register (plugin, "mad",
GST_RANK_SECONDARY, gst_mad_get_type ()) ||
!gst_element_register (plugin, "id3mux", GST_RANK_NONE,
gst_id3_tag_get_type (GST_ID3_TAG_PARSE_MUX))) {
return FALSE;
}
GST_DEBUG_CATEGORY_INIT (gst_id3_tag_debug, "id3mux", 0,
"id3 tag setter");
return TRUE;
}
For more information on rank values, see the description of the GstRank enum in the GStreamer 0.10 Core Reference Manual. Also see the documentation for the gst_element_register() function.
Pad Capabilities
The MIME-type associated with each of your codec's pads must match the MIME-type of the peer pads. For instance, the MIME-type associated with your codec's sink pad must match the MIME-type of the media file it processes. The source pad capabilities must similarly match the capabilities of the peer pad.
NOTE: You can display the capabilities—which include the associated MIME-type—of your coded with the
gst-inspect command.
See the Autoplugging chapter in the GStreamer Application Development Manual for more on autoplugging and identifying streams by MIME-types.
Testing a Plugin
Once you have created your plugin, use the gst-inspect command-line tool and verify that the information displayed for your plugin is correct.
gst-inspect mad
After you are satisfied that your plugin appears to be correct, you can try it out from the command line with gst-launch and the playbin plugin.
gst-launch is a tool that builds and runs basic GStreamer pipelines. playbin is a basic media playing plugin that will take care of most things for you. In particular, it will play the file if the file's format is supported—that is, if you have all the necessary demuxing and decoding and some output plugins installed.
gst-launch playbin uri=file:///tmp/test.mp3
Finally, you can write a GStreamer application that will test your plugin. See GStreamer Application Development Manual for complete information on writing applications that use GStreamer.










