Windows Media SDK 7: Under the Hood 7-409 Chris Carper Program Manager Digital Media Division ccarper@microsoft.com Agenda Windows Media SDK Roadmap Windows Media Format SDK Audio, video Net streaming Editing Content management Digital Rights Management Window Media v7 SDK Component Roadmap Encoder SDK (Private Beta) Player SDK (Beta) Format SDK (Beta) Replaces Audio SDK Reading and writing Windows Media Windows Media Device Manager (WMDM) Windows Media Format 7: Overview Requirements Extensible Scalable Support new CODECs and media types Efficient local playback Support existing HTTP servers Enable high capacity media servers Author once; playback anywhere Stream thru 28.8 modems to broadband networks Play on PCs, PDA, and Consumer Electronics Car stereos, portable devices, etc. Windows Media Format 7: Overview Second generation multimedia format Supports streamed and local playback Optimized for live and on-demand content Consists of CODECs Digital Rights Management (DRM) File container Windows Media Applications Based on current WM Audio SDK Players Winamp (www.winamp.com) Sonique (www.sonique.com) Personal Jukeboxes Sonic Foundry Siren www.sonicfoundry.com MusicMatch Jukebox www.musicmatch.com RioPort Audio Manager www.rioport.com Many more available at… http://www.microsoft.com/ windowsmedia/software/ jukeboxes/ Windows Media Player v7 SDK Windows Media Player ActiveX Control Windows Media Player Skins Windows Media Player Custom Visualizations Player SDK Component Architecture Browsers/applications Netscape Plug-in Player Control COM Interfaces DirectShow Filter Graph Manager Source filter (ASF, WAV, AVI, etc.) Transform filter Render filter DirectX Foundation Media Source (Internet or FileSys) Media Destination (Audio/Video Hardware) Player SDK Component Control Interfaces Methods Player State: Play, Pause, Stop, FastForward CODECs: GetCodecInstalled ASX: GetMediaInfoStream Stream control: StreamSelect Events Script Commands and URLs Stream and playback Mouse and keyboard Marker Errors and warnings Timer Properties Display and appearance Markers and scanning Stream playback rate Media stream FilterGraph Event registration Error handling Volume and Mute Stream and playback stats Stream status SAMI file, language, style Player SDK component Windows Media Vizualizations Getting Started Use C++ Wizard Located in <SDK Install>\wizards\viz Copy to: \Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\IDE Create Vizualization Project Modify Render function Build .dll Windows Media Vizualizations Files effects.idl project.cpp projectdll.cpp projectdll.def projectdll.rc iproject.idl StdAfx.cpp project.h resource.h StdAfx.h project.rgs project.wms basetsd.h effects.h iproject.h iproject.tlb WM Format SDK Features Audio and Video Read and write Windows Media files Stream from net, stream to net Content Management properties Markers Scripts: Closed Captioning, URL flips, Events, HTML In stream or in header Digital Rights Management (DRM) Portable Device Support Windows Media Format SDK Data Flow Encoder Player audio/video data WM SDK WM Stream WM SDK WM File DRM CODEC DRM CODEC Windows Media Format SDK Objects WM Format SDK Writer IWMWriter Reader IWMReader Metadata Editor IWMEditor Profile Manager IWMProfileManager File Sink IWMWriterFileSink Network Sink IWMWriterNetworkSink Format Overview File Container Supports files as large as 17 million terabytes Supports multi-bitrate-video streams in a file Stores media and metadata in one file Metadata Title, copyright, author, markers, script commands, etc. ID3 v1, v2 music meta-information Media Audio, Video and Script Commands (URLs, CC) AudioStream Video Stream #1 Header Index Video Stream #n Script Stream Timeline Format Overview File Container Able to select a stream, based on available bandwidth Interleaved data is optimal for HTTP Files can be read sequentially, avoiding expensive seeks Timeline based synchronization Bursty data can be smoothed Send Timestamp (milliseconds) Presentation Timestamp (Rational time units) Presentation Time Send Time Presentation Time Format Overview File Extensions Objectives ISVs know the player’s rendering requirements Content owners can target specialized player (e.g. Jukebox vs Digital VCR) .wma Audio-only content Target application: Jukebox Metafile extensions: .wax MIME: audio/x-ms-wma and -wax CODECs: Windows Media Audio Format Overview File Extensions .wmv Audio, Video, and/or Scripted content Target Application: Video Player, Video Editor Metafile extensions: .wvx MIME: video/x-ms-wmv and -wvx CODECs: Uncompressed, Windows Media Audio, ACLEP.net and/or MPEG4 .asf Legacy content Unbounded rendering requirements Metafile extensions: .asx MIME: video/x-ms-asf CODECs: Uncompressed, Windows Media Audio, ACLEP.net, MPEG4, MetaSound, MetaVoice, MP3, TrueMotionRT, ClearVideo, L&H, VDOWave, etc. Format SDK Component Upgrading from the Audio SDK Jukebox applications Faster than real-time read Transfer content to portable devices or storage media with WMDM Live encoder applications Write-to-net via HTTP and MSBD Support up to 50 direct connections Reports encoding statistics Format SDK Component Upgrading from the Audio SDK Video editing applications Access to compressed and uncompressed bit-streams Author single and multi-bit-rate video files Author and edit script stream, scripts in header, markers in header, header attribute editing Auto-create index for seeking support Broader list of supported CODECs (MPEG4, Windows Media Audio, ACELP.net) Author files larger than 2 gigabytes Format SDK Component Keying WMKey.LIB unlocks all SDK interfaces Vendor-specific keys in lib file CODEC keys are also in lib file ISV registers to download SDK Server generates an individualized lib file Server emails lib to ISV ISV link lib file into app Allows for CODEC specific keying Allows for new CODECs without changing the SDK Key are passed down through middleware APIs (e.g. DirectShow) Profile Multi-bitrate video bands: declare frame size and bitrate for each band Persisted as XML SDK includes pre-defined system profiles in “windows\wmsysprf.Prx” Take a look at profile settings… Writing WM File Create an IWMWriter object by calling WMCreateWriter Call SetProfile to define the configuration. Set the outputs. Call SetOutputFilename on the writer. Call GetInputCount and GetInputProps for each stream. Call WriteSample repeatedly, until finished. Use AllocateSample Call Flush Will write any buffered data as output, and update the header and index files. Writing Windows Media Files Application IWMProfile AddStream IWMWriter SetOutputFileName WriteSample IWMWriterNetwork SinkOpen WM SDK Profile Object Writer Object Net Sink Reading a WM File Create an IWMReader object Call Open with a URL (possibly a local file name) Asynchronous call Wait for appropriate OnStatus calls to be sent to the callback Returns the WMT_OPENED status message to the callback Call GetOutputCount and GetOutputProps to get the format for each output Call Start Status messages and samples will then begin arriving in the callback function Reading Windows Media Files Application IWMReader Open(szURL) Start(cnsStart) IWMReaderCallback OnSample OnStatus WM SDK Reader Object WM SDK Editing Windows Media Files Windows Media Format SDK allows editing without recompression Can obtain compressed data from reader Can supply compressed data to writer Compressed samples are handled separately from normal samples, on advanced interfaces IWMWriterAdvanced Windows Media Rights Manager Digital Rights Management (DRM) Allows copyright owners to encrypt content Users must acquire “license” to play Content cannot be easily emailed, transferred, or copied with associated license Enables artists, publishers and distributors to collect information and/or money Designed to vastly reduce digital music piracy Incorporated in Windows Media Player (WMP) Also available in Window Media SDK Incorporated in many third-party players Rights Manager Process Flow Building a streaming media business Windows Media Server Digital Content 1 Packager Tool 2 Packaged Content 3 Web Server Creation Distribution 4 Windows Media Player 5 License Server Clearing 7 6 License (Key) Playback Content (plaintext) Content Server 1. Encrypts content 2. Allows download Speaker/Display 2 Content (encrypted) Consumer PC 3 Shared secret WMPlayer 1 Authentication 7 License Server 1. Authenticates client 2. Encrypts content key 3. Adds usage rules 4. Signs license License request 4 License (key) 5 Parameter encryption DRM 6 License store Hardware binding License Rights Right to play on a PC Expiration date Right to burn to redbook CD Right to transfer to portable player One-time right to transfer to PD Playing Protected Content Sign license, return to Microsoft Receive wmdrmstub.Lib #define SUPPORT_DRM Call WmCreateDrmReader Handle WMT_NO_RIGHTS message Playing Protected Content (Diagram) Player WmDrmStub.lib music.wma music.lic WM SDK DRM CODEC Portable Device Service Provider Windows Media SDK Licensing Overview Components of the OS, so there is no additional license fee Tools SDK Player SDK Paper-copy redistribution license Redist component: wmtools.exe (4 Meg) Automated IEAK redistribution license process Redist component: mpfull.exe (4 Meg) Format SDK Automated license process for core functionality Paper-copy license for DRM functionality Redist components: WMFAudioRedist.exe for Jukebox apps (0.8 Meg) setupWMDM.exe for Jukebox apps (0.2 Meg) WMFRedist.exe for video editor or encoder apps (1 Meg) Logo Program Plays Windows Media™ Use this logo if your product: Integrates Windows Media technology to reads (from net or local disk) Windows Media files or renders Windows Mediabased content To request the logo license agreement, email us at: wmlogo@microsoft.com Windows Media Enabled Solutions Call To Action Enable your existing product with Windows Media Create new categories of applications Audio/Video Players, Video editors, Games Digital VCR, Conferencing Gateways, Personal Broadcaster, Media Indexers Join our Partner Programs Need More Information? MSDN Developer Center http://msdn.microsoft.com/windowsmedia JumpStartCD Ongoing Seminars