krut.KRUT_Recording
Class DataList

java.lang.Object
  extended by krut.KRUT_Recording.DataList

public class DataList
extends java.lang.Object

DataList is a class used to reload the images from the file they are saved in by the ScreenGrabber, and then supply them to the JpegImagesToMovieMod class. In other words, this is a class for communication between the ScreenGrabber class and the JpegImagesToMovieMod class. It opens the file containing the images from the grabber, and then supplies the JpegImagesToMovieMod with the images one by one, through the readNode method. This class does not take any arguments to it's constructor, but nevertheless, the following things need to be done before the DataList class can be used: The input file containing the data of the images making up every frame must be set using the setInFile(File) method. A user must also provide an integer array containting the size in bytes for every image in the File inFile. Additionally, an integer array containing the numbers of images marked as "missed" must be provided. Finally, a user must provide an integer value of the total number of frames. See the parameter comments for more details.


Field Summary
 int donePics
          A simple counter of how many unique frames we have sent.
 boolean finished
          This flag is set to true by the program when all the frames have been delivered.
 java.io.File inFile
          The input file for the frames.
 java.io.FileInputStream inStream
          The stream wrapping inFile.
 int[] missedFrames
          The parameter missedFrames should, before encoding is started, contain an array of the frame number of every frame that is missing from the image file inFile.
 int[] picSizes
          The parameter picSizes should, before encoding is started, contain an array of the size in bytes of every single image in the image file inFile.
 int sentPics
          How many frames have been sent in total, including doublets.
 int totalPics
          This is an integer containing the total number of frames in the picSizes array.
 
Method Summary
 byte[] readNode()
          Read the next frame
 boolean setInFile(java.io.File input)
          Sets the file containing the frames.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finished

public boolean finished
This flag is set to true by the program when all the frames have been delivered. It should be checked by the user of this class. This is the only way of telling if all the frames are processed or not. When a user presses "cancel" in an EndodingProgressBar, that class will set this flag to true (in it's cancelAction() method), and fake that the frames have run out.


totalPics

public int totalPics
This is an integer containing the total number of frames in the picSizes array. That means that the totalPics plus the total number of missed frames will equal the total number of frames in the final film. totalPics is the total number of unique frames. The reason why a parameter of this kind is needed is because the picSizes array will typically be much larger than the number of actual frames. Look at the comments in the ScreenGrabber.init() method for more info. (There is some redundancy, as the length of the picSizes array must be the same as totalPics)


donePics

public int donePics
A simple counter of how many unique frames we have sent. Unique as in not doubles sent to compensate for a missing frame.


sentPics

public int sentPics
How many frames have been sent in total, including doublets.


inStream

public java.io.FileInputStream inStream
The stream wrapping inFile.


inFile

public java.io.File inFile
The input file for the frames.


picSizes

public int[] picSizes
The parameter picSizes should, before encoding is started, contain an array of the size in bytes of every single image in the image file inFile. This parameter must be directly set by the user before encoding begins. It should contain an amount of integers equal to the amount of images in the file inFile. So if a film of 200 unique frames is to be encoded, this parameter should be an array of more than 200 integers.


missedFrames

public int[] missedFrames
The parameter missedFrames should, before encoding is started, contain an array of the frame number of every frame that is missing from the image file inFile. This parameter must be directly set by the user before encoding begins. If there are no missing frames in the image file inFile, this parameter must still contain at least one integer. Examples: If there are no missing frames, the array missedFrames can contain only zero's, EXCEPT for in the first position. The first position should in this case contain something that could not possibly be a valid frame number in the film, such as picSizes.length + 1; If the frames 10 and 12 are missing, the array should start with {10, 12}, and after that continue with any number lower than the current frame number. The easiest way to avoid stupid mistakes is to have the rest of the array stay the way it is: filled with zero's.

Method Detail

setInFile

public boolean setInFile(java.io.File input)
Sets the file containing the frames.

Parameters:
input - A file containg the frames for the movie.
Returns:
true if a FileInputStream wrapping input could be opened, false if not.

readNode

public byte[] readNode()
Read the next frame

Returns:
a byte array containing the frame data.