Appendix B includes a detailed discussion about the DirectX Media
component used by the client program to display the MPEG video.
The following is taken from the Microsoft DirectX and DirectShow
SDK online documentation found at http://www.microsoft.com/directx/pavilion/general/whatisdx.htm
and http://www.microsoft.com/directx/dxm/help/ds/c-frame.htm?default.htm
respectively.
DirectX is a group of technologies designed by Microsoft to make
Windows-based computers an ideal platform for running and displaying
applications rich in multimedia elements such as full-color graphics,
video, 3D animation, and surround sound. Built directly into the
Windows family of operating systems, DirectX is an integral part
of Windows 98 and Windows NT 5.0, as well as Internet Explorer
4.0. DirectX components may also be automatically installed on
your system by advanced multimedia games and applications written
for Windows 95. (Early releases of Windows 95 may not include
DirectX. If you think your Windows 95 operating system does not
include DirectX, you can download it from this Web site.)
Microsoft's goal in developing DirectX was to provide developers
with a common set of instructions and components that would accomplish
two things. First, DirectX would allow developers to be confident
that their multimedia applications would run on any Windows-based
PC, no matter what the hardware, and at the same time ensure that
their products take full advantage of high-performance hardware
capabilities to achieve the best possible performance. This was
accomplished through the DirectX Foundation layer. Second, DirectX
would make life easier for developers by giving them tools that
simplify the creation and playback of multimedia content, while
at the same time making it easier to integrate a wide range of
multimedia elements. DirectX does this with the DirectX Media
layer.
DirectX provides developers with new opportunities for creativity
and innovation by allowing them to focus on building unique features
for their application without having to worry about which display
adapter, sound card, or 3D accelerator chip is installed in your
PC. And because DirectX was designed to support future innovations
in software and hardware, developers and consumers can be confident
that they will continue to get the best possible performance from
their applications as technology advances.
DirectX Foundation gives developers a single set of APIs (application
programming interfaces) that provides them with improved access
to the advanced features of high-performance hardware such as
3D graphics acceleration chips and sound cards. These APIs control
what are called "low-level functions," including 2D
graphics acceleration; support for input devices such as joy sticks
and keyboards, and mice; and control of sound mixing and sound
output. The low-level functions are supported by the four components
that make up the DirectX Foundation layer: DirectDraw, Direct3D,
DirectInput, and DirectSound.
Before DirectX, developers creating multimedia applications for
Windows machines had to customize their products so that they
would work well on the wide variety of hardware devices and configurations
available on Windows machines. DirectX Foundation provides something
called a "hardware abstraction layer" (HAL short for)
that uses software drivers to communicate between game software
and computer hardware. As a result, developers can write a single
version of their product that utilizes DirectX without worrying
about the wide range of hardware devices and configurations in
existence.
DirectX Foundation also provides developers with tools that help
you get the best possible performance from the machine you're
using. It automatically determines the hardware capabilities of
your computer and then sets the application's parameters to match.
DirectX also allows you to run multimedia applications that require
support for features that their system doesn't offer by simulating
certain hardware devices through a "hardware emulation layer"
(called HEL) that provides software-based drivers that act like
hardware. For example, a DirectX game that makes use of 3D imagery
can run on a machine that doesn't have a 3D acceleration card
because DirectX simulates the services of a 3D card.
DirectX Foundation handles the low-level functions. The DirectX
Media layers sits on top of DirectX Foundation and provides high-level
services that support animation, media streaming (transmission
and viewing of audio and video as it downloads over the Internet),
and interactivity. Automatic integration of the low-level services
of DirectX Foundation and the high-level services of DirectX Media
simplifies the process of creating and playing multimedia elements,
allowing developers to energize and enhance applications and Web
pages with cutting-edge interactive content that was previously
impossible.
Like DirectX Foundation, DirectX Media is made up of several integrated
components. These components include DirectShow, DirectAnimation,
Direct3D Retained Mode, and DirectPlay. Support for DirectShow
and DirectAnimation is built into the latest versions of Microsoft
Internet Explorer. As a result, software developers and Web site
creators now have unprecedented control over graphics, animation,
audio, video, and other online multimedia elements.
The DirectX Media layer helps developers solve one of the most
daunting tasks they faced in developing great games for Windows
based machines - coordinating different types of multimedia effects.
It does so in two ways. First, it offers a set of APIs that makes
it possible for different types of effects to work together as
if they were a single application. (Prior to DirectX, developers
often had to use an API from one software vendor for audio, another
for video, and yet another for animation, making it difficult
to combine elements.)
DirectX Media layer also helps developers synchronize the playback
of multimedia elements. DirectX provides a time-based approach
to coordinating multimedia, allowing game developers to anchor
media elements of an application (2D and 3D animation, video,
audio, and more) along a single timeline. That means a developer
can take a 2D character, layer it over a video clip, and then
add sound, and ensure that all three multimedia elements will
all run smoothly and in the right relationship to each other.
Taken together, DirectX Foundation and DirectX Media provide developers
with another important benefit. DirectX contains a library of
components that they can draw on to created the underlying elements
of a game. This library simplifies the development process by
giving programmers a large group of pre-existing interfaces and
elements to use in their products. That means they can concentrate
their efforts on making their products more original and creative,
and spend less time struggling to figure out how to make an effect
work in the first place.
The components that make up DirectX also provide hardware makers
with a flexible platform that is designed to get the most out
of advances in technology. Because DirectX accesses a computer's
hardware through software drivers, hardware developers can create
special DirectX drivers that ensure that you get the most out
of advances in hardware technology-now and in the future.
Document last modified January 28, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms
of Use.
The Microsoft® DirectShow SDK gives developers access
to DirectShow services, which provide playback multimedia streams
from local files or Internet servers, and capture of multimedia
streams from devices. Specifically, this enables playback of video
and audio content compressed in various formats, including MPEG,
Apple® QuickTime®, audio-video interleaved (AVI), and
WAV, and both Video for Windows-based capture and WDM-based (Windows
Driver Model) capture.
At 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.
Applications control the filter graph's activities by communicating
with the filter graph manager. You can do this indirectly by using
the ActiveMovie Control, or directly by calling COM interface
methods. The SDK also enables you to create your own filters using
the DirectShow class library. The base classes in the C/C++ library
implement the required COM interfaces on the filters and provide
the basic filter framework.
The DirectShow SDK is based on several other Microsoft services
and supports at least one other Microsoft service. For example,
the video display components in DirectShow rely on Microsoft®
DirectX® services whenever possible.
The amount you must know about an underlying or supported technology
depends on what you are doing. For example, you'll need to understand
COM programming if you are using C or C++ to control DirectShow
playback or create a filter. But you don't need to understand
COM programming to use the ActiveMovie Control.
DirectShow developers can use the following Microsoft services
(you can find information about most of these in the Platform
SDK or on the World Wide Web at http://www.microsoft.com/msdn/.)
You can also use the following Microsoft languages for DirectShow
development:
See the product documentation for more information on these languages.
Microsoft® 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. See Use Multimedia
Streaming in DirectShow Applications for more information.
In addition to the architecture and the set of classes and interfaces
to support it, DirectShow is also a run time 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 ActiveMovie 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 application programming interfaces
(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.
Use the DirectShow architecture for most new multimedia applications
for Windows® 95 or Windows NT®. With a few exceptions,
it replaces multimedia playback services, APIs, and architectures
provided by Microsoft in earlier versions of the Windows Software
Development Kit (SDK). However, libraries will continue to be
available and supported for applications that use the earlier
Microsoft multimedia playback services, such as Microsoft Video
for Windows.
Contents of this article:
The DirectShow architecture defines how to control and process
streams of multimedia data using modular components called filters.
The filters have input or output pins, or both, and are connected
to each other in a configuration called a filter graph. Applications
use an object called the filter graph manager to assemble the
filter graph and move data through it. By default, the filter
graph manager automatically handles data flow for you; for example,
it automatically inserts the proper codec if needed, and it automatically
connects a transform filter's output pin to the default rendering
filter. You can always specify your own filters and connections
if you don't want to use the default configuration.
The filter graph manager provides a set of Component Object Model
(COM) interfaces so that applications can access the filter graph.
Applications can directly call the filter graph manager interfaces
to control the media stream or retrieve filter events, or they
can use the ActiveMovie Control to play back media files.
Thus, you can access DirectShow through the COM interface, the
ActiveMovie Control, or media control interfaces (MCI), as shown
in the following illustration.
Because of the DirectShow architecture's flexible, modular design,
filter graphs have many potential uses and applications. Examples
include filter graphs that implement video capture, control remote
devices such as VCRs, or enable MIDI recording and editing.
DirectShow is accessible at several levels, and the approach you
use depends on what you need and how much programming you want
to do. You might plan to rewrite an existing multimedia program,
write a new multimedia program, or add multimedia capabilities
to an existing program. Typically, existing applications that
use the MCI command set are easily ported, whereas applications
that access lower-level multimedia services require more time
to rewrite. You can quickly add DirectShow playback services to
new applications by using the ActiveMovie Control, or with a few
direct functions that call the COM interfaces. C or C++ programmers
can write filters that change or enhance multimedia data already
managed by existing filter graphs.
This section contains the following topics.
If you have an application that plays AVI-encoded movies and sounds and want to adapt it to use DirectShow to play AVI files, porting is straightforward if your application uses MCI commands or the Microsoft Video for Windows® API. Your choice depends on the services the application uses and your goals. If your application uses MCI commands, you can use the MCI subset that DirectShow provides. In the majority of cases, this will be a straightforward upgrade that maintains AVI playback and adds MPEG and QuickTime playback capabilities to
your application. If your existing C-based application uses Video
for Windows API, you can replace most of these with calls to the
COM interfaces.
You can take a variety of approaches when writing a new application
with DirectShow. For example, if you only want to add MPEG playback
to your application, you can incorporate the ActiveMovie Control
into your application or directly access the COM interfaces on
the filter graph manager. Both Microsoft Visual Basic® version
5.x and later and Microsoft Visual C++® version 5.x and later
allow access to the ActiveMovie Control or the COM interfaces.
Filters within a filter graph are typically written in C++ using
the DirectShow class library.
If your application must process the media stream in some way
or capture a media stream, you can incorporate both the filter
graph manager and a custom filter into your application. The instantiated
filter graph manager generates and manages the filter graph. You
can insert the custom filter into a preconfigured filter graph
(which you create and save by using the Filter Graph Editor tool
in the DirectShow SDK). You also could insert the filter into
an existing filter graph at run time.
The ActiveMovie Control is incorporated into Microsoft Internet
Explorer so that you can place the control on a Web page and program
it by using Microsoft Visual Basic® Scripting Edition (VBScript)
commands. To a programmer, the ActiveMovie Control is another
ActiveX Control, one that has real-time playback capability.
Real-time playback means that the ActiveMovie Control can play
video or audio files over the Internet while the file is downloading,
rather than requiring the user to wait until the whole file is
downloaded to begin playback.
The same filter graphs constructed to play media from files can
play media from the Internet by simply changing the source filter.
Take, for example, a filter graph that plays MPEG movies from
a disk file. The first filter in the graph might be a file reader
filter. By replacing this filter with a filter capable of reading
from an Internet URL address, you can play MPEG movies from the
Internet. Both file and URL reader source filters just deliver
an unparsed stream of data. A parser filter pulls the data from
the reader, parses it into separate streams of video, audio, text,
or other data types, and pushes it downstream. This filter remains
unchanged regardless of whether the source filter is a file or
URL reader filter.
The source filter that reads from an Internet server is called
the File Source (URL) filter. DirectShow provides this
as a built-in filter. It knows how to read, but not parse, data
from a URL address. Therefore, a media parser follows the File
Source (URL) filter in the filter graph. For MPEG sources, this
parser is built into the MPEG splitter filter. Other media types
have their own parser filters (for example, a QuickTime parser).
The source filter that reads from files is the File Source
(Async) filter. DirectShow also provides this as a built-in
filter. It does no parsing on its own but simply reads data off
a disk to play back. Most DirectShow filter graphs use this source
filter.
The architecture's modularity allows most of the same components
to be reused between file and Internet playback. This modularity
also means that if you want to render a new type of data, often
you only need to write a parser and renderer, and you can still
use the existing file or URL filter.
MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS
ABOUT THE SUITABILITY OF THE INFORMATION CONTAINED IN THE DOCUMENTS
AND RELATED GRAPHICS PUBLISHED ON THIS SERVER FOR ANY PURPOSE.
ALL SUCH DOCUMENTS AND RELATED GRAPHICS ARE PROVIDED "AS
IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE
SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD
TO THIS INFORMATION, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL MICROSOFT AND/OR ITS RESPECTIVE
SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF INFORMATION AVAILABLE FROM THIS SERVER.
THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS SERVER COULD
INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES
ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN. MICROSOFT AND/OR
ITS RESPECTIVE SUPPLIERS MAY MAKE IMPROVEMENTS AND/OR CHANGES
IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED HEREIN AT ANY
TIME.
COPYRIGHT NOTICE. Copyright © 1998 Microsoft and/or its suppliers,
One Microsoft Way, Redmond, Washington 98052-6399 U.S.A. All rights
reserved.