Share via


Writing Files to the Device

banner art

This is preliminary documentation and subject to change.

This topic documents a feature of the Windows Media Device Manager SDK. We recommend that you migrate your application to use the Windows Portable Devices API. For more information, see the Windows Portable Devices SDK.

Before sending a file to a device, your application must find out what types of files and formats the device can handle, so that the application can determine whether the file should be transcoded before sending, or sent unmodified, or not sent at all.

The following steps show how to send an existing file down to the device. To create a new file on the device, such as a playlist, see Creating a Playlist on the Device.

  1. Get the format of the file you intend to send to the device. For more information, see Discovering a File's Format.
  2. If the device is intended to play the file,
    • Query the file for its format capabilities. For more information, see Discovering Device Format Capabilities.
    • Find an acceptable format that the application can create from the original file.
    • If the file needs to be transcoded, transcode it.
  3. Find a parent storage for the new object. Windows Media Device Manager does not provide a way to discover the standard storage location for any particular file types (video or audio files, WMV or BMP, a "Favorites" folder, and so on), so you will have to examine each device to try to figure out where best to store the new object. (Other applications enforce a certain folder structure, for example, Windows Media Player creates Albums, Playlists and Music folders where the Music folder contains an Artist and AlbumName heirarchy. For this reason, and because some devices may not have been tested with software other than Windows Media Player, be aware that the placement of playlist or album objects in any folder other than the Playlists or Albums folders may sometimes lead to nonfunctioning objects on some devices.)
  4. If the target storage supports IWMDMStorageControl3, create a new metadata interface by calling IWMDMStorage3::CreateEmptyMetadataObject. Set metadata on an IWMDMMetaData interface. For more information, see Setting Metadata on a File. The only required metadata is g_wszWMDMFormatCode (a WMDM_FORMATCODE value describing the content), but the more metadata you can provide, the more efficient the transfer will be for the service provider.
  5. Send the file to the device by using the Insert, Insert2, or Insert3 method. Insert3 allows you to include the metadata on the device as part of the method. For more information, see Sending the File to the Device.

Code demonstrating each of these steps is provided on the linked topic pages.

See Also