Metadata Provider API

The Metadata Provider API allows client applications to initialize the libmd library, create metadata-extraction sessions, and make metadata retrieval requests.

The first action any client must perform with libmd is to initialize the library by calling mmmd_init() while supplying the path of the configuration file, which lists the metadata providers (MDPs) to load.

Before it can extract any metadata, the client must open a metadata-extraction session by calling mmmd_session_open() while providing the name of the mediastore (device) to read metadata from.

The client can then request specific metadata fields from specific items (media files) by calling mmmd_get(). The client can ask for a maximum number of matches (i.e., responses from different MDPs). Retrieving multiple matches lets the client pick the set of metadata values that provide the most complete and accurate media information possible.

While a session is active, the client can obtain information about the last error that occurred for that session by calling mmmd_error_info(). This function returns error data, including the numeric error code, a string summarizing the error, and an error message. We recommend that your client code check the return values of all API calls. If any value indicates an error, your application can examine the error code and use it to help recover.

When it's finished retrieving metadata, the client can close the corresponding session by calling mmmd_session_close(). When it's finished using libmd altogether (e.g., during shutdown), the client must call mmmd_terminate() to clean up the resources used by the library.