Class MovieMaker

java.lang.Object
gov.nih.mipav.view.renderer.flythroughview.MovieMaker
All Implemented Interfaces:
javax.media.ControllerListener, javax.media.datasink.DataSinkListener

public class MovieMaker extends Object implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener
This class creates AVIs (.avi) out of a list of JPEG files or out of an array of java.awt.Image objects.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    The java.awt.Image-based source stream to go along with ImageDataSource.
    private static class 
    A DataSource to read from a list of JPEG image files or java.awt.Images, and turn that into a stream of JMF buffers.
    private static class 
    The jpeg-based source stream to go along with ImageDataSource.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
    DOCUMENT ME!
    private boolean
    DOCUMENT ME!
    private final javax.media.MediaLocator
    Media locator for the output file.
    private final javax.media.Processor
    Video processor reference.
    private boolean
    DOCUMENT ME!
    private final Object
    DOCUMENT ME!
    private final Object
    Synchonization control variables.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    MovieMaker(int width, int height, int frameRate, File outputFile, Image[] images)
    Constructor.
     
    MovieMaker(int width, int height, int frameRate, File outputFile, File[] jpegFiles)
    Constructor.
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    controllerUpdate(javax.media.ControllerEvent evt)
    Controller Listener.
    private static javax.media.DataSink
    createDataSink(javax.media.Processor p, javax.media.MediaLocator outML)
    Create the DataSink.
    private javax.media.Processor
    Create video processor from the given source image files and output file.
    void
    dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
    Event handler for the file writer.
    void
    Method actually does the transcoding from JPeg images file to AVI.
    private boolean
    Block until file writing is done.
    private boolean
    waitForState(javax.media.Processor p, int state)
    Block until the processor has transitioned to the given state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fileDone

      private boolean fileDone
      DOCUMENT ME!
    • fileSuccess

      private boolean fileSuccess
      DOCUMENT ME!
    • outML

      private final javax.media.MediaLocator outML
      Media locator for the output file.
    • processor

      private final javax.media.Processor processor
      Video processor reference.
    • stateTransitionOK

      private boolean stateTransitionOK
      DOCUMENT ME!
    • waitFileSync

      private final Object waitFileSync
      DOCUMENT ME!
    • waitSync

      private final Object waitSync
      Synchonization control variables.
  • Constructor Details

    • MovieMaker

      public MovieMaker(int width, int height, int frameRate, File outputFile, File[] jpegFiles) throws Exception
      Constructor.
      Parameters:
      width - frame width
      height - frame height
      frameRate - frame rate
      outputFile - AVI output file
      jpegFiles - jpeg images list.
      Throws:
      Exception - DOCUMENT ME!
    • MovieMaker

      public MovieMaker(int width, int height, int frameRate, File outputFile, Image[] images) throws Exception
      Constructor.
      Parameters:
      width - frame width
      height - frame height
      frameRate - frame rate
      outputFile - AVI output file
      images - source images list.
      Throws:
      Exception - DOCUMENT ME!
    • MovieMaker

      private MovieMaker(File outputFile, MovieMaker.ImageDataSource ids) throws Exception
      Constructor.
      Parameters:
      outputFile - AVI output file.
      ids - jpegs image data source.
      Throws:
      Exception - DOCUMENT ME!
  • Method Details

    • controllerUpdate

      public void controllerUpdate(javax.media.ControllerEvent evt)
      Controller Listener.
      Specified by:
      controllerUpdate in interface javax.media.ControllerListener
      Parameters:
      evt - controller event.
    • dataSinkUpdate

      public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
      Event handler for the file writer.
      Specified by:
      dataSinkUpdate in interface javax.media.datasink.DataSinkListener
      Parameters:
      evt - DOCUMENT ME!
    • makeMovie

      public void makeMovie() throws Exception
      Method actually does the transcoding from JPeg images file to AVI.
      Throws:
      Exception - DOCUMENT ME!
    • createDataSink

      private static javax.media.DataSink createDataSink(javax.media.Processor p, javax.media.MediaLocator outML) throws IOException, javax.media.NoDataSinkException
      Create the DataSink.
      Parameters:
      p - DOCUMENT ME!
      outML - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
      Throws:
      IOException - DOCUMENT ME!
      javax.media.NoDataSinkException - DOCUMENT ME!
    • createProcessor

      private javax.media.Processor createProcessor(File outputFile, MovieMaker.ImageDataSource ids) throws Exception
      Create video processor from the given source image files and output file.
      Parameters:
      outputFile - output file
      ids - ImageDataSource jpeg images file source.
      Returns:
      Processor the created vedio processor.
      Throws:
      Exception - DOCUMENT ME!
      IOException - DOCUMENT ME!
      IllegalArgumentException - DOCUMENT ME!
    • waitForFileDone

      private boolean waitForFileDone() throws InterruptedException
      Block until file writing is done.
      Returns:
      DOCUMENT ME!
      Throws:
      InterruptedException - DOCUMENT ME!
    • waitForState

      private boolean waitForState(javax.media.Processor p, int state) throws InterruptedException
      Block until the processor has transitioned to the given state. Return false if the transition failed.
      Parameters:
      p - reference.
      state - processor transcoding state.
      Returns:
      DOCUMENT ME!
      Throws:
      InterruptedException - DOCUMENT ME!