1. Breif Introduction:
This application plays the function of receiving and handling play audio
files requests of other applications. It used Gstreamer as its multimedia
solution and communicate with other applications by libiac which encapsulated
from DBus. For example, if there is an incoming call, the voice call just needs
to tell soundserver to start playing a specified audio file and doesn't need to
know how to decode and how to play. This application used Gstreamer, libiac,
glib. At the following, I will introduce them repectively.
2. Overview:
(1) Gstreamer: If you want to know the advanced usage, you could get some
hints from FAQ and manul.pdf of Gstreamer. In this program, I just used five
plugins to play mp3 files. They are filesrc, mad, audioconvert, volume and
esdsink. This program just built a mp3 decode pipeline yet.
(2) libiac: This library encapsulate from Dbus and provide upper programmer
with an easy way to use Dbus.
(3) glib+-2.0: I used libgthread to create a new thread to play audio files.
3. Design and Concept:
This application consist of two parts: multimedia solution and inter-process
communication.
(1) inter-process communication: This parts was implemented in the file of
"ss_iac.c". This component can get several messages from other applications
through dbus and parse them into a command.
(2) multimedia solution: This parts was implemented in the file of
"ss_gst.c". It is an simple pipeline which can be used to play mp3 files.
4. General structure and APIs:
(1) ss_iac.c ss_iac.h
struct _SSMessParser {
Applicant applicant; // Which application send this message.
ControlType type; // What did the application want soundserver to do
ValueTrue value; // The value of this command
};
When there is an incoming message, the "ss_iac_application_handler" will be
called and parse the incoming messages to an instance of SSMessParser.
enum _ControlType {
CON_LOCATION, // Start to play, and the SSMessParser::value is the path of
file
CON_MUTE, // Mute, SSMessParser::value has no effect.
CON_STOP, // Stop play, SSMessParser::value has no effect.
CON_VOLUME, // Volume controller, SSMessParser::value = + or -.
CON_REMUTE, // Remute.
CON_PAUSE, // Pause the pipeline.
CON_CONTINUE, // Continue.
CON_NOTHING // Do nothing.
};
(2) ss_gst.c ss_gst.h
The function "ss_gst_player" receive the instance of SSMessParser and do the
corresponding operation. If the audio file which you specified doesn't exist, I
will set the location of filesrc to a default one by using "ss_gst_get_default_path".
If shake model is on, "ss_shake" can shake the phone at the starting of playing.