i
i
i
i
i
i
i
i
386 15. Using Multimedia in VR
omitting the occasional frame. If your player is running on a faster processor,
it must not play the movie as if in fast forward, either; it must pause and wait
to synchronize with the real-time clock.
The good news is that every PC made today has the processing power
to easily play back movies at the required real-time speed, so the only
complication we have is to ensure that they play smoothly and don’t slow
down or speed up due to some big calculation being done in the back ground.
Gathering these thoughts together brings us to the subject of this chapter,
DirectShow. We mentioned this briefly in Chapter 12 when discussing appli-
cation program tools and templates. DirectShow is a powerful and versatile
API for multimedia applications. It facilitates acquiring data from sources,
processing the data and delivering it to a destination. It also has a nomen-
clature, a jargon, in which one can discuss and describe what is going on and
what one would like to do. DirectShow jargon speaks of signals coming from
sources passing through filters en route from sources to sinks. The signal path
may split to pass through different filters or to allow multiple outputs. For
example, when playing a movie, the video goes to the screen, and the audio
goes to the loudspeakers. DirectShow uses a neat graphical metaphor, called
a FilterGraph, that depicts the filter components and their connections (such
as those shown in Figure 15.1). It takes this metaphor further, to the level
of the API, where it is the job of the application program to use the COM
interfaces of the DirectShow API to build a FilterGraph to do what the ap-
plication wants to do (play a movie, control a DV camcorder etc.) and send
the signals through it. DirectShow had a slow start. It began life under the
title ActiveMovie, but in the early days, it was not popular, because multime-
dia application developers could do everything they wanted using either the
media control interface (MCI) or video for Windows (VfW). It wasn’t until
the multimedia explosion with its huge video files and the easy attachment
of video devices to a PC, none of which really worked in the MCI or VfW
approach, that DirectShow came into its own. Now, and especially in the case
of VR where there are few off-the-shelf packages available, when we need to
incorporate multimedia into an application, DirectShow offers the best way
to do so.
15.1 A Brief Overview of DirectShow
Meeting DirectShow for the first time, it can seem like an alien programming
concept. The terms filter, signal and FilterGraph are not traditional program-
ming ideas, and there are other complicating issues.