// BOOK ERRATA: this is buggy on Windows for time codes other
// than 00:00:00;00. You need to adjust for endianness, as
// seen in the revised (uncommented) line.
// frameNums[0] = frameNumber;
frameNums[0] = EndianOrder.flipNativeToBigEndian32(frameNumber);
QTHandle frameNumHandle = new QTHandle (4, false);
frameNumHandle.copyFromArray(0, frameNums, 0, 1);
// create a time code description (sample to be added)
TimeCodeDescription tcDesc = new TimeCodeDescription();
tcDesc.setTimeCodeDef (tcDef);
// add the sample to the TimeCodeMedia
tcMedia.beginEdits();
tcMedia.addSample(frameNumHandle, 0, frameNumHandle.getSize(),
movie.getDuration(), tcDesc, 1, 0);
tcMedia.endEdits();
// insert media into track
tcTrack.insertMedia(0, 0, tcMedia.getDuration(), 1);