Ejemplo n.º 1
0
  /**
   * Creates an empty movie to which frames can be added.
   *
   * @throws IOException
   */
  private void createMovie() throws IOException {
    try {
      // create the scratch movie
      movie =
          Movie.createMovieFile(
              new QTFile(scratchFile),
              kMoviePlayer,
              createMovieFileDeleteCurFile | createMovieFileDontCreateResFile);

      // create the video track and media
      int timeScale = 600;
      int noVolume = 0;
      videoTrack = movie.newTrack(dim.width, dim.height, noVolume);
      videoMedia = new VideoMedia(videoTrack, timeScale);
      editing = false;
    } catch (QTException ex) {
      throw new IOException("caught in createMovie: " + ex.toString()); // $NON-NLS-1$
    }
  }
Ejemplo n.º 2
0
 /**
  * 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$
     }
 }
Ejemplo n.º 3
0
 // use a file input stream to make dragging faster as the movie is comletetly loaded into memory
 // this is not required for any other reason
 private static QTPlayer makePlayer(QTFile f) throws IOException, QTException {
   QTDrawable d = QTFactory.makeDrawable(new FileInputStream(f), kDataRefFileExtensionTag, "mov");
   Movie m = ((QTPlayer) d).getMovieController().getMovie();
   m.getTimeBase().setFlags(loopTimeBase);
   return (QTPlayer) d;
 }