![]() |
![]() |
![]() |
![]() |
This chapter describes how to get metadata and artwork for your media files. It includes:
The MME provides a variety of methods for retrieving metadata. You can use the MME to retrieve metadata:
You can provide your end users with information, such as album title, artist, and composer, for the currently playing file or track in a library-based track session by retrieving this metadata from the MME's library table.
To retrieve metadata for the currently playing file or track from the library table:
The sample query shown below retrieves title, album name, artist name, genre name, and composer name, assuming that you know only the fid for a track:
SELECT title, artist, album, genre, composer FROM library NATURAL JOIN ( library_albums, library_artists, library_genres, library_composers) WHERE fid=%lld;
A library-based track session is a track session created with synchronized media files. For more information, see “About track sessions” in the chapter Playing Audio.
![]() |
If an MP3 file contains more than one version of ID3 tags, the MP3 file parser parses the most recent tag and ignores the older tag version. That is, if a file contains both ID3v1 and ID3v2 metadata tags, the MP3 file parser ignores the ID3v1 tags. Only the metadata from the the ID3v2 tags is made available to the MME. |
For information about getting metadata for tracks in a file-based track session; that is track sessions created with unsynchronized media, see “Getting metadata for unsyncrhonized media” below.
The MME includes an API that can be used to retrieve metadata for files on an both synchronized and unsynchronized mediastores and devices.
This feature is particularly useful for quickly retrieving metadata for specific files from large mediastores or devices, such as iPods, that would take a long time to synchronize completely. For example, you can use this feature to retrieve metadata for a single file or a small number of files, to display it to a user exploring the contents of a mediastore or device.
This API includes the following functions, structures and constants:
The metadata extraction functions listed above require the filepath and filename of the file whose metadata is needed — for example, to display to a user who requests more information about a track on an iPod.
Thus, to retrieve and make available metadata for unsynchronized media, you must:
Once you have the path for the file whose metadata is needed:
Metadata extraction from unsynchronized media requires that the client application manage the explorer information structures and the metadata and explorer handles it uses. The client application must:
The client application must use mme_metadata_alloc() to copy the metadata handle. This copied metadata handle returned by mme_metadata_alloc() maintains valid information until the client application releases it.
Simply copying the mme_explore_info_t data structure does not guarantee valid information because:
![]() |
The pointer to the path is a normal C-string; the client application:
|
The nowplaying table may contain more complete metadata than is available in the library table — for example, when playing an iPod track session, because an iPod makes information, such as track duration, available only during playback.
When the MME starts playing a new track it updates the information in the nowplaying table and delivers an MME_EVENT_TRACKCHANGE event. When it updates metadata in the nowplaying table it delivers the event MME_EVENT_NOWPLAYING_METADATA, which you can use to trigger queries to retrieve the updated metadata.
See also the description of the nowplaying table in the appendix: MME Database Schema Reference of the MME API Library Reference.
The MME supports metadata from remote sources, such as CDText, Gracenote and MusicBrainz. To use these capabilities, you must change the MME configuration file, mme.conf, to enable the relevant MME modules and configure the specific behaviors required by your environment.
For information about how to configure the MME to support these modules, see “Metadata synchronizers” in the chapter Configuring Metadata Support in the MME Configuration Guide.
![]() |
Support for these features may require special licensing. Contact QNX for more information. |
This MME supports metadata rating extractions for the following formats:
If the ratings are available, the MME's MMF module extracts metadata ratings in MP3 files from the following tags:
Tag | Frame |
---|---|
ID3v2.2 | POP |
ID3v2.3 | POPM |
ID3v2.4 | POPM |
If the ratings are available, the MME's MMF module extracts metadata ratings in WMA files from the Extended Content Description Object's WM/SharedUserRating record.
The MME stores metatdata ratings in the rating field in the:
The rating field in the nowplaying table makes a file's rating available even when the file does not have an entry in the library; for example, when the file is accessed through the MME's Explorer API.
Rating values are stored as follows:
The MME stores ratings from MP3 file ID3 tags without conversion. It converts WMA file WM/SharedUserRating record ratings from their 1 to 99 range to a 1 to 255 range.
The table below shows how the the MME's 1 to 255 rating system maps to WMA 1 to 99 rating system and to the WMA five star rating system:
MME | WMA | Stars |
---|---|---|
1-60 | 1-24 | * |
61-125 | 25-49 | ** |
126-190 | 50-74 | *** |
191-254 | 75-98 | **** |
255 | 99 | ***** |
The MME includes a “Load-on-Demand” API for retrieving metadata. This API is designed to support on-demand retrieval of all types of metadata, but it is currently implemented for artwork, such as album art images.
![]() |
|
The MME's Load-on-Demand metadata extraction API includes the following functions and data structures:
Information for images stored in the MME's metadata image persistent cache is kept in the mdi_image_cache table.
For information about how to set configuration options for the MME's metadata extraction API, see the chapter MME Configuration Guide chapter Configuring Metadata Support.
MME releases include the libxml2.so library and appropriate headers; this library and the headers are required by clients of the MME in order to parse the metadata structures delivered by the MME metadata extraction functions.
The libxml2 library delivered with the MME includes only a small subset of the full libxml2 library; it includes only the modules required for reading, parsing and writing XML files. The xmlversion.h header file indicates exactly what functional modules are in the included library.
Documentation for libxml2 is available at xmlsoft.org.
The current release support is limited, as follows:
The MME's metadata extraction API uses metadata sessions. A metadata session uses a metadata session identifier used by the metadata extraction functions.
Metadata extraction includes the following tasks:
The metadata extraction functions deliver metadata information as XML in the mme_metadata_info_t structure. For more information, and examples, see “XML content” on the mme_metadata_info_t structure reference page.
As required, the client application can also:
![]() |
The MME supports extraction of album artwork from iPods for the currently playing track only. To retrieve album artwork from iPods, use the metadata extraction API as you do to retrieve artwork from other devices and mediastores.
See also “Retrieving artwork from iPods” in the chapter Working with iPods. |
The MME supports image pre-processing with the following capabilities:
![]() |
Images encoded into the BMP format may not be readable by some external applications. |
The MME's image processing capabilities are configured through the <MetadataInterface>/<ImageProcessing> element in the MME's configuration file, mme.conf.
To enable image pre-processing, you must:
![]() |
If you do not enable the image processing module, or if there are no image processing modules configured, attempts to use a defined image processing profile through the MME's metadata interface will fail with an EINVAL error. |
For information about how to configure and enable the MME for image pre-processing, see “Image pre-processing” in the chapter Configuring Metadata Support in the MME Configuration Guide.
![]() |
A patch is required to enable the selection of JPEG image quality when performing image pre-processing. This patch is available in the archive patch-640-1383-img-quality.tar, under the Foundry27 Multimedia project's “Downloads” tab. |
The MME's metadata API implements the mme_metadata_image_load() function to load and, if requested, process images. Image processing is specified through the function's image_format_profile parameter. This parameter can be set to either -1 if no image processing is required, or the number of a pre-defined image processing profile. For more information about these profiles and how to configure then, see “Configuring image processing profiles” in the chapter Configuring Metadata Support in the MME Configuration Guide.
For more information about mme_metadata_image_load(), see the MME API Library Reference.
![]() |
![]() |
![]() |
![]() |