Package org.opensourcephysics.media.core
Class VideoClip
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.VideoClip
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
This defines a subset of video frames called steps.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
dispose()
boolean
extendEndFrameNumber
(int end) Sets the end frame number after adding extra frames if needed.void
finalize()
int
frameToStep
(int n) Converts frame number to step number.Gets the clip inspector.getClipInspector
(ClipControl control, Frame frame) Gets the clip inspector with access to the specified ClipControl.int
Gets the end frame number.int
Gets the extra frame count.int
Gets the first frame number.int
Gets the frame count.int
Gets the last frame number.static XML.ObjectLoader
Returns an XML.ObjectLoader to save and load data for this class.int
Gets the start frame number.double
Gets the start time.int
Gets the step count.int
Gets the step size.getVideo()
Gets the video.Gets the video path.void
Hides the clip inspector.boolean
includesFrame
(int n) Determines whether the specified frame is a step frame.boolean
Gets the adjusting flag.boolean
Returns true if no properties have been set or reviewed by the user.boolean
Gets the playAllSteps flag.boolean
isValid()
void
void
void
setAdjusting
(boolean adjusting) Sets the adjusting flag.boolean
setEndFrameNumber
(int end) Sets the end frame number.void
setExtraFrames
(int extras) Sets the extra frame count.void
setPlayAllSteps
(boolean all) Sets the playAllSteps flag.boolean
setStartFrameNumber
(int start) Sets the start frame number.boolean
setStartFrameNumber
(int start, int maxStart) Sets the start frame number.void
setStartTime
(double t0) Sets the start time.void
setStepCount
(int count) Sets the step count.boolean
setStepSize
(int size) Sets the step size.int
stepToFrame
(int stepNumber) Converts step number to frame number.protected void
Trims unneeded frames after end frame (null videos only).Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
PROPERTY_VIDEOCLIP_FRAMECOUNT
- See Also:
-
PROPERTY_VIDEOCLIP_STARTFRAME
- See Also:
-
PROPERTY_VIDEOCLIP_STARTTIME
- See Also:
-
PROPERTY_VIDEOCLIP_STEPCOUNT
- See Also:
-
PROPERTY_VIDEOCLIP_STEPSIZE
- See Also:
-
changeEngine
public boolean changeEngine -
invalid
protected boolean invalid -
isDefaultStartTime
protected boolean isDefaultStartTime -
readoutType
-
videoPath
-
savedStartTime
protected double savedStartTime -
startTimeIsSaved
protected boolean startTimeIsSaved -
extraFrames
protected int extraFrames -
loader
-
frameShift
public int frameShift
-
-
Constructor Details
-
VideoClip
Constructs a VideoClip.- Parameters:
video
- the video
-
-
Method Details
-
addListener
-
removeListener
-
isValid
public boolean isValid() -
getVideo
Gets the video.- Returns:
- the video
-
getVideoPath
Gets the video path.- Returns:
- the video path
-
setStartFrameNumber
public boolean setStartFrameNumber(int start) Sets the start frame number.- Parameters:
start
- the desired start frame number- Returns:
- true if changed
-
setStartFrameNumber
public boolean setStartFrameNumber(int start, int maxStart) Sets the start frame number.- Parameters:
start
- the desired start frame numbermaxStart
- start frame number that cannot be exceeded- Returns:
- true if changed
-
getStartFrameNumber
public int getStartFrameNumber()Gets the start frame number.- Returns:
- the start frame number
-
setStepSize
public boolean setStepSize(int size) Sets the step size.- Parameters:
size
- the desired step size- Returns:
- true if changed
-
getStepSize
public int getStepSize()Gets the step size.- Returns:
- the step size
-
setStepCount
public void setStepCount(int count) Sets the step count.- Parameters:
count
- the desired number of steps
-
getStepCount
public int getStepCount()Gets the step count.- Returns:
- the number of steps
-
setExtraFrames
public void setExtraFrames(int extras) Sets the extra frame count. Extra frames are blank frames after the last frame of a video.- Parameters:
extras
- the number of extra frames to display
-
getExtraFrames
public int getExtraFrames()Gets the extra frame count.- Returns:
- the extra frames
-
getFrameCount
public int getFrameCount()Gets the frame count.- Returns:
- the number of frames
-
setStartTime
public void setStartTime(double t0) Sets the start time.- Parameters:
t0
- the start time in milliseconds
-
getStartTime
public double getStartTime()Gets the start time.- Returns:
- the start time in milliseconds
-
getEndFrameNumber
public int getEndFrameNumber()Gets the end frame number.- Returns:
- the end frame
-
setEndFrameNumber
public boolean setEndFrameNumber(int end) Sets the end frame number.- Parameters:
end
- the desired end frame- Returns:
- true if the end frame number was changed
-
extendEndFrameNumber
public boolean extendEndFrameNumber(int end) Sets the end frame number after adding extra frames if needed.- Parameters:
end
- the desired end frame- Returns:
- true if the end frame number was extended
-
stepToFrame
public int stepToFrame(int stepNumber) Converts step number to frame number.- Parameters:
stepNumber
- the step number- Returns:
- the frame number
-
frameToStep
public int frameToStep(int n) Converts frame number to step number. A frame number that falls between two steps maps to the previous step.- Parameters:
n
- the frame number- Returns:
- the step number
-
includesFrame
public boolean includesFrame(int n) Determines whether the specified frame is a step frame.- Parameters:
n
- the frame number- Returns:
true
if the frame is a step frame
-
getClipInspector
Gets the clip inspector.- Returns:
- the clip inspector
-
getClipInspector
Gets the clip inspector with access to the specified ClipControl.- Parameters:
control
- the clip controlframe
- the owner of the inspector- Returns:
- the clip inspector
-
hideClipInspector
public void hideClipInspector()Hides the clip inspector. -
isDefaultState
public boolean isDefaultState()Returns true if no properties have been set or reviewed by the user.- Returns:
- true if in a default state
-
setAdjusting
public void setAdjusting(boolean adjusting) Sets the adjusting flag.- Parameters:
adjusting
- true if adjusting
-
isAdjusting
public boolean isAdjusting()Gets the adjusting flag.- Returns:
- true if adjusting
-
setPlayAllSteps
public void setPlayAllSteps(boolean all) Sets the playAllSteps flag.- Parameters:
all
- true to play all steps
-
isPlayAllSteps
public boolean isPlayAllSteps()Gets the playAllSteps flag.- Returns:
- true if playing all steps
-
trimFrameCount
protected void trimFrameCount()Trims unneeded frames after end frame (null videos only). -
getFirstFrameNumber
public int getFirstFrameNumber()Gets the first frame number.- Returns:
- the frame number
-
getLastFrameNumber
public int getLastFrameNumber()Gets the last frame number.- Returns:
- the frame number
-
getLoader
Returns an XML.ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
dispose
public void dispose()- Overrides:
dispose
in classOSPRuntime.Supported
-
finalize
public void finalize()
-