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 TypeMethodDescriptionboolean
addFrame
(BufferedImage image) Adds a frame to the video if it is recording.void
clear()
Clear the video from the tool in preparation for a new video.protected void
Creates the actions.protected void
Creates the GUI.Gets the video recorder.static VideoGrabber
getTool()
Gets the shared VideoGrabber.static VideoGrabber
Gets the shared VideoGrabber and sets the video dimensions.boolean
Gets the recording flag.boolean
Gets the visibility.protected void
Refreshes the GUI.Saves the video to a file and returns the file name.void
setFrameRate
(double fps) Sets the frame rate.void
setRecording
(boolean record) Sets the recording flag.void
setVideoType
(VideoType type) Sets the video type.void
setVisible
(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:
clear
in interfaceVideoTool
- Overrides:
clear
in classVideoCaptureTool
-
addFrame
Adds a frame to the video if it is recording.- Specified by:
addFrame
in interfaceVideoTool
- Overrides:
addFrame
in 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:
setVisible
in interfaceVideoTool
- Overrides:
setVisible
in classVideoCaptureTool
- Parameters:
visible
- true to set this visible
-
isVisible
public boolean isVisible()Gets the visibility.- Overrides:
isVisible
in classVideoCaptureTool
- Returns:
- true if visible
-
setRecording
public void setRecording(boolean record) Sets the recording flag.- Overrides:
setRecording
in classVideoCaptureTool
- Parameters:
record
- true to record rendered images
-
isRecording
public boolean isRecording()Gets the recording flag.- Specified by:
isRecording
in interfaceVideoTool
- Overrides:
isRecording
in classVideoCaptureTool
- Returns:
- true if recording rendered images
-
setVideoType
Sets the video type.- Overrides:
setVideoType
in classVideoCaptureTool
- Parameters:
type
- the video type
-
setFrameRate
public void setFrameRate(double fps) Sets the frame rate.- Overrides:
setFrameRate
in 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.
-