| MSDN Home > MSDN Library Archive > |
|
Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. Microsoft Corporation October 1998 Summary: The convergence of desktop multimedia and the Internet presents tremendous opportunities for developers to reach broad audiences with compelling, media-rich content and applications. With the Microsoft® DirectX® 6.0 set of application programming interfaces (APIs), Microsoft delivers a unified, comprehensive solution for developers. This white paper details the application-level services of DirectX media that provide rich support for media interaction and integration. ContentsIntroduction IntroductionApplication-level media services bring multimedia power to all developers. The Microsoft DirectX set of application programming interfaces (APIs) offers a broad spectrum of services from chip level to cyberspace. In addition to low-level APIs that access hardware accelerationcalled the DirectX foundationDirectX now includes DirectX media, a layer of high-level services including streaming, animation, and behaviors. DirectX media is a family of application-level APIs and controls for multimedia that provides rich support for interaction and integration of different media types for the development of online and digital media authoring applications. DirectX media currently consists of four APIs:
DirectX Media GoalsDirectX media has been developed to meet a set of related goals:
DirectX Media ArchitectureDirectX media is the result of the organization of DirectX 6.0 into two levels: a system-layer DirectX foundation and an application-layer DirectX media. DirectX media services use DirectX foundation. These services include Direct3D Retained Mode, DirectAnimation, DirectShow, and DirectX Transform. Support for VRML is also provided in DirectX media. DirectX foundation provides the basis for performance media on Windows-based computers through DirectDraw®, DirectInput®, DirectSound®, DirectSound3D, and Direct3D Immediate Mode.
Figure 1. DirectX 6.0 architecture Direct3D Retained Mode3-D scene graph API makes it easy to build and animate 3-D environments. Direct3D Retained Mode is a high-level 3-D scene graph manager that simplifies the building and animation of 3-D worlds and data. Note that Direct3D Retained Mode 6.0 does not work on the Windows NT® operating system, version 4.0, but will work on Windows NT 2000. If you want to use the Direct3D Retained Mode functionality with Windows NT 4.0, you need to use a version of DirectX 3.0. Direct3D Retained Mode 6.0 introduces new interfaces with increased functionality. You can now:
APIs have been added to eliminate redundant state changes and optimize your programs, and to take advantage of new DirectX Immediate Mode functionalitysuch as better lights. All access to Direct3D Retained Mode is through a small set of objects. The following table lists these objects and a brief description of each:
Eliminating Redundant State ChangesIn earlier versions of Direct3D Retained Mode, Retained Mode could not assume that render and light states would remain the same from one call to the next. This led to many redundant state changes in a typical application because Retained Mode set the state to a value equal to its current value. The IDirect3DRMDevice3 interface introduces several methods that can be used to eliminate these redundant changes for a modest performance boost: GetStateChangeOptions, LightStateChange, RenderStateChange, and SetStateChangeOptions. To use these methods, follow these steps:
DirectAnimationMultimedia API combines rich animation of multiple media types and strong integration with Dynamic HTML. The DirectAnimation component of DirectX media provides an integrated, comprehensive API and run time with support for a diverse set of media types and a powerful time/event model for developing rich animation and interaction. Because DirectAnimation is integrated with Dynamic HTML, it is especially suited to adding compact animation effects to Web pages. The DirectAnimation run-time library is part of the Microsoft Internet Explorer 4.0 minimal install. This means that Internet Explorer 4.0 contains all of the software necessary to view multimedia created with DirectAnimation. The key features of the DirectAnimation API are:
DirectAnimation ArchitectureThe following diagram shows the DirectAnimation architecture:
Figure 2. DirectAnimation architecture The DirectAnimation multimedia controls provide an interface to some of the DirectAnimation library, which is also accessible directly. The DirectAnimation library in turn uses the DirectShow API, the DirectX foundation, and certain operating system services. In the diagram, "SG" stands for Structured Graphics control and "Seq" stands for the Sequencer control. How Do You Use DirectAnimation?DirectAnimation is a COM API and an underlying run time, the functionality of which can be accessed in different ways by different user groups. You can use DirectAnimation in the following ways:
The following table shows the typical ways different developers would access DirectAnimation.
You can access DirectAnimation from JScript, VBScript, Visual Basic, and C++ directly through the scripting (COM) interfaces. You can also add DirectAnimation content to your Web pages without programming at all by using the DirectAnimation controls and setting parameters on these controls. Using the DirectAnimation controls directly, or using JScript or VBScript, allows you to describe inline animations with HTML. Such animations can integrate with Dynamic HTML by being windowless on the page (overlaying other elements such as text) or by driving the properties of other entities on the page. It is also possible to import HTML-rendered text and use it as a texture in an animation. There is a special Java binding for DirectAnimation provided on top of the COM API that takes advantage of specific Java features. For example, operations are overloaded so that several COM methods that perform similar functions but use different parameter types are given the same name in Java. To create presentations with DirectAnimation, you need the following:
What's New in DirectAnimation 6.0?The following features are new DirectAnimation 6.0:
Note that to use some of the new DirectAnimation APIs, you must have DirectX 6.0 or later installed. DirectX 6.x cannot be installed on Windows NT version 4.0. You will not get an error if you use these functions without DirectX 6.x; they will simply have no effect. You must have DirectX 5.0 or later installed to use some of the Geometry shading and lighting functions. You will not get an error if you use these functions without DirectX 5.x or DirectX 6.x; they will simply have no effect. To use 3-D DirectX Transform effects in DirectAnimation, you must have DirectX 6.0 or later installed. To use some 2-D DirectX Transform effects, you must have the optional DirectX Media DLLs installed. You can install these by choosing Optional Transforms when you install the DirectX Media SDK. Instantiation of the DirectX Transform COM object will fail if you attempt to use transforms without the proper software installed. DirectAnimation Multimedia ControlsThe DirectAnimation Multimedia Controls (formerly called Multimedia DHTML controls) supply a scripting interface to some of the DirectAnimation API functions and libraries. These controls allow you to deliver impressive animation, image, sound, and vector graphics content over the Web with low code overhead and without incurring long download times. The DirectAnimation Multimedia Controls consist of:
A DirectAnimation Multimedia Control ExampleIn the following example, btnOval is a button that says, "This is a moving button." A DirectAnimation path control named pthOval targets the button, telling it to move along an oval-shaped path on the page. <HTML>
<INPUT NAME=btnOval TYPE=BUTTON VALUE="This is a moving button"
STYLE="position:absolute;LEFT: 20; TOP: 80">
<OBJECT ID="pthOval"
CLASSID = "CLSID:D7A7D7C3-D47F-11D0-89D3-00A0C90833E6">
<PARAM NAME="Target" VALUE="btnOval">
<PARAM NAME="Shape" VALUE="Oval(50,50,400,200)">
<PARAM NAME="AutoStart" VALUE="-1">
<PARAM NAME="Repeat" VALUE="-1">
<PARAM NAME="Duration" VALUE="10">
</OBJECT>
</HTML>
DirectShowProfessional, multiformat media playback, capture, and streaming make it easy to add multimedia streams to any application. DirectShow (formerly the ActiveMovie SDK) is the media streaming architecture of DirectX media for controlling and processing streams of multimedia data. DirectShow offers three core features:
DirectShow is an architecture that controls and processes streams of multimedia data through custom or built-in filters. You can also use the set of media streaming interfaces to stream media data without creating filters. In addition to the architecture and the set of classes and interfaces to support it, DirectShow is also a runtime that uses this architecture to enable users to play digital movies and sound encoded in various formats, including MPEG, AVI, MOV (Apple® QuickTime®) and WAV-formatted files. The DirectShow run time is a control (.ocx), called the Microsoft Windows® Media Player Control, and a set of dynamic-link libraries (DLLs) that enable you to play back supported media files. DirectShow playback uses video and audio hardware cards that support the Microsoft DirectX set of APIs. The video and audio capture capability lets you programmatically control your system's video and audio capture hardware, as well as video and audio compressors and decompressors (codecs). The Plug and Play capability lets DirectShow automatically retrieve and use your filters once you register their properties. What's New in DirectShow 6.0?Features added to DirectShow since the DirectShow 5.2 SDK include:
DirectShow Filter ArchitectureAt the heart of the DirectShow services is a modular system of pluggable components called filters, arranged in a configuration called a filter graph. A component called the filter graph manager oversees the connection of these filters and controls the stream's data flow. To use the filter graph manager from an application, you do not need to know much about the underlying filter graphs. It is useful, however, for you to understand the basic principles of filter graphs if you ever want to configure your own filter graph rather than letting the filter graph manager configure them for you. A filter graph is composed of a collection of filters of different types. Most filters can be categorized into one of the following three types:
In addition to these three types, there are other kinds of filters. Examples include effect filters, which add effects without changing the data type, and parser filters, which understand the format of the source data and know how to read the correct bytes, create times stamps, and perform seeks. For example, a filter graph, the purpose of which is to play back an MPEG-compressed video from a file, would use the following filters:
The following illustration shows such a filter graph:
Figure 3. DirectShow filter graph It is possible for some filters to represent a combination of types. For example, a filter might be an audio renderer that also acts as a transform filter by passing through the video data. But typically, filters fit only one of these three types. Filter graphs stream multimedia data through filters. In the media stream, one filter passes the media downstream to the next filter. An upstream filter describes the filter that passes data to the filter; a downstream filter describes the next filter in line for the data. This distinction is important because media can only flow downstream, whereas other information can go upstream. Using DirectShowThere are three ways to use DirectShow:
The amount you must know about an underlying or supported technology depends on your task. For example, you will need to understand COM programming when using C or C++ to control DirectShow playback or create a filter, but you do not need to understand COM programming to use the ActiveMovie Control. Prebuilt FiltersDirectShow provides prebuilt filters as part of the DirectShow SDK. A prebuilt filter, supplied as binary code only, is one of the filters listed in the Filter Graph Editor when you choose Insert Filters from the Graph menu. The DirectShow SDK provides the following filters:
Sample Source FiltersA sample filter includes source code; you must build and register it before it will appear in the Filter Graph Editor: Source filters
Transform filters
Renderer filters
Cutlist sample applications
C/C++based sample applications
Visual Basicbased sample applications
Plug-In Distributor Sample
IOStream Helper Library
Multimedia Streaming with DirectShowWhen developers use multimedia streaming in their applications, it greatly reduces the amount of format-specific programming needed. Typically, an application that must obtain media data from a file or hardware source must know everything about the data format and the hardware device. The application must handle the connection, transfer of data, necessary data conversion, and the actual data rendering or file storage. Because each format and device is slightly different, this process is often complex and cumbersome. Multimedia Streaming, on the other hand, automatically negotiates the transfer and conversion of data from the source to the application. The streaming interfaces provide a uniform and predictable method of data access and control, which makes it easy for an application to play back the data, regardless of its original source or format. The following diagram shows the basic object hierarchy used in multimedia streaming:
Figure 4. Multimedia streaming object hierarchy The following steps show how to implement streaming from hardware device to rendered playback:
There are three basic object types defined in the multimedia streaming architecture:
ConclusionMultimedia by definition requires integrationand multimedia over the Internet requires even more integration. DirectX provides the first unified solution to take advantage of the cross-platform flexibility of the Internet and the powerful multimedia capabilities of the personal computer. With all DirectX services designed to work together with a single programming model, DirectX makes it easy to develop innovation and ease of use into online and digital media-authoring applications with benefits that go far beyond present-day technologies. Note that to use DirectX on Windows NT 4.0, you must use DirectX 3.0. DirectX 6.x will be available on Windows 2000. Although DirectX media 6.0 takes advantage of the improved features in DirectX 6.0, many of the Direct X media products can be used successfully with DirectX 3.0. For More InformationFor additional information on DirectX technologies, visit www.microsoft.com/directx/default.asp. --------------------------------------------- © 1998 Microsoft Corporation. All rights reserved. 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 OR IMPLIED, IN THIS DOCUMENT. Microsoft, ActiveMovie, ActiveX, the BackOffice logo, Direct3D, DirectAnimation, DirectDraw, DirectInput, DirectPlay, DirectShow, DirectSound, DirectX, JScript, Visual J++, Visual Basic, Visual C++, Win32, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Java is a trademark of Sun Microsystems, Inc. Other product or company names mentioned herein may be the trademarks of their respective owners. |