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 java.lang.Object implements javax.media.ControllerListener, javax.media.datasink.DataSinkListenerThis 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 classMovieMaker.AWTImageSourceStreamThe java.awt.Image-based source stream to go along with ImageDataSource.private static classMovieMaker.ImageDataSourceA 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 classMovieMaker.JpegSourceStreamThe jpeg-based source stream to go along with ImageDataSource.
-
Field Summary
Fields Modifier and Type Field Description private booleanfileDoneDOCUMENT ME!private booleanfileSuccessDOCUMENT ME!private javax.media.MediaLocatoroutMLMedia locator for the output file.private javax.media.ProcessorprocessorVideo processor reference.private booleanstateTransitionOKDOCUMENT ME!private java.lang.ObjectwaitFileSyncDOCUMENT ME!private java.lang.ObjectwaitSyncSynchonization control variables.
-
Constructor Summary
Constructors Modifier Constructor Description MovieMaker(int width, int height, int frameRate, java.io.File outputFile, java.awt.Image[] images)Constructor.MovieMaker(int width, int height, int frameRate, java.io.File outputFile, java.io.File[] jpegFiles)Constructor.privateMovieMaker(java.io.File outputFile, MovieMaker.ImageDataSource ids)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontrollerUpdate(javax.media.ControllerEvent evt)Controller Listener.private static javax.media.DataSinkcreateDataSink(javax.media.Processor p, javax.media.MediaLocator outML)Create the DataSink.private javax.media.ProcessorcreateProcessor(java.io.File outputFile, MovieMaker.ImageDataSource ids)Create video processor from the given source image files and output file.voiddataSinkUpdate(javax.media.datasink.DataSinkEvent evt)Event handler for the file writer.voidmakeMovie()Method actually does the transcoding from JPeg images file to AVI.private booleanwaitForFileDone()Block until file writing is done.private booleanwaitForState(javax.media.Processor p, int state)Block until the processor has transitioned to the given state.
-
-
-
Field Detail
-
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 java.lang.Object waitFileSync
DOCUMENT ME!
-
waitSync
private final java.lang.Object waitSync
Synchonization control variables.
-
-
Constructor Detail
-
MovieMaker
public MovieMaker(int width, int height, int frameRate, java.io.File outputFile, java.io.File[] jpegFiles) throws java.lang.ExceptionConstructor.- Parameters:
width- frame widthheight- frame heightframeRate- frame rateoutputFile- AVI output filejpegFiles- jpeg images list.- Throws:
java.lang.Exception- DOCUMENT ME!
-
MovieMaker
public MovieMaker(int width, int height, int frameRate, java.io.File outputFile, java.awt.Image[] images) throws java.lang.ExceptionConstructor.- Parameters:
width- frame widthheight- frame heightframeRate- frame rateoutputFile- AVI output fileimages- source images list.- Throws:
java.lang.Exception- DOCUMENT ME!
-
MovieMaker
private MovieMaker(java.io.File outputFile, MovieMaker.ImageDataSource ids) throws java.lang.ExceptionConstructor.- Parameters:
outputFile- AVI output file.ids- jpegs image data source.- Throws:
java.lang.Exception- DOCUMENT ME!
-
-
Method Detail
-
controllerUpdate
public void controllerUpdate(javax.media.ControllerEvent evt)
Controller Listener.- Specified by:
controllerUpdatein interfacejavax.media.ControllerListener- Parameters:
evt- controller event.
-
dataSinkUpdate
public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
Event handler for the file writer.- Specified by:
dataSinkUpdatein interfacejavax.media.datasink.DataSinkListener- Parameters:
evt- DOCUMENT ME!
-
makeMovie
public void makeMovie() throws java.lang.ExceptionMethod actually does the transcoding from JPeg images file to AVI.- Throws:
java.lang.Exception- DOCUMENT ME!
-
createDataSink
private static javax.media.DataSink createDataSink(javax.media.Processor p, javax.media.MediaLocator outML) throws java.io.IOException, javax.media.NoDataSinkExceptionCreate the DataSink.- Parameters:
p- DOCUMENT ME!outML- DOCUMENT ME!- Returns:
- DOCUMENT ME!
- Throws:
java.io.IOException- DOCUMENT ME!javax.media.NoDataSinkException- DOCUMENT ME!
-
createProcessor
private javax.media.Processor createProcessor(java.io.File outputFile, MovieMaker.ImageDataSource ids) throws java.lang.ExceptionCreate video processor from the given source image files and output file.- Parameters:
outputFile- output fileids- ImageDataSource jpeg images file source.- Returns:
- Processor the created vedio processor.
- Throws:
java.lang.Exception- DOCUMENT ME!java.io.IOException- DOCUMENT ME!java.lang.IllegalArgumentException- DOCUMENT ME!
-
waitForFileDone
private boolean waitForFileDone() throws java.lang.InterruptedExceptionBlock until file writing is done.- Returns:
- DOCUMENT ME!
- Throws:
java.lang.InterruptedException- DOCUMENT ME!
-
waitForState
private boolean waitForState(javax.media.Processor p, int state) throws java.lang.InterruptedExceptionBlock 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:
java.lang.InterruptedException- DOCUMENT ME!
-
-