|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
krut.KRUT_Recording.ScreenGrabber
public class ScreenGrabber
This class is used both to record a movie and to take
separate screen shots. The movie is recorded into a temporary
data file containing a series of screen shots. This temporary
data file is an OutputStream, and the type of this stream can
be changed relatively easy. Originally the stream did not point
to a file but to memory, and because of this some methods that
have no logical place in the present class still remain here.
After recording is finished, a DataList object is used to feed a
JpegImagesToMoviesMod object with the images, creating a movie
file. After a movie file has been created, a Merge object is
used to add audio to the movie.
There are several methods in this class involving speed and memory
tests, which have become deprecated, but still remain to make sure
that the program doesn't break.
The present also handles the updating of the preview window,
and the movements of the capture area when the mouse is being
followed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
int |
acceleration
This value represents the acceleration of the capRect when we are tracking the mouse pointer. |
boolean |
audioRecording
This flag can be used to get the run() method to hold at the end, in order to increase sync between audio and video. |
java.awt.Rectangle |
capRect
The capture area for video recording. |
int |
cntMovies
cntMovies handles the numbering of the movie files, and is updated everytime a movie is finished recording. |
float |
encQuality
The video encoding quality. |
boolean |
error
error is just used to signal that something went wrong with video recording. error is set true if an exception was fired in the run() method. error is set false in the init() method. |
boolean |
followMouse
Should we follow the mouse pointer around the screen or not? |
boolean |
getMouse
getMouse selects if the mouse pointer should be in the film. |
protected DataList |
images
This object is used to reload the images from the file they are saved in, and then supply them to the JpegImagesToMovieMod class. |
boolean |
initing
A flag used to prevent the recording from starting by mistake while the init() method is running. |
int |
maxNOPics
maxNOPics should only be read. |
double |
moveLimit
This value represents the limit for when the capRect should move to be re-centered around the mouse pointer, if we are tracking the mouse pointer. |
EncodingProgressBar |
myProgressBar
This object is used if the user wants to interrupt the encoding. |
SaveFileChooser |
mySaveQuery
It is necessary for the ScreenGrabber to have access to a SaveFileChooser, because the ScreenGrabber needs to use the getNextFile() method both in init() and in finished(). |
SnapShot |
mySnapShot
It is necessary for the ScreenGrabber to have access to a SnapShot, in case a preview film is to be displayed during recording. |
boolean |
notFinished
notFinished is set to false by user to stop recording. |
boolean |
preview
if preview is true, an image is sent to the SnapShot object at each frame, where a preview film of the recording is running. |
boolean |
recording
recording is set to false at the exact time when capping is finished. |
boolean |
running
running is set to false when the ScreenGrabber is ready for another recording. |
java.io.File |
screenshotFile
The name and path of the screenshotFile. |
protected java.awt.Dimension |
screenSize
This is the screensize of the default screen. |
java.lang.String |
tempFile
The name of the tempFiles. |
double |
time
time should only be read. |
boolean |
unRecoverableError
A flag to indicate that something has gone terribly wrong with the recording of the movie. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ScreenGrabber()
Constructor for ScreenGrabber. |
|
ScreenGrabber(java.awt.Rectangle capSize,
int fps)
Constructor for ScreenGrabber. |
Method Summary | |
---|---|
void |
encode()
This is the method where the encoding of the mov-file takes place. |
void |
hold()
Used to sync video. |
void |
init()
Init or reinit the encoder. |
void |
run()
Main working method. |
void |
setFps(int fps,
int playbackFps)
Set the fps values. |
void |
setSyncTime(long syncTime)
Set the syncTime for the run() method This MUST be done before wakeUp() is called to start the recording. |
void |
snapshot()
Take a snapshot of the selected screencap area and save to a new screenshot file. |
double |
testCapTime()
Test the Robot cap time per frame. |
double[] |
testEnc()
Test the average encoder encoding size and time. |
void |
wakeUp()
Called by the user to start capturing images. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.awt.Rectangle capRect
public float encQuality
public double moveLimit
public int acceleration
public double time
public int maxNOPics
public int cntMovies
public boolean notFinished
public boolean recording
public boolean running
public boolean unRecoverableError
public boolean getMouse
public boolean followMouse
public boolean preview
public boolean error
public boolean initing
public java.lang.String tempFile
public java.io.File screenshotFile
public EncodingProgressBar myProgressBar
public boolean audioRecording
public SaveFileChooser mySaveQuery
public SnapShot mySnapShot
protected DataList images
protected java.awt.Dimension screenSize
Constructor Detail |
---|
public ScreenGrabber(java.awt.Rectangle capSize, int fps)
capSize
- The initial capture area of the ScreenGrabber.
This can later be changed by changing the public
parameter capRect, and then calling the init method
of this class.fps
- The initial fps of the ScreenGrabber. This can
later be changed by calling the setFps method of this
class.public ScreenGrabber()
Method Detail |
---|
public void init() throws java.io.IOException
java.io.IOException
public void setFps(int fps, int playbackFps)
fps
- The recording fps.playbackFps
- The playback fps.public void setSyncTime(long syncTime)
syncTime
- A parameter determining how many millis
behind the fps the capturing can fall,
before a frame is doubled to compensate.public double testCapTime() throws java.io.IOException
java.io.IOException
public double[] testEnc() throws java.io.IOException
java.io.IOException
public void snapshot()
public void hold()
public void wakeUp()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void encode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |