building a network device compatible with microsoft windows media

45
Building a Network Device Compatible with Microsoft Windows Media Player 11 November 7, 2007 Abstract This paper describes concepts that help manufacturers to build a network audio/video device that is compatible with the new Media Sharing feature in Microsoft® Windows Media® Player 11. This information applies for the following operating systems: Windows VistaMicrosoft Windows ® XP The current version of this paper is maintained on the Web at: http://go.microsoft.com/fwlink/?LinkId=87957 References and resources discussed here are listed at the end of this paper. Contents Introduction.......................................................4 Media Sharing Feature in Windows Media Player 11...................4 Baseline Technologies............................................5 Architecture Overview............................................5 Supported Formats................................................6 Audio.........................................................6 Pictures......................................................7 Video.........................................................7 Playlists.....................................................7 Additional Formats............................................7 Supported Streaming Protocols....................................8 PlaysForSure Network Devices.....................................8 Supported Versions of Microsoft Windows..........................9 Accessing the Media Sharing Feature in Windows Vista.............9 WMP Sharing and DLNA Devices.....................................9 Network Configuration and Addressing..............................10 Physical Layer..................................................10 IP Addresses....................................................10 Network Security................................................10 Same Subnet..................................................10 IP Packet TTL................................................10

Upload: akashag11111

Post on 19-Nov-2014

895 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible with Microsoft Windows Media Player 11

November 7, 2007

AbstractThis paper describes concepts that help manufacturers to build a network audio/video device that is compatible with the new Media Sharing feature in Microsoft® Windows Media® Player 11.

This information applies for the following operating systems:Windows Vista™

Microsoft Windows® XP

The current version of this paper is maintained on the Web at: http://go.microsoft.com/fwlink/?LinkId=87957

References and resources discussed here are listed at the end of this paper.

Contents

Introduction..............................................................................................................................4Media Sharing Feature in Windows Media Player 11..............................................................4

Baseline Technologies........................................................................................................5Architecture Overview.........................................................................................................5Supported Formats.............................................................................................................6

Audio..............................................................................................................................6Pictures...........................................................................................................................7Video..............................................................................................................................7Playlists..........................................................................................................................7Additional Formats.........................................................................................................7

Supported Streaming Protocols..........................................................................................8PlaysForSure Network Devices..........................................................................................8Supported Versions of Microsoft Windows.........................................................................9Accessing the Media Sharing Feature in Windows Vista....................................................9WMP Sharing and DLNA Devices.......................................................................................9

Network Configuration and Addressing.................................................................................10Physical Layer...................................................................................................................10IP Addresses.....................................................................................................................10Network Security...............................................................................................................10

Same Subnet................................................................................................................10IP Packet TTL...............................................................................................................10

Firewall Requirements......................................................................................................10Device Discovery and Description.........................................................................................11

WMP Sharing User Interface Elements............................................................................12Device Description Document...........................................................................................13Device Authorization.........................................................................................................13Windows Media DRM Authorization and Registration......................................................13

Accessing WMP Sharing.......................................................................................................14Browsing...........................................................................................................................14Container Hierarchy..........................................................................................................15Searching..........................................................................................................................18

Page 2: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 2

Sorting...............................................................................................................................20Filtering.............................................................................................................................20String Lengths...................................................................................................................21Microsoft Extensions to UPnP Metadata...........................................................................21

Artist Attributes.............................................................................................................22Author Attributes...........................................................................................................23Ratings Attributes.........................................................................................................23Service Provider Attribute.............................................................................................25Source URL Attribute...................................................................................................25Year Attribute...............................................................................................................25

Retrieving Album Art and Thumbnail Images....................................................................26AlbumArtURI.................................................................................................................26Parameterized URLs....................................................................................................26

Format Transcoding..........................................................................................................27Support for “Trick Modes” and Seeking Using HTTP........................................................27Identifying Codecs.............................................................................................................28

Setting Compatibility Flags....................................................................................................28User Compatibility Flags...................................................................................................28Device Compatibility Flags................................................................................................28Compatibility Flag Values and Behaviors..........................................................................29X_DeviceCaps Example...................................................................................................30

Streaming DVR-MS files........................................................................................................30Timestamp values.............................................................................................................30Audio and Video streams..................................................................................................30Other streams...................................................................................................................31ASF Extensible Attribute Detail.........................................................................................31

Errata.....................................................................................................................................32Resources..............................................................................................................................32

Microsoft Resources.........................................................................................................32Industry Resources...........................................................................................................33RFCs.................................................................................................................................33

Appendixes............................................................................................................................34Appendix 1. Sample SSDP Announcement Messages....................................................34Appendix 2. Resource Elements for Transcoded Content................................................35

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 3: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 3

DisclaimerThis is a preliminary document and may be changed substantially prior to final commercial release of the software described herein.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred.

© 2007 Microsoft Corporation. All rights reserved.

Microsoft, Windows, Windows Media, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

Document HistoryDate Change

May 8, 2007 First publication

November 7, 2007

Add KB link for hotfix that re-enables support for DVR-MS. See Update Note on page 7.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 4: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 4

IntroductionConsumers want their personal media collections available all throughout their homes, and Windows® PCs are a key value-add component in the home media ecosystem. However, to truly enable consumers to unlock the potential of their PCs and enjoy ubiquitous media access, personal and premium content must flow smoothly between Windows PCs and networked audio/video devices.

This paper describes the Media Sharing functionality in Microsoft Windows Media® Player (WPM) 11, referred to as WMP Sharing, so that manufacturers of networked audio/video devices can develop products that are highly interoperable with WMP Sharing. Concepts and techniques discussed in this paper include:

Baseline technologies, general architecture, and supported formats

Network configuration and addressing requirements

Device discovery and description

Access to WMP Sharing content

Microsoft Extensions to UPnP Metadata

Identifying codecs used to encode content

Setting device compatibility flags

Note that for some constructs in this paper, Augmented Backus-Naur Form (ABNF) is used to define syntax. ABNF syntax is defined in RFC 4234, available in “Resources” at the end of this paper.

Media Sharing Feature in Windows Media Player 11With the release of Windows Media Player 11 in Windows Vista™ and Windows XP SP2, Media Sharing technology has been integrated directly into WMP. This allows all users to share their WMP library content directly to network devices.

WMP Sharing provides several exciting new features for network devices:

Album art and enhanced metadata are exposed.

Performance has been enhanced to accommodate larger media libraries.

Devices can receive and play WMP auto-playlists.

Streaming capabilities are improved with the addition of Real-Time Streaming Protocol/Real-Time Transport Protocol (RTSP/RTP).

Content filtering has improved with personal and parental ratings.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 5: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 5

Baseline TechnologiesWMP Sharing is based on a core set of network protocols, codecs, and related technologies. These baseline technologies form the foundation for interoperability with WMP Sharing.

Table 1. Baseline Technologies for WMP SharingLayer Protocol/technology

Codecs Audio: WMA, MP3, LPCM, WAV

Video: WMV, VC-1, MPEG-1, MPEG-2, AVI, DVR-MS

Photo: JPEG, PNG, YUV

Content Services Windows Media Digital Rights Management (DRM) 10 for Network Devices, Windows Media Player metadata store

Control, Discovery, and Eventing UPnP MediaServer:1 (including Microsoft Extensions to UPnP Metadata), UPnP 1.0, RTSP, and RTCP

Audio/Video Transport Hypertext Transfer Protocol (HTTP) and RTP

Network Protocols Transmission Control Protocol/User Datagram Protocol/Internet Protocol (TCP/UDP/IP)

Architecture OverviewWMP Sharing consists of multiple logical components, as shown in Figure 1.

WINDOWS MEDIA PLAYER NETWORK SHARING SERVICE

(WMPNSS)

WMP database provider

WMP Sharing(UPnP MediaServer:1)

ContentDirectory:1

ConnectionManager:1

Media Delivery Engine

NetworkDevice

Metadata

c:\foo.wma

UPnP discoverybrowse/search

Content request & delivery

Figure 1. WMP Sharing Architecture

WMP Sharing is a UPnP MediaServer:1 fully compliant with the UPnP ContentDirectory:1 and ConnectionManager:1 service types. Accordingly, WMP Sharing supports all of the required actions and state variables for these two services. As part of the Content Directory service, the optional A_ARG_TYPE_SearchCriteria and ContainerUpdateIDs state variables, as well as the optional UPnP Search action, are supported. The latter, in particular, allows device manufacturers to provide a richer multimedia experience for their users. WMP Sharing also supports the X_MS_MediaReceiverRegistrar:1 UPnP service,

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

X_MS_MediaReceiverRegistrar:1

Page 6: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 6

which is used for Windows Media DRM authorization and registration and is discussed later in this paper.

The WMP database provider supplies all of the metadata that is shared to network devices and allows enumeration and search of WMP library content. Metadata can be sourced from WMP metadata providers, from user input, or from a variety of other sources.

As indicated by the dotted box in the Figure 1, each user that has enabled WMP Sharing has a separate instance of the WMP database provider and MediaServer. The WMP database provider also interacts with the file system to update the metadata that is associated with a given media file.

The Media Delivery Engine is responsible for providing the streaming format support for WMP Sharing—retrieving content from the file system and delivering it to the networked device by using the supported streaming protocols described later in this paper. The Media Delivery Engine also communicates with other Windows media components to provide transcoded versions of shared media content when requested to do so by the device.

Collectively, these components form WMP Sharing, also known as Windows Media Player Network Sharing Service (WMPNSS). It is represented by a single executable—wmpnetwk.exe—that runs as a network service on the host machine.

Supported FormatsWMP Sharing supports the distribution of audio, picture, and video content, as well as playlists. The following sections describe the formats that are supported for each content type, including the associated file extension and Multipurpose Internet Mail Extensions (MIME) type.

WMP Sharing does not expose content for which the MIME type cannot be determined.

For a device to play a format supported by WMP Sharing, the device must also support the codec appropriate to the format. Note that various codecs can be used for some formats such as WAV and AVI.

AudioWMP Sharing supports the audio formats shown in Table 2.

Table 2. Supported Audio FormatsFormat File extension MIME type

WMA .wma audio/x-ms-wma

MPEG-1 Layer 3 .mp3 audio/mpeg

WAV .wav audio/wav

LPCM N/A audio/L16

Note that the audio/L16 MIME type should include additional parameters specifying the sample rate and number of audio channels. These additional parameters are separated from the MIME type header by semicolons, as shown in the following example: “audio/L16;rate=44100;channels=2”. WMP Sharing will exclude these additional PCM parameters if the “WMC_COMPAT_EXCLUDE_PCMPARAMS” flag is set for the device. For more information on compatibility flags, see “Setting Compatibility Flags” later in this paper.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 7: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 7

PicturesWMP Sharing supports the picture formats shown in Table 3.

Table 3. Supported Picture Formats

Format File extension MIME type

JPEG .jpg image/jpeg

PNG .png image/png

RAW (codec specific) (codec specific)

RAW format support is available only on Windows Vista. For more information on RAW format support, see “Additional Formats” later in this paper.

VideoWMP Sharing supports the video formats shown in Table 4.

Table 4. Supported Video Formats

Format File extension MIME type

WMV .wmv video/x-ms-wmv

MPEG-2 .mpeg, .mpg video/mpeg

MPEG-1 .mpeg, .mpg video/mpeg

AVI .avi video/avi

DVR-MS .dvr-ms video/x-ms-dvr

Update Note: To enable sharing of DVR-MS (.dvr-ms) video files, a Microsoft-supported hotfix must be downloaded and installed. For more information, see Microsoft Knowledge Base article 941282.

PlaylistsWMP Sharing supports the playlist formats shown in Table 5.

Table 5. Supported Playlist FormatsFormat File extension MIME type

Windows Media Playlist .wpl, .asx n/a

M3U .m3u n/a

A Windows Media Playlist file can appear as a subcontainer under the Playlist container in each of the top-level nodes. A M3U playlist file appears as a subcontainer under the Music\Playlist container, as well as under the Playlists\All Playlists container. Each playlist subcontainer contains the individual items that are associated with the corresponding playlist file and are exposed as UPnP objects by WMP Sharing.

Additional FormatsFormat support in WMP is extensible. Media formats such as MPEG-4, H.264, or RAW, for example, can be added to WMP by installing the appropriate codec and creating the appropriate registry keys on the system running WMP. Formats that are supported and playable/viewable in WMP are also supported by WMP Sharing. For more information, refer to “Resources” at the end of this paper.

As an example, for WMP Sharing to expose RAW format images, the codec that is appropriate to the RAW format that the particular camera or camera manufacturer uses must be installed on the Windows Vista system. Although RAW formats may be exposed under the general “image/dcraw” MIME type, the MIME type (and associated file extension) that are specific to each RAW format codec must also be

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 8: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 8

provided. Table 6 provides examples of current RAW formats for which Windows Vista codecs are available.

Table 6. Available RAW Formats for Windows Vista

RAW format File extension MIME type

NikonSonySonyOlympusCanon

.nef

.sr2

.srf

.orf

.cr2

image/x-nikon-nefimage/x-sony-sr2image/x-sony-srfimage/x-olympus-orfimage/x-canon-cr2

Supported Streaming ProtocolsWMP Sharing on Windows Vista supports HTTP and RTSP/RTP protocols for delivering content to devices. WMP Sharing on Windows XP supports streaming only via HTTP.

PlaysForSure Network DevicesThe PlaysForSure for Network Devices program is for manufacturers that want to create network audio and video devices that interoperate with WMP and PlaysForSure services, delivering premium content to end users.

PlaysForSure defines a set of requirements that provide a baseline-level of functionality for a network device in terms of design, components, and functionality. Compliance with PlaysForSure requirements, such as using only certified Windows Media audio/Windows Media video (WMA/WMV) decoders, supporting Windows Media DRM for Network Devices and implementing UPnP technologies, ensures a significant level of interoperability with WMP Sharing.

Several updates have been made in the version 2 PlaysForSure Requirements for Network Devices, including the addition of Digital Living Network Alliance (DLNA) conformance, expansion of performance requirements, addition of high-definition video requirements, provision of more stringent UPnP eventing, and alignment with the Media Center Extender program.

The PlaysForSure Requirements for Network Devices are divided into several major categories, including DLNA conformance, network connectivity, and discovery, device description, authorization and registration, user interface, and content playback. These requirements are verified by the PlaysForSure for Network Devices Test Kit.

The PlaysForSure for Network Devices program does not require a network device to be certified as DLNA Digital Media Player (DMP). However, DLNA 1.0 requirements that are mandatory for a DLNA DMP, as well as several “optional” DMP requirements, are mandatory requirements for the PlaysForSure program.

For network device manufacturers, participation in the PlaysForSure program provides access to the Certified for Windows Vista logo. Network devices certifying under the PlaysForSure 2.x requirements are eligible to use the Certified for Windows Vista logo.

For more information of PlaysForSure and the Certified for Windows Vista logo, see “Resources” at the end of this paper.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 9: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 9

Supported Versions of Microsoft WindowsThe following list includes the Microsoft Windows operating systems on which WMP 11 Media Sharing is available:

Windows XP Service Pack 2 (requires download of WMP 11)

Windows Vista Home Basic

Windows Vista Home Premium

Windows Vista Ultimate

Windows Vista Business

Windows Vista Enterprise

Accessing the Media Sharing Feature in Windows VistaThere are three methods for accessing the Media Sharing feature from within Windows Vista:

WMP 11On the Library tab, click Media Sharing. Note that this access method is the only way to access Media Sharing feature on Windows XP.

Windows Photo GalleryOn the File menu, click Share with devices. This access point opens the Windows Media Player Media Sharing dialog box.

Network ExplorerRight-click the icon for a UPnP MediaRenderer device, as illustrated in Figure 2. From the pop-up menu, select the Open media sharing menu item. This access point opens the Windows Media Player Media Sharing dialog box.

Figure 2. Network Explorer Icons for a UPnP MediaRenderer and MediaServer, respectively

In Windows Vista, WMP Sharing starts automatically if a “private” network profile is selected when a user connects to a new network. Windows XP does not use the network profile concept; after WMP 11 is installed, WMP Sharing starts only after the user enables Media Sharing. If Windows Media Connect was installed on Windows XP, WMP Sharing is enabled for all users who had previously enabled sharing.

WMP Sharing and DLNA DevicesDLNA is an industry forum of over 200 member companies in the computing and consumer electronics industries, dedicated to enabling device interoperability in the home media ecosystem. Built upon UPnP and other technologies, the DLNA Interoperability Guidelines provide a framework for this interoperability.

Although WMP Sharing includes DLNA tags and resource elements for media that it exposes to other devices and its device description document on both Windows XP and Windows Vista advertises support for DLNA with the inclusion of the <dlna:X_DLNADOC> element, WMP 11 does not fully support DLNA Guidelines as a DLNA Digital Media Server (DMS) device.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 10: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 10

Network Configuration and AddressingWMP Sharing uses a standard IP network for communicating with devices.

Physical LayerWMP Sharing operates over any IP-based network. For improved usability, it is recommended that all devices use an Ethernet (802.3) or Wi-Fi connection (802.11 b for music and pictures and 802.11 g/a for video) for device connectivity.

IP AddressesWMP Sharing supports sharing content to devices with either an IPv4 or IPv6 IP address.

If the device has a private IP address, it must be within the ranges in Table 7.

Table 7. Private IP Address Ranges

IP address type Range

Class C Private IP addresses 192.168.0.0 – 192.168.255.255

Class B Private IP addresses 172.16.0.0 – 172.31.255.255

Class A Private IP addresses 10.0.0.0 – 10.255.255.255

AutoIP addresses 169.254.1.0 – 169.254.255.255

Network SecurityTo prevent the illegal distribution of content and invasion of consumers' privacy, WMP Sharing has the following network security restrictions.

Same SubnetWMP Sharing shares content only to devices on the same subnet as the computer on which WMP Sharing is running. WMP Sharing compares the subnet of a device’s IP address to the subnet of the WMP Sharing computer. If they are not the same, the device is not allowed to browse, search, or play content.

Devices can check the source IP address of incoming Simple Service Discovery Protocol (SSDP) announcements from WMP Sharing to confirm that the device and the computer are on the same subnet and alert the user if they are not.

IP Packet TTLWMP Sharing sets all outgoing packets with a time-to-live (TTL) of 1 (one) which means that IP packets can cross only one router.

Firewall RequirementsWMP Sharing requires several TCP and UDP firewall ports to be open on the host computer to share media content to devices. WMP places entries in the registry so that firewalls can determine whether to open or close the ports that WMP Sharing uses.

Windows Firewall running on Windows Vista provides “preplumbed” exceptions that allow all of the ports that are required for WMP Sharing. These exceptions are automatically enabled on selection of a “private” network profile and are disabled on selection of a “public” network profile. For Windows Firewall on Windows XP, exceptions for each of the ports required by WMP Sharing are installed with WMP 11 and are individually enabled when Media Sharing is enabled in WMP, For

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 11: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 11

domain-joined systems, group policy may prevent a user from enabling the Windows Firewall exceptions that WMP Sharing requires.

For more details on where to find the firewall port registry settings, as well as a list of the required ports that must be opened, refer to “Resources” at the end of this paper.

Device Discovery and DescriptionDiscovery is the process through which UPnP devices announce their presence and find other devices. This is accomplished through the use of SSDP.

WMP Sharing announces itself as a MediaServer device by using SSDP, sending out two SSDP NOTIFY messages every 15 minutes. WMP Sharing also responds to any properly formatted M-SEARCH action searching for a MediaServer. Sample SSDP NOTIFY messages are shown in Appendix 1.

In addition to other information, WMP Sharing provides a manufacturer name, model name, and model number in its device description. The model number for WMP Sharing differs, depending on the operating system. The model number for WMP Sharing in Windows Vista is 4.0, and in Windows XP the model number is 3.0. For both operating systems, the manufacturer name is Microsoft and the model name is Windows Media Player Sharing.

WMP Sharing attempts to discover compatible devices on the network by examining UPnP SSDP NOTIFY announcements or responses to M-SEARCH actions. For a device to be discovered, it must implement the UPnP MediaRenderer:1 device class. Compatible devices include UPnP MediaRenderers and UPnP Control Points.

UPnP MediaRenderers are recognized by a combination of MAC address and Unique Device Name (UDN). When WMP Sharing discovers a MediaRenderer device, the MAC/UDN pair of the device is compared to a stored list. If the MAC/UDN pair is not in this list, WMP Sharing stores the MAC/UDN pair in the list and presents the device as a new device.

UPnP Control Points are recognized only by MAC address. When WMP Sharing discovers a Control Point device, the MAC address of the device is compared to a stored list. If the MAC address is not in this list, WMP Sharing stores the MAC address for this device in the list but does not announce the device as a new device.

MediaRenderers must a supply a Unicode transformation format (UTF)-encoded UDN containing a 128-bit value in hexadecimal form. The ABNF syntax for the UDN is defined as follows:

uuid-value = 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 15HEXDIGUDN = "uuid:" uuid-value

Example:uuid:11223344-1122-1122-123456789ABCDEF

After a MediaRenderer has been authorized, the device is automatically unauthorized if either the MAC address or UDN change for that device.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 12: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 12

WMP Sharing User Interface ElementsWhen WMP Sharing initially discovers a compatible device, the user receives a device notification in the Windows Vista or Windows XP user interface (unless the appropriate compatibility flag has been set to suppress notifications for the connecting device—refer to the section on compatibility flags later in this paper.)

Figure 3. WMP Sharing Device Notification in Windows Vista

In Windows XP, the user must enable WMP Sharing before device notifications are shown. If Windows Media Connect was present at the time of WMP 11 installation, device notifications are enabled when WMP is installed.

Clicking the device notification (or alternatively on the WMP Sharing tray icon) opens the Windows Media Player Library Sharing dialog box, which allows the user to immediately Allow or Deny that specific device.

Figure 4. Windows Media Player Library Sharing Dialog Box

Clicking Sharing settings on the Windows Media Player Library Sharing dialog box without choosing to Allow or Deny the device opens the Media Sharing dialog box shown in Figure 5. This is the same Media Sharing dialog box that is invoked via the WMP user interface or one of the other methods described earlier in this paper. The device is shown in the list of available devices with a yellow exclamation point icon, indicating that the user must take action on that device.

Figure 5. Windows Media Player Media Sharing Dialog Box

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 13: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 13

Device Description DocumentThe majority of the information appearing in the WMP Sharing user interface is acquired from a UPnP MediaRenderer’s device description document. Every device should host a device description document so that WMP Sharing can examine the device properties. For a device to be discovered by WMP Sharing, it must host its own device description document.

MediaRenderers that do not provide a description document can only be recognized by their MAC address and will be identified as “Unknown Device.”

Figure 6. Device Notification for an "Unknown Device"

Figure 7. Device Properties Page for an "Unknown Device"

WMP Sharing expects icons represented in the device description to be 48×48 pixels with a color depth of 24 bits. Acceptable formats for icons include ICO, BMP, GIF, JPEG, PNG, and TIFF. If a 48×48 pixel icon is unavailable, the icon closest in size is used. The icon URLs must have the same host as the device URL host. Devices with no icon are represented by a generic device icon.

Device AuthorizationDevice authorization is the process by which a user grants a device permission to receive shared content from the computer running WMP Sharing. Devices must first be “Allowed” access to WMP Sharing before retrieving or playing media items. The user interface for accessing device authorization is the Media Sharing dialog box in WMP 11, as shown in Figure 5. For more information about device authorization, refer to the “Change settings for sharing media in Windows Media Player” topic in WMP 11 Help.

Windows Media DRM Authorization and RegistrationThe authorization process required by Windows Media DRM for Network Devices (also known as WMDRM-ND) is different from the authorization process described in the previous section. In the context of WMP Sharing, authorization is the procedure by which a network device is granted access to Windows Media DRM-

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 14: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 14

protected content from WMP Sharing. Authorization must be completed before a device can perform registration and access Windows Media DRM-protected content.

Authorization and registration use the X_MS_MediaReceiverRegistrar:1 UPnP service, which is defined in Appendix 1 of the “Windows Media DRM for Network Devices Specification.” Details describing how a device uses and interacts with the service are found in the WMDRM-ND specification, which is available only to licensees of Windows Media DRM. Links to Windows Media DRM licensing information can be found in "Resources" at the end of this paper.

Accessing WMP SharingMedia content to be exposed by WMP Sharing can be located by using either the UPnP Browse or Search actions. Understanding how WMP Sharing structures its containers, how query results may be sorted or filtered, what metadata may be available, and what other properties it exposes is paramount to providing a high-quality user experience.

BrowsingBrowse allows a device to examine the hierarchy of content that WMP Sharing exposes. To provide the best user experience on devices using the browse action, it is useful for the device to be aware of the WMP container hierarchy.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 15: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 15

Container HierarchyFigure 8 illustrates the container hierarchy used by WMP, including the “top-level” containers for Music, Video, Pictures and Playlists (plus the Root) and their respective subcontainers.

ROOT(0)

MUSIC(1)

PLAYLISTS(12)

PICTURES(3)

VIDEO(2)

All Music (4)

Contributing Artists (100)

Rating (101)

Album Artist (107)

Composer (108)

Folders (14)

Playlists (F)

Album (7)

Artist (6)

Genre (5)

All Video (8)

Rating (200)

Folders (15)

Playlists (10)

Series (E)

Actor (A)

Genre (9)

All Pictures (B)

Rating (300)

Folders (16)

Playlists (11)

Keyword (D2)

Albums (D)

Date Taken (C)

All Playlists (13)

Folders (17)

1+ stars (301)

Unrated (306)

2+ stars (302)

3+ stars (303)

4+ stars (304)

5+ stars (305)

1+ stars (201)

2+ stars (202)

3+ stars (203)

4+ stars (204)

5+ stars (205)

1+ stars (102)

2+ stars (103)

3+ stars (104)

4+ stars (105)

5+ stars (106)

Figure 8. WMP Sharing Container Hierarchy

Tables 8 through 11 describe each of the containers depicted in Figure 8, including the container name and ID number, as well as a description of the container and container type.

Table 8. Top-Level Containers

Container name ID Child type Description

Root 0 object.container Is the root container of the entire container hierarchy

Music 1 object.container Contains all containers and items relating to audio

Video 2 object.container Contains all containers and items relating to video

Pictures 3 object.container Contains all containers and items relating to pictures

Playlists 12 object.container Contains all containers and items relating to playlists

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 16: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 16

Table 9. Music SubcontainersSubontainer name

ID Child type Description

Music/All Music 4 object.item.audioItemobject.item.audioItem.musicTrack

Contains all of the music items in the Music container

Music/Genre 5 object.container.genre.musicGenre Contains genre information for all music items that have genre metadata

Music/Artist 6 object.container.person.musicArtist Contains artist names for all music items that have artist metadata

Music/Album 7 object.container.album.musicAlbum Contains album titles for all music items that have album metadata

Music/Playlists F object.container.playlistContainer Contains playlists for all music items

Music/Folders 14 object.storageFolder

Music/Contributing Artists

100 object.container.person.musicArtist Contains artist names for all music items that have contributing artist metadata

Music/Album Artist 107 object.container.person.musicArtist Contains artist names for all music items that have album artist metadata

Music/Composer 108 object.container.person.musicArtist Contains artist names for all music items that have composer metadata

Music/Rating 101 object.container

Music/Rating/1 or more stars

102 object.container Contains music items rated with 1 or more stars

Music/Rating/2 or more stars

103 object.container Contains music items rated with 2 or more stars

Music/Rating/3 or more stars

104 object.container Contains music items rated with 3 or more stars

Music/Rating/4 or more stars

104 object.container Contains music items rated with 4 or more stars

Music/Rating/5 or more stars

106 object.container Contains music items rated with 5 or more stars

Table 10. Video SubcontainersSubcontainer name

ID Child type Description

Video/All Video 8 object.item.videoItem Contains all of the video items in the Video container

Video/Genre 9 object.container.genre.videoGenre Contains genre information for all video items that have genre metadata

Video/Actor A object.container.album.videoAlbum Contains actor names for all video items that have actor metadata

Video/Series E object.container.person.movieActor Contains album titles for all video items that have album metadata

Video/Playlists 10 object.container.playlistContainer Contains playlists for all video items

Video/Folders 15 object.storageFolder

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 17: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 17

Subcontainer name

ID Child type Description

Video/Rating 200 object.container

Video/Rating/1 or more stars

201 object.container Contains video items rated with 1 or more stars

Video/Rating/2 or more stars

202 object.container Contains video items rated with 2 or more stars

Video/Rating/3 or more stars

203 object.container Contains video items rated with 3 or more stars

Video/Rating/4 or more stars

204 object.container Contains video items rated with 4 or more stars

Video/Rating/5 or more stars

205 object.container Contains video items rated with 5 or more stars

Table 11. Picture SubcontainersSubcontainer name

ID Child type Description

Pictures/All Pictures

B object.item.imageItem.photoobject.item.imageItem

Contains all of the image items in the Pictures container

Pictures/Date Taken

C object.container.album.photoAlbum Contains the dates that pictures were taken for all image items that have date-taken metadata

Pictures/Albums D object.container.album.photoAlbum Contains album titles for all image items that have album metadata

Pictures/Keyword D2 object.container.album.photoAlbum Contains album titles for all image items that have keyword metadata

Pictures/Playlists 11 object.container.playlistContainer Contains playlists for all picture items

Pictures/Folders 16 object.storageFolder

Pictures/Rating 300 object.container

Pictures/Rating/1 or more stars

301 object.container Contains image items rated with 1 or more stars

Pictures/Rating/2 or more stars

302 object.container Contains image items rated with 2 or more stars

Pictures/Rating/3 or more stars

303 object.container Contains image items rated with 3 or more stars

Pictures/Rating/4 or more stars

304 object.container Contains image items rated with 4 or more stars

Pictures/Rating/5 or more stars

305 object.container Contains image items rated with 5 or more stars

Pictures/Rating/Unrated

306 object.container Contains image items that have not been star rated

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 18: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 18

Table 12. Playlist SubcontainersSubcontainer name

ID Child type Description

Playlists/All Playlists

13 object.container.playlistContainer Contains playlists for all items

Playlists/Folders 17 object.storageFolder

SearchingWMP Sharing supports the optional UPnP Search action. Using search instead of browse can be used to filter out unwanted content. The use of the search action can also provide a more robust user interface and user experience.

If metadata is not present for the file on the computer, the value for these properties are treated as NULL.

Some searchable metadata in WMP Sharing does not support UPnP-required operators. In addition, “compound” searches, such as the following example, are not supported:

upnp:class derivedfrom "object.item.videoItem" or dc:creator = “Bill"

As a result, WMP Sharing is not fully UPnP-compliant with respect to search. Devices supporting search parameters outside the scope of WMP Sharing may use the compatibility flags, described later in this paper, to disable search.

The list of searchable and nonsearchable attributes are presented in Tables 13 and 14. The supported operators for searchable attributes are also presented. The operator “exists” is supported for all searchable attributes. If “all” is indicated, supported operators include the following:

exists, < , < = , > = , > , = , !=, contains, derivedfrom, doesNotContain

Table 13. Searchable AttributesMetadata Supported operators

@id =. !=

@refID exists

@restricted =, !=, contains

dc:creator all

dc:date < , < = , > = , > , = , !=

dc:description all

dc:language all

dc:publisher all

dc:title all

microsoft:artistAlbumArtist all

microsoft:artistConductor all

microsoft:artistPerformer all

microsoft:authorComposer all

microsoft:authorOriginalLyricist all

microsoft:authorWriter all

microsoft:serviceProvider all

microsoft:userEffectiveRating < , < = , > = , > , = , !=

microsoft:userEffectiveRatingInStars < , < = , > = , > , = , !=

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 19: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 19

Metadata Supported operators

microsoft:userRating < , < = , > = , > , = , !=

microsoft:userRatingInStars < , < = , > = , > , = , !=

res@bitrate < , < = , > = , > , = , !=

res@duration < , < = , > = , > , = , !=

res@protection =, contains

res@protocolInfo =, contains, !=, doesNotContain

res@size < , < = , > = , > , = , !=

upnp:actor all

upnp:album all

upnp:artist =, contains

upnp:artist@role =, contains

upnp:author =, contains

upnp:author@role =, contains

upnp:class =, derivedfrom

upnp:director all

upnp:genre all

upnp:originalTrackNumber all

upnp:producer all

upnp:rating all

upnp:toc all

upnp:userAnnotation all

Table 14. Nonsearchable AttributesNonsearchable attributes

@childCount@parentID@searchabledescdesc@iddesc@namespacedesc@typemicrosoft:sourceURLmicrosoft:yearresres@bitsPerSample

res@colorDepthres@microsoft:codecres@nrAudioChannelsres@resolutionres@sampleFrequencyupnp:albumArtURIupnp:albumArtURI@dlna:profileIDupnp:searchClassupnp:searchClass@includeDerivedupnp:writeStatus

SortingWMP Sharing supports sorting containers and content items based on many metadata attributes. The list of sortable and nonsortable attributes are presented in Tables 15 and 16.

Note that “top-level” containers may not be sorted.

Table 15 Sortable AttributesSortable attributes

dc:creatordc:datedc:description

microsoft:userRatingmicrosoft:userRatingInStarsmicrosoft:year

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 20: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 20

Sortable attributes

dc:languagedc:publisherdc:titlemicrosoft:artistAlbumArtistmicrosoft:artistConductormicrosoft:artistPerformermicrosoft:authorComposermicrosoft:authorOriginalLyricistmicrosoft:authorWritermicrosoft:serviceProvidermicrosoft:sourceURLmicrosoft:userEffectiveRatingmicrosoft:userEffectiveRatingInStars

res@bitrateres@durationres@sizeupnp:actorupnp:albumupnp:directorupnp:genreupnp:originalTrackNumberupnp:producerupnp:ratingupnp:tocupnp:userAnnotation

Table 16. Nonsortable Attributes

Nonsortable attributes

@childCount@id@parentID@refID@restricted@searchabledescdesc@iddesc@namespacedesc@typeresres@bitsPerSampleres@colorDepthres@microsoft:codecres@nrAudioChannels

res@protectionres@protocolInfores@resolutionres@sampleFrequencyupnp:albumArtURIupnp:albumArtURI@dlna:profileIDupnp:artistupnp:artist@roleupnp:authorupnp:author@roleupnp:classupnp:searchClassupnp:searchClass@includeDerivedupnp:writeStatus

FilteringWMP Sharing supports the filtering of containers and content.

Containers can be filtered through the use of the upnp:searchClass tag. A searchClass tag is provided for each UPnP object that can be found under a container. Devices can then use this information to determine whether to display a particular container.

Several methods can be employed to filter specific content. The device can inspect the file extension in the URL or the res@protocolInfo attribute and exclude content that represents unsupported file types.

Control points and MediaRenderers can also use the GetProtocolInfo action to inquire about the format and streaming capabilities of WMP Sharing. This action enables devices to filter out content that is supported by WMP Sharing, but not supported by the device.

When GetProtocolInfo is invoked, WMP Sharing (minimally) returns the following in a comma-separated list:

http-get:*:video/mpeg:*http-get:*:audio/mpeg:*http-get:*:audio/wav:*

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 21: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 21

http-get:*:audio/x-ms-wma*http-get:*:video/x-ms-wmv:*http-get:*:video/avi:*http-get:*:audio/L16:*http-get:*:audio/mp3:*http-get:*image/jpeg:*http-get:*image/png:*

String LengthsThe following fields should be 256 Unicode characters or less:

All upnp:class fields

All “recommended metadata” fields: dc:creator, upnp:album, upnp:genre, dc:date, upnp:channelName, and upnp:channelNR (regional)

All resource (<res>) attributes except uniform resource identifiers (URIs)

Object ID

The following fields should be 1024 Unicode characters or less:

All URIs

All fields not previously specified

Note that after conversion from Unicode to UTF-8, the number of bytes required to represent a string may be higher than the number of characters in the string. Device manufacturers should set buffer sizes accordingly.

Microsoft Extensions to UPnP MetadataMicrosoft Extensions to UPnP Metadata allow WMP Sharing to expose several Microsoft-defined media content properties. These properties are generally not expressible or are difficult to express with existing UPnP metadata attributes. To provide the desired query results with existing attributes requires additional processing capabilities on the device. By using these additional Microsoft-defined properties, the device is relieved of the “heavy-lifting” in generating similar results and can thus provide a richer media browsing experience to their users.

WMP Sharing supports searching and sorting on containers and content items based on these Microsoft-defined properties as indicated in the following sections, as well as in the corresponding "Searching" and "Sorting" sections earlier in this paper.

Although WMP Sharing supports all of the Microsoft Extensions to UPnP Metadata, these attributes are provided only when the corresponding information is available for a given media item.

For each attribute, a table is presented that contains the following information:

Attribute name as exposed by WMP Sharing

Corresponding attribute in the WMP database provider

Search, sort, and filter capability in WMP Sharing

Data type and valid range

An XML usage example is also provided for each attribute, if appropriate. In Windows Vista, WMP Sharing double-escapes the XML tags inside the descriptor (<desc>) element. For example, “<microsoft:artistAlbumArtist>” appears as “&lt;microsoft:artistAlbumArtist&gt;” in the XML response.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 22: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 22

For a link to the complete list of metadata attributes used by WMP 11, see "Resources" at the end of this paper.

Artist AttributesThis group of attributes supports various roles that one or more artists may have in multimedia content: album artist, performer (also known as a contributing artist), and conductor. Support for the Artist attributes can allow devices to provide results for queries such as “browse by performer, then find albums by the selected performer.”

The following three tables list properties of the Artist attributes.

Attribute artistAlbumArtist

WMP Attribute DisplayArtist

Searchable Yes

Sortable Yes

Filterable Yes

Type string

Valid Range 0 to 256 characters, inclusive

Attribute artistPerformer

WMP Attribute Author

Searchable Yes

Sortable Yes

Filterable Yes

Type string

Valid Range 0 to 256 characters, inclusive

Attribute artistConductor

WMP Attribute WM/Conductor

Searchable Yes

Sortable Yes

Filterable Yes

Type string

Valid Range 0 to 256 characters, inclusive

The following is an example of the usage of the Artist attributes in an XML response:

<desc id="Artist" xmlns:microsoft="urn:schemas-microsoft-com:metadata-1-0/WMPNSS/"> <microsoft:artistAlbumArtist>ABC</microsoft:artistAlbumArtist> <microsoft:artistPerformer>DEF</microsoft:artistPerformer> <microsoft:artistConductor>GHI</microsoft:artistConductor></desc>

Author AttributesThis group of attributes supports various roles that one or more authors may have in multimedia content: Composer and Writer. Support for the Author attributes can allow devices to provide results for queries such as “browse by composer, then find genres for the selected composer.”

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 23: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 23

The following two tables list properties of the Author attributes.

Attribute authorComposerWMP Attribute WM/ComposerSearchable YesSortable YesFilterable YesType stringValid Range 0 to 256 characters, inclusive

Attribute authorWriterWMP Attribute WM/WriterSearchable YesSortable YesFilterable YesType stringValid Range 0 to 256 characters, inclusive

Note that assigning a value to “Lyricist” in the WMP Advanced Tag Editor is shown as “Writer” in the WMP library and is also exposed by WMP Sharing through the authorWriter attribute.

The following is an example of the usage of the Author attributes in an XML response:

<desc id="Author" xmlns:microsoft="urn:schemas-microsoft-com:metadata-1-0/WMPNSS/"> <microsoft:authorComposer>JKL</microsoft:authorComposer> <microsoft:authorWriter>MNP</microsoft:authorWriter></desc>

Ratings AttributesThe Ratings attributes support metadata supplied from both the user and from the metadata provider. These attributes allow devices to provide “prioritized” or “scoped” results to end users based on their preferences. This enables a user, for example, to choose browsing only music content that has been rated at “5 or more stars.”

There are four Ratings-related attributes. UserRating and UserEffectiveRating represent the user rating (if present) and an automatic rating, respectively. If UserRating is set, the automatic rating is set to the UserRating. If UserRating is not set, the automatic rating is the rating set by the metadata provider. In the absence of a metadata provider rating, the automatic rating is derived from playcount and usage data.

UserRatingInStars and UserEffectiveRatingInStars are runtime-generated properties based on UserRating and UserEffectiveRating, respectively. The values for UserRatingInStars and UserEffectiveRatingInStars are generated by remapping the values from the corresponding base attributes into a logical number of stars.

The following four tables list properties of the Ratings attributes:

Attribute userRatingWMP Attribute UserRatingSearchable YesSortable YesFilterable Yes

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 24: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 24

Type Unsigned integerValid Range 0 - 99

Attribute userEffectiveRatingWMP Attribute UserEffectiveRatingSearchable YesSortable YesFilterable YesType Unsigned integerValid Range 0 - 99

Attribute userRatingInStarsWMP Attribute UserRatingStarsSearchable YesSortable YesFilterable YesType Unsigned integerValid Range 0 - 5

Attribute userEffectiveRatingInStarsWMP Attribute UserEffectiveRatingStarsSearchable YesSortable YesFilterable YesType Unsigned integerValid Range 0 - 5

The following is an example of the usage of the Ratings attributes in an XML response:

<desc id="UserRating" xmlns:microsoft="urn:schemas-microsoft-com:metadata-1-0/WMPNSS/"> <microsoft:userRating>50</microsoft:userRating> <microsoft:userEffectiveRating>60 </microsoft:userEffectiveRating> <microsoft:userRatingInStars>3</microsoft:userRatingInStars> <microsoft:userEffectiveRatingInStars>3 </microsoft:userEffectiveRatingInStars></desc>

Service Provider AttributeThe Service Provider attribute supports the WM/ContentDistributor metadata in WMP and represents the name of the distributor of the media item. The Service Provider attribute allows devices to return results categorized by the entity that provided the content.

The following table lists properties of the Service Provider attribute:

Attribute serviceProviderWMP Attribute WM/ContentDistributorSearchable YesSortable YesFilterable YesType stringValid Range 0 to 256 characters, inclusive

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 25: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 25

The following is an example of the usage of the Service Provider attribute in an XML response:

<desc id="ServiceProvider" xmlns:microsoft="urn:schemas-microsoft-com:metadata-1-0/WMPNSS/"> <microsoft:serviceProvider>Windows Vista </microsoft:serviceProvider></desc>

Source URL AttributeThe Source URL attribute supports the grouping of results by address. This enables a device to group media files by parent folder. As an example, the device can return results enumerating all of the pictures in the “January Ski Trip to Canada” folder.

Note The use of @ParentID can provide results similar to Source URL, but only for a container hierarchy that replicates the filesystem hierarchy.

In consideration of privacy and security concerns, the value for Source URL is not returned by WMP Sharing. Source URL is used only for sorting queries sent to the WMP database provider.

The following table lists properties of the Source URL attribute:

Attribute sourceURLWMP Attribute SourceURLSearchable NoSortable YesFilterable NoType stringValid Range 0 to 256 characters, inclusive

Year AttributeThe Year attribute allows organization of multimedia content based solely on year, whereas the commonly-used dc:date UPnP attribute provides the whole date. For example, use of the Year attribute enables a device to more easily return results for all of the pictures taken in “2006.”

The following table lists properties of the Year attribute:

Attribute yearWMP Attribute DefaultDateSearchable NoSortable YesFilterable YesType integerValid Range

The following is an example of the usage of the Year attribute in an XML response (in Windows Vista):

<desc id="year" xmlns:microsoft="urn:schemas-microsoft-com:metadata-1-0/WMPNSS/"> &lt;microsoft:year&gt;2007&lt;/microsoft:year&gt;</desc>

Retrieving Album Art and Thumbnail ImagesWMP Sharing can provide album art images for music and video content, as well as thumbnail images for picture content. By having WMP Sharing supply the

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 26: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 26

thumbnails, the device is relieved of the processing requirements that are necessary to generate thumbnail images on the fly.

To retrieve album art for music items, the device must complete Windows Media DRM registration and validation by using the X_MS_MediaReceiverRegistrar service as described earlier in this paper. There are no Windows Media DRM requirements to retrieve thumbnails for picture or video content.

WMP Sharing provides a thumbnail URI for all images that support transcoding. The most direct method for thumbnail retrieval is for the device to use the resource (<res>) element with the image of the desired format and resolution. For every JPEG and YUV image, WMP Sharing exposes at least one “thumbnail version” of the image with a resolution less than or equal to 160x160 pixels.

The other two specific methods for retrieving thumbnail images from WMP Sharing are described in the following sections.

AlbumArtURIWMP stores a JPEG-format thumbnail in its cache for each item in its library. WMP Sharing exposes these thumbnails through the <upnp:albumArtURI> attribute. Devices can use the URI provided by this attribute to retrieve the thumbnail image.

Because thumbnails retrieved by using the <upnp:albumArtURI> attribute come from the WMP cache, this method tends to provide faster results to the device. However, if the device calling this method requires thumbnails in a format other than JPEG, the alternate method may be more suitable.

Parameterized URLsA parameterized URL can be used by a device to specify the desired values for the thumbnail image. The parameterized thumbnail URL is expressed as the root item URL appended with “?format=z,width=x,height=y”, where z is either JPEG or YUV420 and x, y are integers representing the width and height for the desired thumbnail, respectively, in pixels.

The following example shows the use of a parameterized URL to retrieve a thumbnail:

http://192.168.1.1:10243/WMPNSSv4/5678/pic1.jpg?format=JPEG, width=64,height=48

Because thumbnails retrieved by using a parameterized URL must be transcoded from the original image, this method tends to provide slower results to the device than AlbumArtURI. However, this method provides additional flexibility in that the format and size of the thumbnails can be specified in advance.

Format TranscodingAs discussed earlier in this paper, WMP Sharing uses the Media Delivery Engine to deliver transcoded media content—content converted from one format to another—to the requesting device.

When WMP Sharing exposes a media file to a device, it provides multiple resource elements for the content. One resource element specifies an URL for the content in its original format. The subsequent resource elements each specify an URL for a transcoded version of the content.

For an example illustrating multiple resource elements for transcoded content, refer to Appendix 2.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 27: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 27

Table 17 indicates transcoded formats exposed by WMP Sharing.

Table 17. Supported Transcoding Formats by Content Type

Content type Starting format to transcoded format

Audio WMA to PCMMP3 to PCM

Pictures JPG to YUVPNG to JPGPNG to YUV

Video No transcoding available

Support for “Trick Modes” and Seeking Using HTTP “Seeking” is a feature that gives the user the ability to jump from one point in the stream to another at the time of rendering. “Trick mode” features include fast-forward and rewind operations and can be implemented by the server or the client. Server-based trick modes require stream modifications performed by the server. Client-side trick modes are performed by devices retrieving the entire stream or segments of the stream for processing.

For clear content, WMP Sharing supports seeking using a conventional HTTP Range request as defined in section 14.35 of the HTTP 1.1 specification. It also supports the DLNA-defined HTTP extension header “TimeSeekRange.DLNA.org.” WMP Sharing, however, does not support both methods for a single content item. The device must verify the appropriate seek method before attempting to seek within the content item. For content streamed by using Windows Media DRM for Network Devices, seeking requires the use of the “TimeSeekRange.DLNA.org” header.

WMP Sharing does not support server-side trick modes over HTTP. For clear or protected content that is retrieved from WMP Sharing in whole or in part on the device, device manufacturers may implement client-side trick modes at their discretion. For example, a device could implement support for trick modes by sending multiple Range header or multiple TimeSeekRange.dlna.org header requests in accordance with the preceding paragraph.

Identifying CodecsThe “res@microsoft:codec” attribute contains a globally unique identifier (GUID) that represents the codec used for the associated media file. For audio content, the GUID represents the audio codec used; for video content, it represents the video codec used. In the case of content that contains both audio and video, the GUID represents only the video codec used. This attribute is presented within a resource (<res>) element by using the following ABNF syntax:

guid-value = "{" 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 12HEXDIG "}"MsftCodec = "microsoft:codec=" %x22 guid-value %x22

Example:microsoft:codec="{11223344-1122-1122-1122-AABBCCDDEEFF}"

This attribute must also contain the following namespace definition:xmlns:microsoft="urn:schemas-microsoft-com:WMPNSS-1-0/"

The res@microsoft:codec attribute is not searchable or sortable; however, this property is returned with Browse results if explicitly requested in the Filter list or if “*” is used for the Filter parameter.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 28: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 28

The following example indicates that the audio in the associated media file was encoded with the Windows Media Audio 9 Lossless codec:

<res size="1472902" duration="0:03:59.465" bitrate="6003" protocolInfo="http-get:*:audio/x-ms-wma:*" sampleFrequency="44100" bitsPerSample="16" nrAudioChannels="2" microsoft:codec="{00000163-0000-0010-8000-00AA00389B71}" xmlns:microsoft="urn:schemas-microsoft-com:WMPNSS-1-0/" ... </res>

Links to the list of GUID values as well as the corresponding descriptions of the various media types can be found in "Resources" at the end of this paper.

Setting Compatibility FlagsCompatibility flags are used to define specific behavior for a specific device to enhance compatibility with WMP Sharing. The following two types of compatibility flags may be stored in the registry for any device.

User Compatibility FlagsThe User Compatibility flags are, accordingly, set by a user or by an application. This category of compatibility flags is given highest priority in defining behavior for a device:

Registry Path = HKLM\Software\Microsoft\Windows Media Player NSS\3.0\Devices\<DeviceMACAddress>\CompatFlagsType = REG_DWORD

Device Compatibility FlagsDevice Compatibility flags are provided by a device via its device description document. To do so, the device must specify the Microsoft-defined microsoft:X_DeviceCaps attribute. This category of compatibility flags are prioritized after user compatibility flags:

Registry Path = HKLM\Software\Microsoft\Windows Media Player NSS\3.0\Devices\<DeviceMACAddress>\DeviceCompatFlagsType = REG_DWORD

Compatibility Flag Values and BehaviorsThe following are the value and description of each individual compatibility flag:

WMC_COMPAT_EXCLUDE_HTTPValue = 0x0001

Exclude HTTP URLs. If set with WMC_COMPAT_EXCLUDE_RTSP, then HTTP URLs are allowed.

WMC_COMPAT_EXCLUDE_RTSPValue = 0x0002

Exclude RSTP URLs.

WMC_COMPAT_EXCLUDE_DLNAValue= 0x0004

Exclude all DLNA tags.

WMC_COMPAT_EXCLUDE_DLNA_1_5Value = 0x0008

Exclude DLNA 1.5 tags, but allow DLNA 1.0 tags.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 29: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 29

WMC_COMPAT_EXCLUDE_PCMPARAMSValue= 0x0010

Exclude rate and channels information from the protocolInfo res element for audio/L16 and audio/L8 MIME types.

WMC_COMPAT_EXCLUDE_WMDRMNDValue = 0x0020

Do not generate URLs for WMDRM protected media.

WMC_COMPAT_INCLUDE_RTSP_FOR_VIDEOValue = 0x0040

Include RTSP URLs for video even if WMC_COMPAT_EXCLUDE_RTSP or WMC_COMPAT_EXCLUDE_DLNA_1_5 is set.

WMC_COMPAT_EXCLUDE_WMALOSSLESS_NONTRANSCODEDValue = 0x0080

Do not generate URLs for nontranscoded WMA Lossless content.

WMC_COMPAT_EXCLUDE_SEARCHValue = 0x0100

Return no search capabilities (empty string) to this device.

WMC_COMPAT_DO_NOT_POP_TOASTValue = 0x0200

Do not display device notifications (also called “toast”) for this device.

WMC_COMPAT_PLAYLIST_FAKECHILDCOUNTValue = 0x1000

Return "1" for the child count of playlists because calculating the "real" child count for playlist containers can reduce performance.

X_DeviceCaps ExampleDevice compatibility flags are specified in a device description document by using the following format:

<device> <UDN>uuid:00000000-1111-2222-3333-444444444444</UDN> <friendlyName>Sample Renderer</friendlyName> <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1 </deviceType> <manufacturer>Microsoft</manufacturer> ... <microsoft:X_DeviceCaps xmlns:microsoft="urn:schemas- microsoft-com:WMPNSS-1-0"/>94</microsoft:X_DeviceCaps></device>

Note that usage of microsoft:X_DeviceCaps requires definition of the Microsoft namespace. The value for microsoft:X_DeviceCaps is given in decimal and represents a bitwise OR combination of the individual compatibility flag values described earlier in the paper. In the preceding example, the value of “94” for microsoft:X_DeviceCaps indicates the following compatibility flags:

WMC_COMPAT_EXCLUDE_RTSPWMC_COMPAT_EXCLUDE_DLNAWMC_COMPAT_EXCLUDE_DLNA_1_5WMC_COMPAT_EXCLUDE_PCMPARAMSWMC_COMPAT_INCLUDE_RTSP_FOR_VIDEO

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 30: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 30

Streaming DVR-MS filesMicrosoft Digital Video Recording (DVR-MS) files are generally used to carry audio and video content as well as closed-captions or subtitles. The DVR-MS file format consists of one or more MPEG-2 Elementary Streams (ES) contained within an Advanced Systems Format (ASF) file. Note that these are not MPEG-2 Packetized Elementary Streams (PES).

Proper streaming of DVR-MS content requires knowledge of the presentation timestamps in the DVR-MS files.

Presentation Timestamp ValuesThe content carried in DVR-MS files is timestamped with presentation timestamps that are stored in ASF extensible attributes.

The streams carried in the DVR-MS file should be treated autonomously. Each stream may be stored in a staggered manner relative to the other streams. The presentation timestamps should be used for the same reason they exist in MPEG-2 systems: for audio-video synchronization purposes.

Within a DVR-MS file, the presentation timestamps are not guaranteed to be normalized or “close” to 0; they typically begin at a value that is offset from 0. If playback requires normalized presentation timestamps, the smallest presentation timestamp in all the streams should be discovered at the start of the content. That single presentation timestamp value should be used to normalize the presentation timestamps in all the streams. It is important to preserve the intra-stream presentation timestamp stagger within the file.

Audio and Video StreamsTimestamp values for audio and video are derived directly from the original Packetized Elementary Stream presentation timestamp (PES PTS) values.

A PES PTS differs from a DVR-MS presentation timestamp in the following ways:

1. PES PTS values are expressed using a 90khz frequency, whereas DVR-MS presentation timestamp values are expressed using a 10mhz frequency.

2. 90khz PES PTS values wrap approximately every 26 hours, whereas DVR-MS presentation timestamps do not wrap.

The presence or absence of the presentation timestamps follows the same rules as described in the MPEG-2 systems specification. Specifically, not all picture frames require a timestamp, and timestamps must not occur less frequently than every 700 milliseconds.

If video B-frames are present, the video presentation timestamps may jitter forward and backward rather than monotonically increase relative to each other. Note that the first video sample in a DVR-MS file is not guaranteed to be a sequence header or an I-frame.

Other Types of StreamsDVR-MS files usually also contain non-audio/video streams such as closed caption byte pairs, or teletext. These streams are also timestamped with presentation timestamps.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 31: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 31

Whereas video timestamps can jitter forward and backward, samples with captions are stored in display order rather than in decode order. As such, the presentation timestamps on these samples will monotonically increase relative to each other.

ASF Extensible Attribute DetailThis section describes the ASF extensible attribute that is used to store the presentation timestamp of the sample.

Identifier

The extensible attribute identifier is the following GUID:

{FD3CC02A-06DB-4cfa-801C-7212D38745E4}

Payload Data Structure

The payload has the following data structure. All field values are stored in little-endian byte order. Non-reserved fields are described below.

typedef struct { DWORD dwVersion; REFERENCE_TIME rtStart ; REFERENCE_TIME rtStop ; DWORD dwReserved1 ; DWORD dwReserved2 ; DWORD dwFlags; DWORD dwReserved3; DWORD dwReserved4 DWORD dwReserved5;} ;

Field Descriptions

.dwVersion

This field always has value 1.

.rtStart

If this field is set, it has a value other than -1. If it is not set, the sample has no start time.

.rtStop

If this field is set, it has a value other than -1. If it is not set, the sample has no stop time.

.dwFlags

This field has the first bit set if the sample is a synchronization point. See the DirectShow documentation on MSDN for the definition of a synchronization point.

This field has the second bit set if the sample is a discontinuity from the previous sample in the same stream.

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 32: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 32

ErrataThis section describes issues with WMP Sharing that may affect interoperability with network devices.

WMP Sharing may respond with an incorrect “WMDRM-ND-Status” when a device registration has expired and the device must be re-registered. WMP Sharing should respond with “107 Must Register,” but may respond with “104 Transmitter Failure.” The associated error code (as shown in the system event log) for the “104 Transmitter Failure” error message is 0xc00d1910. If error code 0xc00d27e2 is observed with a “104 Transmitter Failure,” the correct error should be “107 Must Register.”

The Playlists container (ID 12) and its subcontainers are not searchable.

During search operations, WMP Sharing may return results that should not be included in the searchClass for certain containers:

Container

Object Type Returned

5 object.item.audioItem.musicTrack

6 object.item.audioItem.musicTrack

100 object.item.audioItem.musicTrack

107 object.item.audioItem.musicTrack

108 object.item.audioItem.musicTrack

7 object.item.audioItem.musicTrack

9 object.item.videoItem

A object.item.videoItem

E object.item.videoItem

C object.item.imageItem.photo

D object.item.imageItem.photo

Resources

Microsoft ResourcesWindows Media

A Technical Overview of Windows Media DRM 10 for Deviceshttp://go.microsoft.com/fwlink/?LinkId=28570

Windows Media Player 11 – Media Sharing Featurehttp://www.microsoft.com/windows/windowsmedia/devices/athome/default.aspx

Windows Media Licensing Programhttp://www.microsoft.com/windows/windowsmedia/licensing/default.mspx

Windows Media Player 11 SDK on MSDNhttp://msdn2.microsoft.com/library/

Attribute Reference File Name Extension Registry Settings Firewall Port Registry Settings IWMPLibrarySharingServices Interface Media Type Identifiers Media Types

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 33: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 33

PlaysForSurePlaysForSure 2.x Resources and Test Kits

http://www.playsforsure.com/product/specifications/default.aspx

Windows VistaCertified for Windows Vista Logo

http://www.windowsvista.com/lookforthelogo

Advanced Systems Format Specificationhttp://download.microsoft.com/download/7/9/0/790fecaa-f64a-4a5e-a430-0bccdab3f1b 4/ASF_Specification.doc

Industry ResourcesUPnP MediaServer and MediaRenderer-related specifications

http://www.upnp.org/standardizeddcps/mediaserver.asp

Digital Living Network Alliance (DLNA) Guidelineshttp://www.dlna.org/en/consumer/learn/guidelines/

RFCsRFC 4234: “Augmented BNF for Syntax Specifications: ABNF,” October 2005

http://go.microsoft.com/?linkid=5803258

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 34: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 34

Appendixes

Appendix 1. Sample SSDP Announcement MessagesThe following examples illustrate sample NOTIFY messages sent by WMP Sharing. Depending on the computer hosting WMP Sharing, some fields may have different values:

NOTIFY * HTTP/1.1\r\nHost:239.255.255.250:1900\r\nNT:urn:schemas-upnp-org:service:ConnectionManager:1\r\nNTS:ssdp:alive\r\nLocation:http://192.168.1.100:2869/upnphost/udhisapi.dll?content=uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c\r\nsUSN:uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c::urn:schemas-upnp-org:service:ConnectionManager:1\r\nCache-Control:max-age=1800\r\nServer:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n\r\n

NOTIFY * HTTP/1.1\r\nHost:239.255.255.250:1900\r\nNT:urn:schemas-upnp-org:service:ContentDirectory:1\r\nNTS:ssdp:alive\r\n Location:http://192.168.1.100:2869/upnphost/udhisapi.dll?content=uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c\r\nUSN:uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c::urn:schemas-upnp-org:service:ContentDirectory:1\r\nCache-Control:max-age=1800\r\nServer:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n\r\n

NOTIFY * HTTP/1.1\r\nHost:239.255.255.250:1900\r\nNT:urn:schemas-upnp-org:device:MediaServer:1\r\nNTS:ssdp:alive\r\n Location:http://192.168.1.100:2869/upnphost/udhisapi.dll?content=uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c\r\nUSN:uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c::urn:schemas-upnp-org:device:MediaServer:1\r\nCache-Control:max-age=1800\r\nServer:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n\r\n

NOTIFY * HTTP/1.1\r\nHost:239.255.255.250:1900\r\nNT:upnp:rootdevice\r\nNTS:ssdp:alive\r\nLocation:http://192.168.1.100:2869/upnphost/udhisapi.dll?content=uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c\r\nUSN:uuid:224e2bb9-6961-4d79-b05f-f72cb415dc6c::upnp:rootdevice\r\nCache-Control:max-age=1800\r\nServer:Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n\r\n

The next example shows a UPnP M-SEARCH message response by WMP Sharing:

M-SEARCH * HTTP/1.1\r\nHost:239.255.255.250:1900\r\nST:urn:schemas-upnp-org:device:MediaServer:1\r\nMan:"ssdp:discover"\r\nMX:3\r\n\r\n

The final example illustrates a sample SSDP announcement from a UPnP MediaRenderer:

NOTIFY * HTTP/1.1\r\n

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.

Page 35: Building a Network Device Compatible with Microsoft Windows Media

Building a Network Device Compatible     with Microsoft Windows Media Player 11 - 35

HOST: 239.255.255.250:1900\r\nCACHE-CONTROL: max-age=1800\r\nLOCATION: http://192.168.1.100:80/description.xml\r\nNT: urn:schemas-upnp-org:device:MediaRenderer:1\r\nNTS: ssdp:alive\r\nSERVER: NetDeviceOS/5.4 UPnP/1.0 DMP/5.0\r\nUSN: uuid: 224e2bb9-6961-4d79-b05f-f72cb415dc6c::urn:schemas-upnp-org:device:MediaRenderer:1\r\n\r\n

Appendix 2. Resource Elements for Transcoded ContentThe following example shows multiple resource elements exposed for the testImage.jpg file.

In each of the resource elements, the name of the file in the root URL has been intentionally shortened for brevity and clarity.

<item id="000000000000033F" parentID="B" restricted="1"> <dc:title>testImage</dc:title> <upnp:class>object.item.imageItem.photo</upnp:class> <upnp:album>[No Keywords]</upnp:album> <dc:date>2002-03-04</dc:date> <upnp:albumArtURI>http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?albumArt=true</upnp:albumArtURI> <res size="544643" resolution="3000x1968" protocolInfo="http-get:*:image/jpeg:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg</res> <res resolution="160x104" protocolInfo="http-get:*:image/jpeg:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?formatID=23,width=160,height=104</res> <res resolution="640x419" protocolInfo="http-get:*:image/jpeg:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?formatID=23,width=640,height=419</res> <res resolution="1024x671" protocolInfo="http-get:*:image/jpeg:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.?formatID=23,width=1024,height=671</res> <res resolution="136x90" protocolInfo="http-get:*:image/x-ycbcr-yuv420:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?formatID=24,width=136,height=90,thumbnail=false,aspectRatio=9:8,rFill=20,gFill=20,bFill=20</res> <res resolution="684x456" protocolInfo="http-get:*:image/x-ycbcr-yuv420:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?formatID=24,width=684,height=456,thumbnail=false,aspectRatio=9:8,rFill=20,gFill=20,bFill=20</res> <res resolution="3000x1968" protocolInfo="http-get:*:image/x-ycbcr-yuv420:*" colorDepth="24">http://192.168.1.111:10243/WMPNSSv4/1234/{name}.jpg?formatID=24,width=3000,height=1968,thumbnail=false,aspectRatio=1:1,rFill=20,gFill=20,bFill=20</res>

November 7, 2007© 2007 Microsoft Corporation. All rights reserved.