try {
QTSessionCheck.check();
QTFile movFile = new QTFile (new java.io.File("buildtext.mov"));
Movie movie =
Movie.createMovieFile(movFile,
StdQTConstants.kMoviePlayer,
StdQTConstants.createMovieFileDeleteCurFile |
StdQTConstants.createMovieFileDontCreateResFile);
System.out.println ("Created Movie");
// create an empty text track
int timeScale = 10; // time measured in 1/10ths of a sec
Track textTrack = movie.addTrack (TEXT_TRACK_WIDTH,
TEXT_TRACK_HEIGHT, 0);
System.out.println ("Added empty Track");
// create media for this track
Media textMedia = new TextMedia (textTrack,
timeScale);
TextMediaHandler handler =
(TextMediaHandler) textMedia.getHandler();
System.out.println ("Created Media");
textMedia.beginEdits();
for (int i=0; i<MESSAGES.length; i++) {
byte[] msgBytes = MESSAGES[i].getBytes();
QTPointer msgPoint = new QTPointer (msgBytes);
// add sample
handler.addTextSample (msgPoint, // text
0, // font number
14, // font size,
QDConstants.bold, // style,
QDColor.yellow, // fg color,
QDColor.black, // bg color,
QDConstants.teCenter,// justification
textBox, // box
0, // displayFlags
0, // scrollDelay
0, // hiliteStart
0, // hiliteEnd
QDColor.white, // rgbHiliteColor
25 // duration
);
} // for
// done editing
textMedia.endEdits();
// now insert this media into track
textTrack.insertMedia (0, // trackStart
0, // mediaTime
textMedia.getDuration(), // mediaDuration
1); // mediaRate
// save up at this point
System.out.println ("Saving...");
OpenMovieFile omf = OpenMovieFile.asWrite (movFile);
movie.addResource (omf,
StdQTConstants.movieInDataForkResID,
movFile.getName());
System.out.println ("Done");
} catch (QTException qte) {
qte.printStackTrace();
}
System.exit(0);