MAFW Manual |
---|
An application will use sources to get access to multimedia repositories. For example, a source might provide access to UPnP servers, another source might provide access to the media files located at the local filesystem, another one might provide access to media files housed at Bluetooth devices, etc. The main target of sources is to provide a way to query and retrieve information about available media files.
Sources identify media items by means of object identifiers
.
These identifiers are strings in the form:
<Source-ID>::<Item-ID>
consisting of the Source ID of the originating source and a unique (within the individual source's scope) Item ID, separated by two colons. Each object ID should be unique, persistent and portable, if possible. Applications may assume that an object ID corresponds to a single content item, and this should be maintained across shutdowns, reboots and reinstalls. A specific object ID is meaningful only for the source that has produced it.
The sources provide, mainly, two services:
Browsing
is the operation used to explore, query and
filter contents from a particular source of media. Developers will use
the browse interface, for example, to get a list of the songs or videos
available, to access the songs of a particular artist, etc. Sources provide
access to their contents exposing them though the browse interface using
a container model: there is a root container, which object ID is
<Source-ID>::
, any container can contain other containers
or media resources, very much like navigating a file system. The structure
of containers exposed by the source is decided by the source developer.
Metadata retrieval
is the operation used to obtain
meta-information from a certain media resource. Developers will use
this interface to obtain information like the title, artist or album
of a particular media.
In addition to getting content information, one can also modify the contents with optional methods, intended for creating and removing contents from the source, as well as updating metadata for particular media items.
Sources are represented by the MafwSource class, which inherits from MafwExtension. Thus, sources have name, uuid and plugin properties and support run-time properties too. This class is intended to be an abstract base class for any source and it provides various the interfaces commented above: mafw_source_browse, mafw_source_get_metadata, mafw_source_set_metadata, etc.
Application developers will use sources to show to the users available media contents that they can navigate and select to create a playlist. Once the playlist has been created it could be assigned to a renderer so its media can be played.
Sources can also communicate certain events by means of signals: