Metadata synchronization and retrieval

Media applications can invoke mm-sync to synchronize the contents of QDB databases with the metadata on mediastores. The mm-sync service uses dedicated libraries to extract track and playlist metadata from mediastores and writes these metadata in the databases, which applications can then query 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 the publish-subscribe services which mediastores (devices) are attached to the system and exploring their contents, applications can invoke mm-sync to upload metadata from those mediastores into QDB databases. The metadata include creation and playback information such as the album name, artist name, track titles, and track durations. The command to start a synchronization must specify 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).

    An application must create and load the QDB database for a device before it starts uploading any metadata from that device. 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 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 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 tables and columns the various 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 uploading has finished, mm-sync extracts the entries for all playlists found within the path given in the synchronization request. 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. In the configuration file, you can define filename pattern matches and even an alternative libmmplaylist configuration, to better control which playlist entries get synchronized. For more information, see the <Configuration>/<Database>/<Synchronization>/<PLSS> element.

  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.