Metadata extraction

When libmd asks an MDP to retrieve metadata, the selected MDP parses the request data to obtain either a fully qualified path to the item (media file) or some other information referencing the item (e.g., a track's unique ID (UID) on iPods). Next, the MDP uses POSIX system calls or system libraries to browse the device's directories and files and to read its file information to generate metadata. For instance, the CDDA plugin calls devctl() to issue device commands to CDs mounted in the local filesystem. These commands include reading the CD-Text data, which contains album metadata.

The MDP stores the information read from the device in metadata strings and returns these strings along with the number of metadata types (fields) for which metadata was found to the data-processing layer of libmd. If the number of types found is less than the number requested by the client, libmd picks another MDP to get metadata for the remaining fields. The libmd library continues invoking MDPs until all requested metadata fields have been filled in or until it exhausts all MDPs.