/** * Saves the video to the current scratchFile. * * @throws IOException */ protected void saveScratch() throws IOException { if (movie != null && editing) try { // end edits and save the scratch videoMedia.endEdits(); int trackStart = 0; int mediaTime = 0; int mediaRate = 1; videoTrack.insertMedia(trackStart, mediaTime, videoMedia.getDuration(), mediaRate); editing = false; OpenMovieFile outStream = OpenMovieFile.asWrite(new QTFile(scratchFile)); movie.addResource(outStream, movieInDataForkResID, scratchFile.getName()); outStream.close(); movie = null; OSPLog.finest( "saved " + frameCount + " frames in " + scratchFile); // $NON-NLS-1$ //$NON-NLS-2$ } catch (QTException ex) { throw new IOException("caught in saveScratch: " + ex.toString()); // $NON-NLS-1$ } }
/** Close out and finish the movie file. */ public void finish() { try { if (readyForFrames) { // System.out.println("Finishing movie file."); readyForFrames = false; videoMedia.endEdits(); videoTrack.insertMedia(0, 0, videoMedia.getDuration(), 1); OpenMovieFile omf = OpenMovieFile.asWrite(movFile); movie.addResource(omf, StdQTConstants.movieInDataForkResID, movFile.getName()); } } catch (StdQTException se) { se.printStackTrace(); } catch (QTException qe) { qe.printStackTrace(); } }
public void init() { try { if (QTSession.isInitialized() == false) QTSession.open(); // set up a QTComponent which will disply its content // at its original size of smaller and centered in the space given // to the QTComponent when the applet is layed out setLayout(new BorderLayout()); QTFile qtf = new QTFile(getCodeBase().getFile() + getParameter("file")); OpenMovieFile fis = OpenMovieFile.asRead(qtf); mov = Movie.fromFile(fis); qtc = QTFactory.makeQTComponent(mov); } catch (QTException qtE) { throw new RuntimeException(qtE.getMessage()); } }