Modular Media Server - User Guide - API

From RidgeRun Developer Wiki



Previous: User Guide Index Next: User Guide/Interactive Console







Previous: Modular Media Server Introduction Index Next: Building and Installation



Important concepts

Entity

An entity is a module encapsulating multimedia functionality, such as encoding, capture, or recording. For example, see figure 1 of a V4L2CaptureEntity that captures using v4l2src GStreamer component. As these entities are associated with a Gstreamer component, the entity will provide some properties of the entity to be modified.



Figure 1: V4L2CaptureEntity example

The media entities will have the following states:


Value State Description
1 NULL This is the initial state of the entity.
2 READY The entity is ready to change it state to PAUSED.
3 PAUSED The entity is ready to have income data and process it.
4 PLAYING Sink elements will accept and render data. Live sources will produce it. All the other elements will be exactly the same as the PAUSE state.
Table 1. States of an entity

Media Group

A Media Group is a group of entities that are connected and operate as a whole. This allows us to configure all the entities belonging to a whole group in a simpler way. For example, not having to put all the entities individually in PLAYING, but putting the multimedia group in play and it will take care of changing the status of all its entities. See figure 2.


Figure 2: Media Group example


A more complex system that uses two media groups is the one in figure 3. This provides that the capture and encoder entities (Media Group 1) could be paused/played independently of the file recorders (Media Group 2).

Figure 3: Multiple Media Group example

Media Group Status

You can start or stop a media group. In the case of starting the media group, it will try to set all the entities of the media group to PLAYING. In case one of the entities doesn't change the state to PLAYING the media group will report the status of the lowest state from all the entities in the group. When setting the media group to stop, it will try to set all the entities to NULL.

Media Server

Media Server is the class that is responsible for managing the entire system. It functions as the interface to interact with the entire Modular Media Server. Among the features it has are:

  • Get the statuses of the media groups.
  • Get the parameters of the entities.
  • Create, modify and interact with media groups.


Method Description Description
__init__ Initialize the Media server Logger: requires an logger entity
get_media_groups_names Gets all the media groups names that have bee created. No parameter
get_media_group_status Gets the media group status using its name. media_group_name (str): media group name of which we want the status.
get_element_names Gets all the names of the supported entities. No parameter
get_parameters_description Gets the GStreamer supported properties that the entity can manage and modify. No parameter
create_media_group Creates a media group based on a dictionary. media_group_name (str): name of the media group to create, entities_list_description (List): list with the description of the entities to create in the media group.
add_entity_to_media_group Adds an entity(s) to an existing media group. media_group_name (str): name of the media group to add the entity, entities_list_description (List): list with the entities to add.
get_media_group Get all the entities associated to a multimedia group. media_group_name (str): name of the media group from which the modules will be obtained.
start Starts the media group. media_group_name (str): name of the media group to start.
stop Stops the media group media_group_name (str): name of the media group to stopped.
Table 1. Provided Methods of the Media Server


A basic example implementation of the Media Server is proposed in the next section.

Media Entity

Media Entity is the base class for all multimedia entities. All entities must inherit from this class. It provides the following methods:

Method Description Description
get_output_name Gets the unique string name where others elements can listen to. No parameter
get_property Gets the value of a property of the GStreamer element that the entity uses. No parameter
set_property Sets the value of a property of the GStreamer element that the entity uses. No parameter
get_properties Gets a dictionary with the properties and its values of all the properties of the entity. No parameter
Table 2. Provided Methods of the Media Server

Logger

The logger is an interface that the project provides to manage generated messages from the application. The project offers a console logger that displays the message in the Linux terminal. You can create your own logger to handle generated messages according to your requirements. An example would be that messages are saved in a file instead of showing the messages to the console. This is free to implement. The Logger interface to implement is the following.

Method Description Description
log_error Logs all the error messages generate by the application. message (str): error message.
log_info Logs all the information messages generate by the application. message (str): info message.
log_debug Logs all the debug messages generate by the application. message (str): debug message.
Table 3. Logger inteface methods to implement custom logger



  Index