Metadata synchronization and retrieval

Media applications invoke mm-sync to synchronize QDB databases with metadata on mediastores. The mm-sync service uses dedicated libraries to extract track and playlist metadata before writing them to embedded databases. Applications can later query these databases to retrieve the metadata.

The interaction between these components proceeds as shown here:

Multimedia architecture diagram with synchronization components highlighted and their order of interaction enumerated
Figure 1. Metadata Synchronization and Retrieval
  1. Starting a synchronization

    After learning through PPS which devices (mediastores) are attached to the system and exploring their contents, applications can invoke mm-sync to upload media metadata from those mediastores into QDB databases. Metadata includes creation and playback information such as the album name, artist name, track title, and track duration. The command to start a synchronization must contain the mediastore path of the files to synchronize (e.g, /tunes/queen/) as well as the device entry for the QDB database (e.g, /dev/qdb/cd0_db) that will store the metadata.

    An application must create and load the QDB database for a device before it starts synchronizing any metadata. We recommend using the device's unique ID in the database name; for details, see the "Maintaining database persistence" section in the Multimedia Synchronizer Developer's Guide.

  2. Extracting file and media metadata

    The mm-sync service uses the libmd library to read metadata fields (types) from mediastore files. The files named in the metadata requests sent to libmd are always located within the mediastore path given to mm-sync. For information on libmd, see the Metadata Provider Library Reference.

  3. Storing file and media metadata

    The mm-sync service must store the extracted metadata in the database tables and fields (columns) specified in its configuration. The mm-sync configuration file defines the mapping of metadata fields to database fields for audio, video, and photo files. You can modify this mapping to change which metadata fields get uploaded to QDB databases and which database tables and fields the metadata fields get stored in. For information on doing so, see the <Configuration>/<Database>/<Synchronization>/<ConfigurableMetadata> element in the mm-sync configuration description.

  4. Extracting playlist entries

    After the media metadata has been uploaded, mm-sync extracts the entries for all playlists found within the path specified at the start of synchronization. Playlist entries, which are track URLs referenced in playlist files, are retrieved by using the libmmplaylist library. For information on libmmplaylist, see the Multimedia Playlist Library Reference.

  5. Storing playlist entries

    The mm-sync service then uploads the playlist entries to the device's database. This action fills in the tables that store playlist information. In the mm-sync configuration file, you can define filename pattern matches and even an alternative libmmplaylist configuration for greater control over which playlist entries get synchronized. For information on doing so, see the <Configuration>/<Database>/<Synchronization>/<PLSS> element in the mm-sync configuration description.

  6. Retrieving synchronized metadata

    Media applications can query a database through the QDB API to retrieve up-to-date track and playlist information, which lets them show details of the tracks in the playlist window, support mediastore browsing, and display album artwork.

    To know when a mediastore has been completely synchronized (which means the tables in its database are as accurate as possible), your applications must monitor mm-sync events and wait for the MMSYNC_EVENT_MS_SYNCCOMPLETE event.