Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
The ISO/IEC 29341-18-13 standard defines the ContentDirectory v2 service (CDS), a fundamental component of the UPnP AV architecture that provides a standardized mechanism for browsing, searching, and enumerating content available on UPnP media servers. The ContentDirectory service acts as a virtual filing system for multimedia content, exposing hierarchical collections of media items (audio tracks, video files, images, playlists) along with their associated metadata to UPnP control points.
Version 2 of the ContentDirectory service introduces significant enhancements over v1, including support for rich metadata queries, search capabilities with multiple criteria, container updates via the CreateObject and DestroyObject actions, and the Search action with full XPath-based query syntax. The v2 specification also adds support for external metadata sources and improved tagging capabilities, making it suitable for large media collections (10,000+ items) where efficient search and browsing are essential.
The ContentDirectory service models media content as a hierarchy of objects organized into two fundamental types: containers and items. Containers are logical groupings (analogous to file system directories) that can hold both items and sub-containers. Items represent individual media resources (a song, a video, a photo). Each object is uniquely identified by an ObjectID string and carries a set of properties defined by the UPnP AV DIDL-Lite (Digital Item Declaration Language) schema.
The standard defines a rich set of metadata properties organized into class hierarchies. At the top level, the object base class provides core properties such as @id, @parentID, dc:title, dc:creator, upnp:class, and upnp:writeStatus. Specialized subclasses include object.item.audioItem (with properties for album, artist, genre, duration), object.item.videoItem (with resolution, bitrate, aspect ratio), object.item.imageItem (with resolution and color depth), and object.container.playlistContainer (with playlist-specific properties).
| UPnP Class | Example Properties | Use Case |
|---|---|---|
| object.item.audioItem.musicTrack | dc:title, upnp:artist, upnp:album, upnp:originalTrackNumber, dc:duration | Individual music tracks in a digital library |
| object.item.videoItem.movie | dc:title, upnp:genre, upnp:longDescription, upnp:rating, res:resolution | Movies and video content |
| object.item.imageItem.photo | dc:title, dc:date, upnp:album, res:resolution | Digital photographs |
| object.container.album.musicAlbum | dc:title, dc:creator, upnp:artist, upnp:album | Logical groupings of music tracks |
| object.container.playlistContainer | dc:title, dc:creator, upnp:playlistType | User-created playlists |
The v2 ContentDirectory service provides a powerful Search action that accepts a SearchCriteria string parameter. The search query syntax is based on a subset of XPath, supporting Boolean operators (and, or, not), comparison operators (=, !=, <, >), and the contains function for substring matching. For example, searching for “dc:creator contains ‘Beethoven’ and upnp:class = ‘object.item.audioItem.musicTrack'” would return all music tracks by Beethoven.
From an engineering perspective, the Search action’s SortCriteria parameter allows the server to return results sorted by one or more properties (e.g., “+dc:title,-upnp:artist” for ascending title then descending artist). This is particularly important for mobile control points with limited processing power that rely on the server to perform sorting operations. The v2 specification also introduces the SearchCapabilities state variable, which allows the server to advertise which metadata properties support search, so control points can tailor their search UIs accordingly.
Another important engineering pattern is the CreateObject action, which enables control points to create new content objects on the media server. This is essential for applications such as creating playlists, organizing photos into albums, or tagging content with custom metadata. The v2 specification adds the CreateReference action, which creates a reference (soft link) from one container to an existing object, allowing content to appear in multiple logical locations without duplication.
When building a ContentDirectory v2 service, several implementation details are critical. The Browse response delivers results in DIDL-Lite XML format, which must be parsed efficiently by the control point. For large result sets, the service supports incremental browsing through the Browse action’s StartingIndex and RequestedCount parameters, along with the TotalMatches return value that indicates the total number of items matching the browse or search criteria. This pagination mechanism is essential for responsive UI experiences on devices with limited memory.
The SystemUpdateID state variable is a monotonically increasing counter that changes whenever any object is added, modified, or removed from the ContentDirectory hierarchy. Control points can use this to detect changes efficiently: rather than re-browsing the entire tree, they can subscribe to SystemUpdateID events and only re-fetch changed containers when the counter increments. This “change notification” pattern dramatically reduces network traffic in dynamic media environments.