org.opensourcephysics.media.core
Interface Video

All Superinterfaces:
Drawable, DrawableImage, Interactive, InteractiveImage, Measurable, Playable, Trackable
All Known Implementing Classes:
GifVideo, ImageVideo, VideoAdapter

public interface Video
extends InteractiveImage, Playable, Trackable

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

Method Summary
 void back()
          Steps backward in the video.
 void dispose()
          Disposes of this video.
 int getEndFrameNumber()
          Gets the end frame number.
 int getFrameCount()
          Gets the total number of frames.
 double getFrameDuration(int n)
          Gets the duration of the specified frame in milliseconds.
 int getFrameNumber()
          Gets the current frame number.
 double getFrameTime(int n)
          Gets the start time of the specified frame in milliseconds.
 int getStartFrameNumber()
          Gets the start frame number.
 void setEndFrameNumber(int n)
          Sets the end frame number.
 void setFrameAngle(int n, double angle)
          Sets the angle in radians of the specified video frame measured ccw from the world x-axis.
 void setFrameHeight(int n, double height)
          Sets the height of the specified video frame in world units.
 void setFrameNumber(int n)
          Sets the frame number.
 void setFrameRelativeAspect(int n, double relativeAspect)
          Sets the relative aspect of the specified video frame.
 void setFrameWidth(int n, double width)
          Sets the width of the specified video frame in world units.
 void setFrameX(int n, double x)
          Sets x position of UL corner of the specified video frame in world units.
 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.
 void setFrameY(int n, double y)
          Sets y position of UL corner of the specified video frame in world units.
 void setStartFrameNumber(int n)
          Sets the start frame number.
 void step()
          Steps forward in the video.
 
Methods inherited from interface org.opensourcephysics.media.core.InteractiveImage
getAngle, getCoords, getHeight, getRelativeAspect, getWidth, setAngle, setCoords, setHeight, setRelativeAspect, setWidth
 
Methods inherited from interface org.opensourcephysics.display.Interactive
findInteractive, getX, getY, isEnabled, setEnabled, setX, setXY, setY
 
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 
Methods inherited from interface org.opensourcephysics.display.Drawable
draw
 
Methods inherited from interface org.opensourcephysics.media.core.DrawableImage
getFilterStack, getImage, getProperty, getPropertyNames, isVisible, setFilterStack, setProperty, setVisible
 
Methods inherited from interface org.opensourcephysics.media.core.Playable
addPropertyChangeListener, addPropertyChangeListener, getDuration, getEndTime, getRate, getStartTime, getTime, goToEnd, goToStart, isLooping, isPlaying, play, removePropertyChangeListener, removePropertyChangeListener, reset, setEndTime, setLooping, setPlaying, setRate, setStartTime, setTime, stop
 

Method Detail

step

void step()
Steps forward in the video.


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(), getEndFrameNumber()

getStartFrameNumber

int getStartFrameNumber()
Gets the start frame number.

Returns:
the number of the start frame
See Also:
getEndFrameNumber()

setStartFrameNumber

void setStartFrameNumber(int n)
Sets the start frame number.

Parameters:
n - a number between 0 and getEndFrameNumber()
See Also:
setEndFrameNumber(int)

getEndFrameNumber

int getEndFrameNumber()
Gets the end frame number.

Returns:
the number of the end frame
See Also:
getStartFrameNumber()

setEndFrameNumber

void setEndFrameNumber(int n)
Sets the end frame number.

Parameters:
n - a number between getStartFrameNumber() and getFrameCount()
See Also:
setStartFrameNumber(int)

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.