Package org.opensourcephysics.media.core
Class ClipControl
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.ClipControl
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
- Direct Known Subclasses:
StepperClipControl
,VideoClipControl
A ClipControl controls a VideoClip. This is an abstract class that cannot be
instantiated directly.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VideoClip
int
protected boolean
static final String
static final String
static final String
static final String
static final String
protected double
protected double
protected int
protected DataTrack
protected double
protected Video
protected int
boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ClipControl
(VideoClip videoClip) Constructs a ClipControl object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
back()
Steps back one step.void
dispose()
Empty dispose method.static ClipControl
getControl
(VideoClip clip) Returns an instance of ClipControl.int
Gets the current frame number.abstract double
Gets the average frame duration in milliseconds.double
Gets the measured play rate.double
getRate()
Gets the play rate.int
Gets the step number.abstract double
getStepTime
(int stepNumber) Gets the start time of the specified step measured from step 0.abstract double
getTime()
Gets the current time in milliseconds measured from step 0.Gets the DataTrack time source, if any.Gets the clip that is controlled by this clip control.boolean
Gets the looping status.abstract boolean
Gets the playing status.static boolean
isTimeSource
(DataTrack track) Determines if a DataTrack is actively providing time data.void
play()
Plays the clip.void
Responds to property change events.abstract void
setFrameDuration
(double duration) Sets the frame duration.void
setFrameNumber
(int n) Sets the frame number.void
setLooping
(boolean loops) Turns on/off looping.void
setRate
(double newRate) Sets the play rate.void
setStepNumber
(int n) Sets the step number.void
setTimeSource
(DataTrack source) Sets the time source to a DataTrack.void
step()
Steps forward one step.void
stop()
Stops at the next step.Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
stepNumber
protected int stepNumber -
videoFrameNumber
protected int videoFrameNumber -
clip
-
video
-
rate
protected double rate -
looping
protected boolean looping -
timeStretch
protected double timeStretch -
timeSource
-
savedFrameDuration
protected double savedFrameDuration -
videoVisible
public boolean videoVisible -
loadedStepNumber
public int loadedStepNumber -
PROPERTY_CLIPCONTROL_LOOPING
- See Also:
-
PROPERTY_CLIPCONTROL_PLAYING
- See Also:
-
PROPERTY_CLIPCONTROL_RATE
- See Also:
-
PROPERTY_CLIPCONTROL_STEPNUMBER
- See Also:
-
PROPERTY_CLIPCONTROL_FRAMEDURATION
- See Also:
-
-
Constructor Details
-
ClipControl
Constructs a ClipControl object. This is an abstract class that cannot be instantiated directly.- Parameters:
videoClip
- the video clip
-
-
Method Details
-
getControl
Returns an instance of ClipControl.- Parameters:
clip
- the video clip- Returns:
- an appropriate clip control
-
getVideoClip
Gets the clip that is controlled by this clip control.- Returns:
- the clip
-
play
public void play()Plays the clip. -
stop
public void stop()Stops at the next step. -
step
public void step()Steps forward one step. -
back
public void back()Steps back one step. -
setFrameNumber
public void setFrameNumber(int n) Sets the frame number.- Parameters:
n
- the desired frame number
-
setStepNumber
public void setStepNumber(int n) Sets the step number.- Parameters:
n
- the desired step number
-
getStepNumber
public int getStepNumber()Gets the step number.- Returns:
- the current step number
-
setRate
public void setRate(double newRate) Sets the play rate.- Parameters:
newRate
- the desired rate
-
getRate
public double getRate()Gets the play rate.- Returns:
- the current rate
-
getMeasuredRate
public double getMeasuredRate()Gets the measured play rate. Default is the set rate. StepperClipControl overrides to report true measured rate.- Returns:
- the measured rate
-
setLooping
public void setLooping(boolean loops) Turns on/off looping.- Parameters:
loops
-true
to turn looping on
-
isLooping
public boolean isLooping()Gets the looping status.- Returns:
true
if looping is on
-
getFrameNumber
public int getFrameNumber()Gets the current frame number.- Returns:
- the frame number
-
getTimeSource
Gets the DataTrack time source, if any.- Returns:
- the time source (may be null)
-
setTimeSource
Sets the time source to a DataTrack.- Parameters:
source
- the time source (may be null)
-
propertyChange
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
- the property change event
-
isPlaying
public abstract boolean isPlaying()Gets the playing status.- Returns:
true
if playing
-
getTime
public abstract double getTime()Gets the current time in milliseconds measured from step 0.- Returns:
- the current time
-
getStepTime
public abstract double getStepTime(int stepNumber) Gets the start time of the specified step measured from step 0.- Parameters:
stepNumber
- the step number- Returns:
- the step time
-
setFrameDuration
public abstract void setFrameDuration(double duration) Sets the frame duration.- Parameters:
duration
- the desired frame duration in milliseconds
-
getMeanFrameDuration
public abstract double getMeanFrameDuration()Gets the average frame duration in milliseconds.- Returns:
- the mean frame duration in milliseconds
-
dispose
public void dispose()Empty dispose method.- Overrides:
dispose
in classOSPRuntime.Supported
-
isTimeSource
Determines if a DataTrack is actively providing time data.
-