Package org.opensourcephysics.media.core
Class VideoGrabber
java.lang.Object
org.opensourcephysics.tools.VideoCaptureTool
org.opensourcephysics.media.core.VideoGrabber
A video capture utility using media classes.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor that uses default video dimensions.VideoGrabber(Dimension dim) Constructor that sets the video dimensions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddFrame(BufferedImage image) Adds a frame to the video if it is recording.voidclear()Clear the video from the tool in preparation for a new video.protected voidCreates the actions.protected voidCreates the GUI.Gets the video recorder.static VideoGrabbergetTool()Gets the shared VideoGrabber.static VideoGrabberGets the shared VideoGrabber and sets the video dimensions.booleanGets the recording flag.booleanGets the visibility.protected voidRefreshes the GUI.Saves the video to a file and returns the file name.voidsetFrameRate(double fps) Sets the frame rate.voidsetRecording(boolean record) Sets the recording flag.voidsetVideoType(VideoType type) Sets the video type.voidsetVisible(boolean visible) Sets the visibility.Methods inherited from class org.opensourcephysics.tools.VideoCaptureTool
canCapture, send
-
Field Details
-
VIDEO_CAPTURE_TOOL
A shared video capture tool.
-
-
Constructor Details
-
VideoGrabber
public VideoGrabber()Constructor that uses default video dimensions. -
VideoGrabber
Constructor that sets the video dimensions.- Parameters:
dim- the dimension
-
-
Method Details
-
getTool
Gets the shared VideoGrabber.- Returns:
- the shared VideoGrabber
-
getTool
Gets the shared VideoGrabber and sets the video dimensions.- Parameters:
dim- the dimension- Returns:
- the shared VideoGrabber
-
clear
public void clear()Clear the video from the tool in preparation for a new video.- Specified by:
clearin interfaceVideoTool- Overrides:
clearin classVideoCaptureTool
-
addFrame
Adds a frame to the video if it is recording.- Specified by:
addFramein interfaceVideoTool- Overrides:
addFramein classVideoCaptureTool- Parameters:
image- the frame to be added- Returns:
- true if frame was added
-
setVisible
public void setVisible(boolean visible) Sets the visibility.- Specified by:
setVisiblein interfaceVideoTool- Overrides:
setVisiblein classVideoCaptureTool- Parameters:
visible- true to set this visible
-
isVisible
public boolean isVisible()Gets the visibility.- Overrides:
isVisiblein classVideoCaptureTool- Returns:
- true if visible
-
setRecording
public void setRecording(boolean record) Sets the recording flag.- Overrides:
setRecordingin classVideoCaptureTool- Parameters:
record- true to record rendered images
-
isRecording
public boolean isRecording()Gets the recording flag.- Specified by:
isRecordingin interfaceVideoTool- Overrides:
isRecordingin classVideoCaptureTool- Returns:
- true if recording rendered images
-
setVideoType
Sets the video type.- Overrides:
setVideoTypein classVideoCaptureTool- Parameters:
type- the video type
-
setFrameRate
public void setFrameRate(double fps) Sets the frame rate.- Overrides:
setFrameRatein classVideoCaptureTool- Parameters:
fps- the frame rate in frames per second
-
saveVideoAs
Saves the video to a file and returns the file name.- Returns:
- the name of the file, or null if not saved
-
getRecorder
Gets the video recorder.- Returns:
- the VideoRecorder
-
createGUI
protected void createGUI()Creates the GUI. -
createActions
protected void createActions()Creates the actions. -
refreshGUI
protected void refreshGUI()Refreshes the GUI.
-