Class VideoClip

java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.VideoClip
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class VideoClip extends OSPRuntime.Supported implements PropertyChangeListener
This defines a subset of video frames called steps.
Version:
1.0
Author:
Douglas Brown
  • Field Details

    • PROPERTY_VIDEOCLIP_FRAMECOUNT

      public static final String PROPERTY_VIDEOCLIP_FRAMECOUNT
      See Also:
    • PROPERTY_VIDEOCLIP_STARTFRAME

      public static final String PROPERTY_VIDEOCLIP_STARTFRAME
      See Also:
    • PROPERTY_VIDEOCLIP_STARTTIME

      public static final String PROPERTY_VIDEOCLIP_STARTTIME
      See Also:
    • PROPERTY_VIDEOCLIP_STEPCOUNT

      public static final String PROPERTY_VIDEOCLIP_STEPCOUNT
      See Also:
    • PROPERTY_VIDEOCLIP_STEPSIZE

      public static final String PROPERTY_VIDEOCLIP_STEPSIZE
      See Also:
    • changeEngine

      public boolean changeEngine
    • invalid

      protected boolean invalid
    • isDefaultStartTime

      protected boolean isDefaultStartTime
    • readoutType

      protected String readoutType
    • videoPath

      protected String videoPath
    • savedStartTime

      protected double savedStartTime
    • startTimeIsSaved

      protected boolean startTimeIsSaved
    • extraFrames

      protected int extraFrames
    • loader

    • frameShift

      public int frameShift
  • Constructor Details

    • VideoClip

      public VideoClip(Video video)
      Constructs a VideoClip.
      Parameters:
      video - the video
  • Method Details

    • addListener

      public void addListener(PropertyChangeListener c)
    • removeListener

      public void removeListener(PropertyChangeListener c)
    • isValid

      public boolean isValid()
    • getVideo

      public Video getVideo()
      Gets the video.
      Returns:
      the video
    • getVideoPath

      public 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 maxStart)
      Sets the start frame number.
      Parameters:
      start - the desired start frame number
      maxStart - 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

      public ClipInspector getClipInspector()
      Gets the clip inspector.
      Returns:
      the clip inspector
    • getClipInspector

      public ClipInspector getClipInspector(ClipControl control, 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
    • 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

      public static XML.ObjectLoader getLoader()
      Returns an XML.ObjectLoader to save and load data for this class.
      Returns:
      the object loader
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • dispose

      public void dispose()
      Overrides:
      dispose in class OSPRuntime.Supported
    • finalize

      public void finalize()
      Overrides:
      finalize in class Object