Meego Wiki
Views

UMMS Architecture

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Class Diagram)
(Cleaned up some grammar.)
 
(17 intermediate revisions not shown)
Line 2: Line 2:
== Introduction ==
== Introduction ==
-
This page describes the architecture of Universal Multi Media Service (UMMS).<br>
+
This page describes the architecture of umms-0.1. You can get the code from: git://gitorious.org:meego-middleware/umms.git<br>
-
UMMS general description can found on its '''[[Umms|main page]]'''
+
The UMMS general description can found on the '''[[Umms|main page]]'''
== Class Diagram ==
== Class Diagram ==
-
          -------------------
+
[[File:ClassDiagramUmms-0.1.png]]
-
          |UmmsObjectManager|
+
 
-
          -------------------
+
*'''UmmsAudioManager'''
-
                  ^
+
Class to implement the '''''com.UMMS.AudioManager''''' interface which provides a client with an audio output control service.
-
                  v
+
 
-
                  |
+
*'''UmmsVideoOutput'''
-
          --------------------              -------------------------
+
Class to implement the '''''com.UMMS.VideoOutput''''' interface which provides a client with a video output control service.
-
          | MediaPlayer      |    <> ------- |  MediaPlayerControl  |
+
 
-
          --------------------              -------------------------
+
*'''UmmsPlayingContentMetadataViewer'''
-
                  ^                            ^                ^
+
Class to implement the '''''com.UMMS.PlayingContentMetadataViewer''''' interface which allows the client to query the current playing content on server side.
-
                  V                            |                |
+
-
                  |                            |                |
+
-
          ----------------------------      Implement        Implement
+
-
          | PlayerControlFactory    |          |                |
+
-
          ----------------------------          |                |
+
-
                                                |                |
+
-
                                      ---------------------  ------------------------
+
-
                                      | PlayerControlBase |  | DvbPlayerControlBase |  <--------------
+
-
                                      ---------------------  ------------------------                |
+
-
                                        ^        ^                      ^                          |
+
-
                                        |        |                      |                        ------------------------------------
+
-
------------------------------          |        |                      |                        | DvbPlayerControlGeneric (NetBook)|
+
-
|PlayerControlGeneric(NetBook)| ---------        |                      |                        ------------------------------------
+
-
------------------------------          ----------------------      -------------------------
+
-
                                          |PlayerControlTv(TV) |      | DvbPlayerControlTv(TV)|
+
-
                                          ----------------------      -------------------------
+
*'''UmmsObjectManager'''
*'''UmmsObjectManager'''
-
Class to manage MediaPlayer objects, including create/destory, register/unregister MediaPlayer objects.
+
Class to manage the MediaPlayer objects, including create/destory, register/unregister MediaPlayer objects.
-
*'''MediaPlayer'''
+
*'''UmmsMediaPlayer'''
-
Class to provide media playback service.
+
Class to implement the '''''com.UMMS.MediaPlayer''''' interface which provides a media playback service for clients.
-
*'''PlayerControlFactory'''
+
*'''UmmsPlayerBackend'''
-
Factory class to create backend player which implemented MediaPlayerControl interface.
+
A base class which defines an internal interface for media playback. UmmsMediaPlayer uses this class to handle the service request. A backend developer needs to subclass it.
-
*'''MediaPlayerControl'''
+
*'''UmmsAudioManagerBackend'''
-
Internal interface. MediaPlayer uses this interface to handle the service request. Backend developer need to implemente this interface.
+
A base class which defines an internal interface for controlling audio output. UmmsAudioManager uses this class to handle service requests. A backend developer needs to subclass it.
-
*'''PlayerControlBase'''
+
*'''UmmsVideoOutputBackend'''
-
Base class to handle the non-dvb playback request. It internally uses playbin2 to implement the MediaPlayerControl interface.  
+
A base class which defines an internal interface for controlling video output. UmmsVideoOutput uses this class to handle service requests. A backend developer needs to subclass it.
-
*'''PlayerControlGeneric'''
+
*'''UmmsPlugin'''
-
A backend used on generic PC platform(e.g. NetBook).
+
A class which defines the plugin mechanism. All backends should inherit from UmmsPlugin.
-
*'''PlayerControlTv'''
+
*'''Player'''
-
A backend used on TV platform (e.g. CE4100).
+
An implementation of the UmmsPlayerBackend base class.
-
*'''DvbPlayerControlBase'''
+
*'''AudioManger'''
-
Base class to handle the dvb playback request. It creates a custom gstreamer pipeline to play/recode the dvb stream.
+
An implementation of the UmmsAudioBackend base class.
-
*'''DvbPlayerControlGeneric'''
+
*'''VideoOutput'''
-
Derived class from DvbPlayerControlBase which is used on generic PC platform(e.g. NetBook).
+
An implementation of the UmmsVideoOutput base class.
-
*'''DvbPlayerControlTv'''
+
Note that, '''Player''','''AudioManger''','''VideoOutput''' are plugins and will not be provided by umms-1.0.
-
Derived class from DvbPlayerControlBase which is used on TV platform(e.g. CE4100).
+
== How to develop a backend ==
== How to develop a backend ==
-
*Step 1: Implement MediaPlayerControl interface.  
+
Suppose you are going to develop a player backend.
 +
*'''Step 1: Subclass UmmsPlayerBackend'''
 +
The UmmsPlayerBackend is an internal interface to abstract all the media playback control. The backend developer should subclass this class and implement its vmethods. Of course, you can just implement a subset of the virtual methods defined in UmmsPlayerBackendClass struct, for example. For the dvb player backend, it is optional to implement the "pause" method. If you want to add the time-shifting feature for DVB playback, implementing "pause" method is a choice.
 +
 
 +
*'''Step 2: Fill the UmmsPlugin struct in your PlayerBackend.c file and export it'''
 +
The definition of struct UmmsPlugin:
 +
<pre>
 +
typedef struct _UmmsPlugin {
 +
  gint major_version;//the major version number of umms core that plugin was compiled for
 +
  gint minor_version;//the minor version number of core that plugin was compiled for
 +
  UmmsPluginType type;
 +
  const gchar *filename;//set by "plugin loader" when this plugin loaded.
 +
  const gchar *name;
 +
  const gchar *description;
 +
 
 +
  /*
 +
  * Used for plugins of UMMS_PLUGIN_TYPE_PLAYER_BACKEND type.
 +
  * If supported_uri_protocols is empty, unsupported_uri_protocols is respected
 +
  * as a "black list" of uri. If supported_uri_protocols is not empty, ignore
 +
  * unsupported_uri_protocols.
 +
  * For example, the implementor can create a black list for its plugin like this:
 +
  * supported_uri_protocols = {NULL};
 +
  * unsupported_uri_protocols = {"dvb"};
 +
  * that means the plugin can handle all uri protocols unless "dvb".
 +
  */
 +
  const gchar **supported_uri_protocols;
 +
  const gchar **unsupported_uri_protocols;
 +
 
 +
  /*vmethod to create the instance of backend.*/
 +
  gpointer (*backend_new_func) (void);
 +
}UmmsPlugin;
 +
</pre>
 +
The most important fields are supported_uri_protocols, unsupported_uri_protocols, and backend_new_func. The following is a code snapshot to fill the struct:
 +
<pre>
 +
static gchar *supported_prots[] = {
 +
  NULL
 +
};
-
The MediaPlayerControl is the internal interface to abstract all the media playback control. Backend developer should create a class and implement this interface.
+
static gchar *unsupported_prots[] = {
 +
"dvb", NULL
 +
};
-
*Step 2: Modify PlayerControlFactory
+
MyPlayerBackend *my_player_backend_new (void)
 +
{
 +
  return g_object_new (MY_TYPE_PLAYER_BACKEND, NULL);
 +
}
-
All the backend selection logic is contained in PlayerControlFactory class. For now, PlayerControlFactory creates the appropriate backend(named "engine" in the source code) according to platform information and the URI. The Developer should modify the function pointer array to contain his custom backend:
+
/*Plugin description*/
-
MediaPlayerControl* (*engine_factory[PLATFORM_INVALID][N_PLAYER_CONTROL_FACTORY_ENGINE_TYPE])(void)
+
G_MODULE_EXPORT
 +
UmmsPlugin umms_plugin = {
 +
        UMMS_VERSION_MAJOR;
 +
        UMMS_VERSION_MINOR;
 +
        UMMS_PLUGIN_TYPE_PLAYER_BACKEND,
 +
        NULL,//should set by loader
 +
        "Player",
 +
        "Player to handle non-dvb URI",
 +
        (const gchar **)&supported_prots,
 +
        (const gchar **)&unsupported_prots,
 +
        (gpointer (*) (void)) my_player_backend_new
 +
};
 +
</pre>
 +
Here is a sample player backend based on GStreamer using playbin2: [http://wiki.meego.com/images/Sample-player-backend-0.0.1.tar.gz]

Latest revision as of 14:21, 30 May 2012

Contents

UMMS Architecture

Introduction

This page describes the architecture of umms-0.1. You can get the code from: git://gitorious.org:meego-middleware/umms.git
The UMMS general description can found on the main page

Class Diagram

ClassDiagramUmms-0.1.png

  • UmmsAudioManager

Class to implement the com.UMMS.AudioManager interface which provides a client with an audio output control service.

  • UmmsVideoOutput

Class to implement the com.UMMS.VideoOutput interface which provides a client with a video output control service.

  • UmmsPlayingContentMetadataViewer

Class to implement the com.UMMS.PlayingContentMetadataViewer interface which allows the client to query the current playing content on server side.

  • UmmsObjectManager

Class to manage the MediaPlayer objects, including create/destory, register/unregister MediaPlayer objects.

  • UmmsMediaPlayer

Class to implement the com.UMMS.MediaPlayer interface which provides a media playback service for clients.

  • UmmsPlayerBackend

A base class which defines an internal interface for media playback. UmmsMediaPlayer uses this class to handle the service request. A backend developer needs to subclass it.

  • UmmsAudioManagerBackend

A base class which defines an internal interface for controlling audio output. UmmsAudioManager uses this class to handle service requests. A backend developer needs to subclass it.

  • UmmsVideoOutputBackend

A base class which defines an internal interface for controlling video output. UmmsVideoOutput uses this class to handle service requests. A backend developer needs to subclass it.

  • UmmsPlugin

A class which defines the plugin mechanism. All backends should inherit from UmmsPlugin.

  • Player

An implementation of the UmmsPlayerBackend base class.

  • AudioManger

An implementation of the UmmsAudioBackend base class.

  • VideoOutput

An implementation of the UmmsVideoOutput base class.

Note that, Player,AudioManger,VideoOutput are plugins and will not be provided by umms-1.0.

How to develop a backend

Suppose you are going to develop a player backend.

  • Step 1: Subclass UmmsPlayerBackend

The UmmsPlayerBackend is an internal interface to abstract all the media playback control. The backend developer should subclass this class and implement its vmethods. Of course, you can just implement a subset of the virtual methods defined in UmmsPlayerBackendClass struct, for example. For the dvb player backend, it is optional to implement the "pause" method. If you want to add the time-shifting feature for DVB playback, implementing "pause" method is a choice.

  • Step 2: Fill the UmmsPlugin struct in your PlayerBackend.c file and export it

The definition of struct UmmsPlugin:

typedef struct _UmmsPlugin {
  gint major_version;//the major version number of umms core that plugin was compiled for
  gint minor_version;//the minor version number of core that plugin was compiled for
  UmmsPluginType type;
  const gchar *filename;//set by "plugin loader" when this plugin loaded.
  const gchar *name;
  const gchar *description;

  /*
   * Used for plugins of UMMS_PLUGIN_TYPE_PLAYER_BACKEND type.
   * If supported_uri_protocols is empty, unsupported_uri_protocols is respected
   * as a "black list" of uri. If supported_uri_protocols is not empty, ignore
   * unsupported_uri_protocols.
   * For example, the implementor can create a black list for its plugin like this:
   * supported_uri_protocols = {NULL};
   * unsupported_uri_protocols = {"dvb"};
   * that means the plugin can handle all uri protocols unless "dvb".
   */
  const gchar **supported_uri_protocols;
  const gchar **unsupported_uri_protocols;

  /*vmethod to create the instance of backend.*/
  gpointer (*backend_new_func) (void);
}UmmsPlugin;

The most important fields are supported_uri_protocols, unsupported_uri_protocols, and backend_new_func. The following is a code snapshot to fill the struct:

static gchar *supported_prots[] = {
  NULL
};

static gchar *unsupported_prots[] = {
 "dvb", NULL
};

MyPlayerBackend *my_player_backend_new (void)
{
  return g_object_new (MY_TYPE_PLAYER_BACKEND, NULL);
}

/*Plugin description*/
G_MODULE_EXPORT
UmmsPlugin umms_plugin = {
        UMMS_VERSION_MAJOR;
        UMMS_VERSION_MINOR;
        UMMS_PLUGIN_TYPE_PLAYER_BACKEND,
        NULL,//should set by loader
        "Player",
        "Player to handle non-dvb URI",
        (const gchar **)&supported_prots,
        (const gchar **)&unsupported_prots,
        (gpointer (*) (void)) my_player_backend_new
};

Here is a sample player backend based on GStreamer using playbin2: [1]

Personal tools