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 ClassesModifier and TypeClassDescriptionprivate static classThe java.awt.Image-based source stream to go along with ImageDataSource.private static classA 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 classThe jpeg-based source stream to go along with ImageDataSource. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanDOCUMENT ME!private booleanDOCUMENT ME!private final javax.media.MediaLocatorMedia locator for the output file.private final javax.media.ProcessorVideo processor reference.private booleanDOCUMENT ME!private final ObjectDOCUMENT ME!private final ObjectSynchonization control variables. -
Constructor Summary
ConstructorsModifierConstructorDescriptionMovieMaker(int width, int height, int frameRate, File outputFile, Image[] images) Constructor.MovieMaker(int width, int height, int frameRate, File outputFile, File[] jpegFiles) Constructor.privateMovieMaker(File outputFile, MovieMaker.ImageDataSource ids) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcontrollerUpdate(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(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.voidMethod actually does the transcoding from JPeg images file to AVI.private booleanBlock until file writing is done.private booleanwaitForState(javax.media.Processor p, int state) Block until the processor has transitioned to the given state.
-
Field Details
-
fileDone
private boolean fileDoneDOCUMENT ME! -
fileSuccess
private boolean fileSuccessDOCUMENT ME! -
outML
private final javax.media.MediaLocator outMLMedia locator for the output file. -
processor
private final javax.media.Processor processorVideo processor reference. -
stateTransitionOK
private boolean stateTransitionOKDOCUMENT ME! -
waitFileSync
DOCUMENT ME! -
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 widthheight- frame heightframeRate- frame rateoutputFile- AVI output filejpegFiles- 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 widthheight- frame heightframeRate- frame rateoutputFile- AVI output fileimages- source images list.- Throws:
Exception- DOCUMENT ME!
-
MovieMaker
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:
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
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 fileids- ImageDataSource jpeg images file source.- Returns:
- Processor the created vedio processor.
- Throws:
Exception- DOCUMENT ME!IOException- DOCUMENT ME!IllegalArgumentException- DOCUMENT ME!
-
waitForFileDone
Block until file writing is done.- Returns:
- DOCUMENT ME!
- Throws:
InterruptedException- DOCUMENT ME!
-
waitForState
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!
-