Interface Video

All Superinterfaces:
Drawable, DrawableImage, EventListener, Interactive, InteractiveImage, Measurable, PropertyChangeListener, Trackable
All Known Implementing Classes:
GifVideo, ImageVideo, JSMovieVideo, MovieVideo, VideoAdapter, XuggleVideo

public interface Video extends InteractiveImage, Trackable, PropertyChangeListener
This defines methods to control a video image sequence. Individual images within the sequence are referred to as frames.
Version:
1.0
Author:
Douglas Brown
  • Field Details

  • Method Details

    • removeListener

      default void removeListener(PropertyChangeListener c)
    • addListener

      default void addListener(PropertyChangeListener c)
    • getImageSize

      Dimension getImageSize(boolean withFilters)
      Gets the image size as a Dimension
      Parameters:
      withFilters - true to return size displayed after filters are applied
    • step

      void step()
      Steps forward in the
    • back

      void back()
      Steps backward in the video.
    • getFrameCount

      int getFrameCount()
      Gets the total number of frames.
      Returns:
      the number of frames in the image sequence
    • getFrameNumber

      int getFrameNumber()
      Gets the current frame number.
      Returns:
      the number of the current frame
    • setFrameNumber

      void setFrameNumber(int n)
      Sets the frame number.
      Parameters:
      n - a number between getStartFrameNumber() and getEndFrameNumber()
      See Also:
    • getStartFrameNumber

      int getStartFrameNumber()
      Gets the start frame number.
      Returns:
      the number of the start frame
      See Also:
    • setStartFrameNumber

      void setStartFrameNumber(int n)
      Sets the start frame number.
      Parameters:
      n - a number between 0 and getEndFrameNumber()
      See Also:
    • getEndFrameNumber

      int getEndFrameNumber()
      Gets the end frame number.
      Returns:
      the number of the end frame
      See Also:
    • setEndFrameNumber

      void setEndFrameNumber(int n)
      Sets the end frame number.
      Parameters:
      n - a number between getStartFrameNumber() and getFrameCount()
      See Also:
    • getFrameTime

      double getFrameTime(int n)
      Gets the start time of the specified frame in milliseconds.
      Parameters:
      n - the frame number
      Returns:
      the start time of the frame in milliseconds
    • getFrameDuration

      double getFrameDuration(int n)
      Gets the duration of the specified frame in milliseconds.
      Parameters:
      n - the frame number
      Returns:
      the duration of the frame in milliseconds
    • setFrameX

      void setFrameX(int n, double x)
      Sets x position of UL corner of the specified video frame in world units.
      Parameters:
      n - the video frame number
      x - the world x position
    • setFrameY

      void setFrameY(int n, double y)
      Sets y position of UL corner of the specified video frame in world units.
      Parameters:
      n - the video frame number
      y - the world y position
    • setFrameXY

      void setFrameXY(int n, double x, double y)
      Sets the x and y position of the UL corner of the specified video frame in world units.
      Parameters:
      n - the video frame number
      x - the world x position
      y - the world y position
    • setFrameRelativeAspect

      void setFrameRelativeAspect(int n, double relativeAspect)
      Sets the relative aspect of the specified video frame. The pixel aspect of an image is the ratio of its pixel width to height. Its world aspect is the ratio of width to height in world units. For example, a 320 x 240 pixel image has a pixel aspect of 4/3. If its relative aspect is set to 2, then the world aspect of the image will be 8/3. This means that if the image width is set to 16, its height will be 6. Conversely, if its height is set to 10, its width will be 8/3 x 10 = 26.666.
      Parameters:
      n - the video frame number
      relativeAspect - the world aspect of the image relative to its pixel aspect.
    • setFrameWidth

      void setFrameWidth(int n, double width)
      Sets the width of the specified video frame in world units. This method also sets the height using the relative aspect.
      Parameters:
      n - the video frame number
      width - the width in world units
    • setFrameHeight

      void setFrameHeight(int n, double height)
      Sets the height of the specified video frame in world units. This method also sets the width using the relative aspect.
      Parameters:
      n - the video frame number
      height - the height in world units
    • setFrameAngle

      void setFrameAngle(int n, double angle)
      Sets the angle in radians of the specified video frame measured ccw from the world x-axis.
      Parameters:
      n - the video frame number
      angle - the angle n radians
    • dispose

      void dispose()
      Disposes of this video.
    • getTypeName

      String getTypeName()
      Returns the VideoType name of this video.
    • isValid

      default boolean isValid()
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a PropertyChangeListener to this object.
      Parameters:
      listener - the listener requesting property change notification
    • addPropertyChangeListener

      void addPropertyChangeListener(String property, PropertyChangeListener listener)
      Adds a PropertyChangeListener to this object.
      Parameters:
      property - the name of the property of interest to the listener
      listener - the listener requesting property change notification
    • removePropertyChangeListener

      void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a PropertyChangeListener from this object.
      Parameters:
      listener - the listener requesting removal
    • removePropertyChangeListener

      void removePropertyChangeListener(String property, PropertyChangeListener listener)
      Removes a PropertyChangeListener from this object.
      Parameters:
      property - the name of the property of interest to the listener
      listener - the listener requesting removal
    • play

      void play()
      Plays the media.
    • stop

      void stop()
      Stops the media.
    • reset

      void reset()
      Resets the media.
    • getStartTime

      double getStartTime()
      Gets the start time in milliseconds.
      Returns:
      the start time in milliseconds
    • setStartTime

      void setStartTime(double millis)
      Sets the start time in milliseconds.
      Parameters:
      millis - the desired start time in milliseconds
    • getEndTime

      double getEndTime()
      Gets the end time in milliseconds.
      Returns:
      the end time in milliseconds
    • setEndTime

      void setEndTime(double millis)
      Sets the end time in milliseconds.
      Parameters:
      millis - the desired end time in milliseconds
    • goToStart

      void goToStart()
      Sets the time to the start time.
    • goToEnd

      void goToEnd()
      Sets the time to the end time.
    • getFrameCountDurationMS

      double getFrameCountDurationMS()
      Gets the duration of the media, including a time for the last frame From XuggleVideo code, now also for JSMovieVideo
      
       // ....[0][1][2]...[startFrame][i]...[j][endFrame]...[frameCount-1]
       // ....|--------frameCountDurationMS--(nframes * aveDuration)-----|
       // ....^..^..^..^..^...........^..^..^..^.........^..^ startTimes[i]
       // ............................|--| frameDuration[i]
       // ..................................................|------------|
       // ..................................................frameDuration[frameCoumt-1]
       // ....|-------------video-specified rawDuration------------------|
       
      Returns:
      the duration of the media in milliseconds or -1 if no video, or 100 if one frame
    • getAverageFrameDuration

      default double getAverageFrameDuration(boolean allowOneFrame)
      Calculate (last frame start time - first frame start time)/(final frame number - first frame number) when there is more than one frame. If there is just one frame and we allow just one frame, then return the 1/(average frame rate), which is the movie duration divided by the frame count. Note that this does not account for the length of the final frame, should it have one. (Xuggle, for instance, assigns the last frame time as the second-to-last frame time, and JSMovieVideo assigns the remainder of the duration to the final frame time. In addition, since first and last frame are set by the user and may not be the video itself, when there is just one frame selected, this method still returns the average frame duration for the whole video, not the duration of this selected frame. None of this particularly matters for a single frame, because the play button in the Tracker control panel is disabled in that case.
      Parameters:
      allowOneFrame -
      Returns:
    • getRate

      double getRate()
      Gets the rate at which the media plays relative to its normal rate.
      Returns:
      the relative play rate. A rate of 1.0 plays at the normal rate.
    • setRate

      void setRate(double rate)
      Sets the rate at which the media plays relative to its normal rate.
      Parameters:
      rate - the relative play rate. A rate of 1.0 plays at the normal rate.
    • setPlaying

      @Deprecated void setPlaying(boolean playing)
      Deprecated.
      Never called Starts and stops the media.
      Parameters:
      playing - true starts the media, and false stops it
    • isPlaying

      boolean isPlaying()
      Gets whether the media is playing.
      Returns:
      true if the media is playing
    • setLooping

      void setLooping(boolean looping)
      Sets the looping behavior of the media. When true, the media restarts when reaching the end.
      Parameters:
      looping - true if the media is looping
    • isLooping

      boolean isLooping()
      Gets the looping behavior of the media. When true, the video restarts when reaching the end.
      Returns:
      true if the media is looping
    • invalidateVideoAndFilter

      void invalidateVideoAndFilter()
      Invalidate the video and its filter so that it can be refreshed and so that data can be rebuilt.
    • getAverageFrameRate

      default double getAverageFrameRate()
    • getOutliers

      default BitSet getOutliers(double tolerance)