Microsoft Directshow: a New Media Architecture
Total Page:16
File Type:pdf, Size:1020Kb
TECHNICAL PAPER Microsoft Directshow: A New Media Architecture By Amit Chatterjee and Andrew Maltz The desktop revolution in production and post-production has dramatical- streaming. Other motivating factors are ly changed the way film and television programs are made, simultaneously the new hardware buses such as the reducing equipment costs and increasing operator eficiency. The enabling IEEE 1394 serial bus and Universal digital innovations by individual companies using standard computing serial bus (USB), which are designed with multimedia devices in mind and platforms has come at a price-these custom implementations and closed promise to enable broad new classes of solutions make sharing of media and hardware between applications difi- audio and video application programs. cult if not impossible. Microsoft s DirectShowTMStreaming Media To address these and other require- Architecture and Windows Driver Model provide the infrastructure for ments, Microsoft introduced Direct- today’s post-production applications and hardware to truly become inter- ShowTM, a next-generation media- operable. This paper describes the architecture, supporting technologies, streaming architecture for the and their application in post-production scenarios. Windows and Macintosh platforms. In development for two and a half years, Directshow was released in August he year 1989 marked a turning Additionally, every implementation 1996, primarily as an MPEG-1 play- Tpoint in post-production equip- had to fight with operating system back vehicle for Internet applications, ment design with the introduction of constraints and surprises, particularly although the infrastructure was desktop digital nonlinear editing sys- in the areas of internal stream synchro- designed with a wide range of applica- tems. While LBM-compatible personal nization, external device synchroniza- tions in mind. Directshow’s follow-on computers and Apple Macintoshes had tion, and data throughput, to name a release, incorporating substantial input been used in linear editing and control few. from OpenDML and key application systems for several years prior, these Any review of desktop production software developers, addresses many new editing systems forsook analog technologies would be incomplete high-end tools issues and is now in videotape as an online storage medium without mentioning standardization Beta release. High data rate video cap- and instead brought video and audio attempts such as Apple’s Quick ture and playback, seamless nonlinear source material “inside the box” in a TimeTMmultimedia architecture and playback from multiple files, support practical sense for the first time. Other Avid Technologies’ Open Media for transitional effects, improved inter- editing equipment manufacturers Framework Interchange format. stream synchronization, an improved quickly jumped on the desktop band- However, these and other efforts have media file format, external device con- wagon. Those that didn’t (and some not successfully addressed cross-plat- trol, and a new hardware driver model that did) were destined to become form issues on the Microsoft Windows are just part of Directshow’s feature footnotes in the annals of broadcast operating systems or cross-application set. Other benefits include container equipment history. issues much beyond digital audio format independence, location trans- Regardless of the platform on which interchange. Microsoft’s own Video parency of software modules, and they were built, all of these pioneering for Windows multimedia architecture, hardware and software codec inter- digital nonlinear systems, as well as designed for low bit rate consumer changeability and scalability. most of those in production today, had multimedia applications, is also insuf- one thing in common: the internal ficient for the high-performance Inside Directshow-Supporting media handling was performed by cus- demands of professional users. Technology tom engines. Each implementation The formation of the OpenDML A look under the hood of Direct- relied on proprietary and incompatible committee in 1995, consisting of a Show reveals that it builds on several file formats, unique and incompatible very vocal group of Windows-based Microsoft technologies, although it programming interfaces, and nonexis- video tools and hardware manufactur- should not be considered “just another tent data interchange methods. ers, underscored the desire for open layer” of system software (Fig. I). standards in digital media handling and Directshow provides functional parti- interchange. Given the “flattening” of tioning, module connection, media Presented at the 31st SMPTE Advanced Motion Imaging Conference (paper 31-6). New York, N.Y.. the historically vertical tools market, a type negotiation, and stream control February 6 to 8. 1997. Amit Chatterjee is with standardized multimedia architecture services to applications. Other compo- Microsoft Corp., Redmond. WA 98052; Andrew would enable better interchangeability nents provide high-performance media MalU (who co-read the paper) is with Digital Media Technologies. Inc., Van Nuys. CA 9141 I. An unedit- of video and audio hardware with services, low-latency stream handling, ed version of this paper appears in The Age ~f application software as well as merge hardware independence, and an over- COmpression: Nonlinear Editing. Digital Broadcasting, and Other Wonders, SMPTE, 1997. traditionally separate application all model for component construction, Copyright Q 1997 by the Society of Motion Picture spaces such as video editing, video loading, and intercomponent commu- and Television Engineers, Inc. conferencing, and server-based media nication. SMPTE Journal, December 1997 865 Authorized licensed use limited to: IEEE Xplore. Downloaded on October 22,2019 at 16:39:29 UTC from IEEE Xplore. Restrictions apply. MICROSOFT DIRECTSHOW: A NEW MEDIA ARCHITECTURE Figure 1. Microsoft multimedia architecture. Taking a bottom-up approach, the consoles, and Directplay for multima- areas of the operating system running lowest level component is the hard- chine, multiplayer gaming. All of the in kernel mode, it is extremely diffi- ware abstraction layer (HAL) common DirectX drivers were initially released cult for them to “crash” the system. to all Microsoft operating systems. As for the Windows 95 operating system, The downside to this separation is the basis for hardware independence, and most are now being ported to that any direct hardware register this is the key to having one’s applica- Windows NT. They are designed for request or other kernel mode call made tion run transparently on either an low-latency and high-performance by an application program incurs a Intel x86, DEC Alpha, or PowerPC control of hardware, although at pre- time penalty for each user-to-kernel processor, requiring only recompila- sent they are primarily user mode mode transition. This is due to the nec- tion with the proper code generator in modules. This begs the question essary saving of registers and environ- place. Multiprocessor implementations “What is user mode?’ ment state, known as a “context.” are also handled at this level. The Windows NT operating system High-performance applications have Also part of the lowest layer are takes advantage of two distinct privi- recourse for this, as we will see a bit kernel and base driver services, con- lege modes of today’s microproces- later. taining high-priority system tasks, sors, commonly called “user mode” The Windows driver model (WDM) plug-and-play support, and power and “kernel mode.” The primary dif- is a new driver model that makes management. It is at this level that ference between them is that the level development of low-latency, cross low-latency and time-critical software of access to the underlying hardware platform drivers more practical (Fig. resides. This subject will be covered in and memory space is unrestricted to 2). WDM drivers reside completely in more depth further on. software running in kernel mode and kernel mode and can communicate At the top of the kernel services highly restricted to software running directly with other WDM drivers, thus layer, and extending above it as well, in user mode. The result of this privi- eliminating the performance hit asso- are additional Microsoft DirectX lege separation is a robust computing ciated with mode transitions. WDM Media technologies, comprised of environment: application software and drivers are modular, using a class dri- DirectDraw for two-dimensional many operating system components vedminidriver structure. This layered graphics, Directsound for audio, run in separate and protected user approach separates drivers into logical Direct3D for three-dimensional graph- mode memory spaces. Since they do partitions, allowing a particular ics, Directlnput for joysticks and game not have direct access to sensitive “stack” to be configured for a given 866 SMPTE Journal, December 1997 Authorized licensed use limited to: IEEE Xplore. Downloaded on October 22,2019 at 16:39:29 UTC from IEEE Xplore. Restrictions apply. MICROSOFT DIRECTSHOW: A NEW MEDIA ARCHITECTURE peripheral using a given protocol con- nected via a given bus. Microsoft is supplying a class driver I Micmrott UO Manign for streaming media that contains all of the code necessary to support plug- and-play, memory management, prop- erty and method set management, and other core services. This reduces the amount of code development for a hardware manufacturer to a relatively simple minidriver that can bc written in