org.opensourcephysics.media.core
Class VideoClip

java.lang.Object
  extended by org.opensourcephysics.media.core.VideoClip

public class VideoClip
extends java.lang.Object

This defines a subset of video frames called steps.

Version:
1.0
Author:
Douglas Brown

Field Summary
protected  boolean isDefaultStartTime
           
protected  java.lang.String readoutType
           
protected  Video video
           
protected  java.lang.String videoPath
           
 
Constructor Summary
VideoClip(Video video)
          Constructs a VideoClip.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this video clip.
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this video clip.
 int frameToStep(int n)
          Converts frame number to step number.
 ClipInspector getClipInspector()
          Gets the clip inspector.
 ClipInspector getClipInspector(ClipControl control, java.awt.Frame frame)
          Gets the clip inspector with access to the specified ClipControl.
 int getEndFrameNumber()
          Gets the end frame number.
 int getFrameCount()
          Gets the frame count.
 int getFrameShift()
          Gets the frame shift.
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load data for this class.
 int getStartFrameNumber()
          Gets the start frame number.
 double getStartTime()
          Gets the start time.
 int getStepCount()
          Gets the step count.
 int getStepSize()
          Gets the step size.
 Video getVideo()
          Gets the video.
 java.lang.String getVideoPath()
          Gets the video path.
 void hideClipInspector()
          Hides the clip inspector.
 boolean includesFrame(int n)
          Determines whether the specified frame is a step frame.
 boolean isAdjusting()
          Gets the adjusting flag.
 boolean isDefaultState()
          Returns true if no properties have been set or reviewed by the user.
 boolean isPlayAllSteps()
          Gets the playAllSteps flag.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this video clip.
 void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specified property.
 void setAdjusting(boolean adjusting)
          Sets the adjusting flag.
 boolean setEndFrameNumber(int end)
          Sets the end frame number.
 int setFrameShift(int n)
          Sets the frame shift.
protected  int setFrameShift(int n, int start, int stepCount)
          Sets the frame shift.
 void setPlayAllSteps(boolean all)
          Sets the playAllSteps flag.
 boolean setStartFrameNumber(int start)
          Sets the start frame number.
 boolean setStartFrameNumber(int start, int maxEndFrame)
          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 trimFrameCount()
          Trims unneeded frames after end frame (null videos only).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isDefaultStartTime

protected boolean isDefaultStartTime

video

protected Video video

readoutType

protected java.lang.String readoutType

videoPath

protected java.lang.String videoPath
Constructor Detail

VideoClip

public VideoClip(Video video)
Constructs a VideoClip.

Parameters:
video - the video
Method Detail

getVideo

public Video getVideo()
Gets the video.

Returns:
the video

getVideoPath

public java.lang.String 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 maxEndFrame)
Sets the start frame number.

Parameters:
start - the desired start frame number
maxEndFrame - end 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

setFrameShift

public int setFrameShift(int n)
Sets the frame shift.

Parameters:
n - the desired frame shift
Returns:
the new frame shift

setFrameShift

protected int setFrameShift(int n,
                            int start,
                            int stepCount)
Sets the frame shift.

Parameters:
n - the desired frame shift
start - the desired start frame
stepCount - the desired step count
Returns:
the new frame shift

getFrameShift

public int getFrameShift()
Gets the frame shift.

Returns:
frame shift

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

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

public ClipInspector getClipInspector()
Gets the clip inspector.

Returns:
the clip inspector

getClipInspector

public ClipInspector getClipInspector(ClipControl control,
                                      java.awt.Frame frame)
Gets the clip inspector with access to the specified ClipControl.

Parameters:
control - the clip control
frame - 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

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this video clip.

Parameters:
listener - the object requesting property change notification

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this video clip.

Parameters:
property - the name of the property of interest to the listener
listener - the object requesting property change notification

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this video clip.

Parameters:
listener - the listener requesting removal

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specified property.

Parameters:
property - the name of the property
listener - the listener to remove

trimFrameCount

protected void trimFrameCount()
Trims unneeded frames after end frame (null videos only).


getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load data for this class.

Returns:
the object loader