Filtering a video track by applying an effect to it is a critically important tool for doing color correction, adding special effects like lens flare, or offering novelties such as converting the video to black and white or pseudo-antique sepia tone. The technique of creating the effect is effectively the same as with zero-source effects, although in this case you need to create an object that tells the effect where its video source comes from.
You create a one-source effect just like you do the zero-source
version—create a track, create video media, get an
(this time of one-source effects), and
describing an effect from a
But before adding the
AtomContainer as the effects
media sample, you need to map it to a video source, which is another
video track in the movie. You do this by creating an
input map, which is an
AtomContainer indicating the sources that are
inputs to an effect. Next, create a track modifier reference to
redirect the track’s output to the effect. You use
the reference in building up the
Atoms in the
input map. Once built, the input map is set on the
effect’s media with
Example 9-4 exercises this technique by opening a movie, getting its first video track, and applying a user-selected filter to it.
Run this example with ant run-ch09-filtertrackbuilder.ks.
Example 9-4. Creating a one-source effect (filter)
package com.oreilly.qtjnotebook.ch09; ...