org.opensourcephysics.media.core
Class VideoGrabber

java.lang.Object
  extended by org.opensourcephysics.tools.VideoCaptureTool
      extended by org.opensourcephysics.media.core.VideoGrabber
All Implemented Interfaces:
java.rmi.Remote, Tool, VideoTool

public class VideoGrabber
extends VideoCaptureTool

A video capture utility using media classes.

Version:
1.0
Author:
Douglas Brown

Field Summary
static VideoGrabber VIDEO_CAPTURE_TOOL
          A shared video capture tool.
 
Constructor Summary
VideoGrabber()
          Constructor that uses default video dimensions.
VideoGrabber(java.awt.Dimension dim)
          Constructor that sets the video dimensions.
 
Method Summary
 boolean addFrame(java.awt.image.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.
 VideoRecorder getRecorder()
          Gets the video recorder.
static VideoGrabber getTool()
          Gets the shared VideoGrabber.
static VideoGrabber getTool(java.awt.Dimension dim)
          Gets the shared VideoGrabber and sets the video dimensions.
 boolean isRecording()
          Gets the recording flag.
 boolean isVisible()
          Gets the visibility.
 java.lang.String saveVideoAs()
          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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIDEO_CAPTURE_TOOL

public static VideoGrabber VIDEO_CAPTURE_TOOL
A shared video capture tool.

Constructor Detail

VideoGrabber

public VideoGrabber()
Constructor that uses default video dimensions.


VideoGrabber

public VideoGrabber(java.awt.Dimension dim)
Constructor that sets the video dimensions.

Parameters:
dim - the dimension
Method Detail

getTool

public static VideoGrabber getTool()
Gets the shared VideoGrabber.

Returns:
the shared VideoGrabber

getTool

public static VideoGrabber getTool(java.awt.Dimension dim)
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 interface VideoTool
Overrides:
clear in class VideoCaptureTool

addFrame

public boolean addFrame(java.awt.image.BufferedImage image)
Adds a frame to the video if it is recording.

Specified by:
addFrame in interface VideoTool
Overrides:
addFrame in class VideoCaptureTool
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 interface VideoTool
Overrides:
setVisible in class VideoCaptureTool
Parameters:
visible - true to set this visible

isVisible

public boolean isVisible()
Gets the visibility.

Overrides:
isVisible in class VideoCaptureTool
Returns:
true if visible

setRecording

public void setRecording(boolean record)
Sets the recording flag.

Overrides:
setRecording in class VideoCaptureTool
Parameters:
record - true to record rendered images

isRecording

public boolean isRecording()
Gets the recording flag.

Specified by:
isRecording in interface VideoTool
Overrides:
isRecording in class VideoCaptureTool
Returns:
true if recording rendered images

setVideoType

public void setVideoType(VideoType type)
Sets the video type.

Overrides:
setVideoType in class VideoCaptureTool
Parameters:
type - the video type

setFrameRate

public void setFrameRate(double fps)
Sets the frame rate.

Overrides:
setFrameRate in class VideoCaptureTool
Parameters:
fps - the frame rate in frames per second

saveVideoAs

public java.lang.String saveVideoAs()
Saves the video to a file and returns the file name.

Returns:
the name of the file, or null if not saved

getRecorder

public VideoRecorder getRecorder()
Gets the video recorder.

Returns:
the VideoRecorder