Sources are used to get access to multimedia repositories. For example, a source might provide access to UPnP servers, the multimedia files located at the local filesystem, or those 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:
consisting of the Source ID of the originating source and a unique (within the individual scope of the source) 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.
Sources provide a few services to applications, however, the most important are:
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 through 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 the definition of various of the interfaces commented above: mafw_source_browse, mafw_source_get_metadata, mafw_source_set_metadata, etc.
Application developers will use sources to browse available media resources and select media items to create playlists. Once a playlist has been created it can be assigned to a renderer to play its contents.
Sources can also communicate certain events using signals: