// So I can use it as a player.
p.setContentDescriptor(null);
// Obtain the track controls.
TrackControl tc[] = p.getTrackControls();
if (tc == null) {
System.err.println("Failed to obtain track controls from the processor.");
return false;
}
// Search for the track control for the video track.
TrackControl videoTrack = null;
for (int i = 0; i < tc.length; i++) {
if (tc[i].getFormat() instanceof VideoFormat) {
videoTrack = tc[i];
break;
}
}
if (videoTrack == null) {
System.err.println("The input media does not contain a video track.");
return false;
}
System.err.println("Video format: " + videoTrack.getFormat());
// Instantiate and set the frame access codec to the data flow path.
try {
Codec codec[] = { new PreAccessCodec(),
new PostAccessCodec()};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
System.err.println("The process does not support effects.");
}
// Realize the processor.