1. Breif Introduction:
This applicaiton is an video player which based Gstreamer as its multimedia
solution and Gtk+ as it user interface. It also used some mid-wares which
written by other members of LiPS, such as libgpephone, libgemwidget, and so on.
At the following, I will introduce them respectively.
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 six
plugins to play mp3 files. They are filesrc, mpegdemux, mpeg2dec,
ffmpegcolorspace, videoscale and ximagesink. Because the limit of efficiency, I
just open the video stream and close the audio stream.
(2) Gtk+-2.0: I just used some several widgets to implement this program,
such as GtkFixed, GtkLabel and so on.
(3) GLib-2.0: I used some basic function, such as GList operations, g_print,
g_strdup, and so on.
(4) libgpewidget: This library provided us with an unique top level GtkWindow
named GpeSKWindow. This window encapsulate a soft key press event. If soft key
pressed, this window will emit a "softkey_activated" signal and popup the menu
automatically if you had specified.
(5) libgemwidget: This library provided some useful widgets for mobile phone,
such as GtkAutoScrolledWindow, GemTreeView and so on. It also defined an unique
resource access to all LiPS applicaitons.
(6) filechooser: This widget is included in libgemwidget. It is a simple but
powerful file browser for Linux phone.
3. Design and Concept:
This program can be devided into two parts: multimedia solution and user
interface.
(1) multimedia solution: I build a simple pipiline by using
"play_build_pipeline" in the file of "playpage.c".
(2) user interface: There are only two pages of this application: playpage,
filechooser page. The users can select video files which they want to play by
the filechooser page. When the play started, the program will jump to the play
page.
4. General structure and APIs:
(1) playpage.c
typedef struct _PPageManager {
GtkWidget *window;
/*
* The play area.
*/
GtkWidget *play_area;
/*
* The information labels. Such as "Title", "Artist" and so on.
*/
GtkWidget *info_list[7];
/*
* Two labels which indicate the duration and position of the playing song.
*/
GtkWidget *position;
GtkWidget *duration;
/*
* dur_val is used to record the duration of the playing song and to estimate
*is there a new song.
*/
gint64 dur_val;
/*
* The progress scale of the video file.
*/
GtkWidget *progress;
/*
* Five effection icons of the steerer.
*/
GtkWidget *effect_icons[5]; //0 up 1 left 2 down 3 right 4 pause
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
/*
* The handle of the player pipeline.
*/
GstElement *player;
GstState play_state;
/*
*
*/
gboolean player_inited;
guint update_id;
} PPageManager;
(2) open.c
This page consist of a GtkImage and GemFileChooser.