org.opensourcephysics.media.xuggle
Class XuggleVideo

java.lang.Object
  extended by org.opensourcephysics.media.core.VideoAdapter
      extended by org.opensourcephysics.media.xuggle.XuggleVideo
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Drawable, Interactive, Measurable, DrawableImage, InteractiveImage, Playable, Trackable, Video

public class XuggleVideo
extends VideoAdapter

A class to display videos using the Xuggle library. Xuggle in turn uses FFMpeg as its video engine.


Field Summary
 
Fields inherited from class org.opensourcephysics.media.core.VideoAdapter
aspects, bufferedImage, clearRaster, coords, endFrameNumber, filteredImage, filterStack, frameCount, frameNumber, isMeasured, isValidFilteredImage, isValidImage, isValidMeasure, looping, maxX, maxY, minX, minY, mouseEnabled, playing, properties, rate, rawImage, size, startFrameNumber, support, visible, widthDominates
 
Constructor Summary
XuggleVideo(java.lang.String fileName)
          Creates a XuggleVideo and loads a video file specified by name
 
Method Summary
 void dispose()
          Disposes of this video.
protected  void finalize()
          Called by the garbage collector when this video is no longer in use.
 double getDuration()
          Gets the duration of the video.
 double getEndTime()
          Gets the end frame time in milliseconds.
 double getFrameTime(int n)
          Gets the start time of the specified frame in milliseconds.
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load XuggleVideo data.
 double getStartTime()
          Gets the start frame time in milliseconds.
 double getTime()
          Gets the current frame time in milliseconds.
 boolean isSmoothPlay()
          Gets the playSmoothly flag.
 void play()
          Plays the video at the current rate.
 void setEndTime(double millis)
          Sets the end frame to (nearly) a desired time in milliseconds.
 void setFrameNumber(int n)
          Sets the frame number.
 void setRate(double rate)
          Sets the relative play rate.
 void setSmoothPlay(boolean smooth)
          Sets the playSmoothly flag.
 void setStartTime(double millis)
          Sets the start frame to (nearly) a desired time in milliseconds.
 void setTime(double millis)
          Sets the frame number to (nearly) a desired time in milliseconds.
 void stop()
          Stops the video.
 
Methods inherited from class org.opensourcephysics.media.core.VideoAdapter
addPropertyChangeListener, addPropertyChangeListener, back, draw, findInteractive, findMinMaxValues, firePropertyChange, getAngle, getCoords, getEndFrameNumber, getFilterStack, getFrameCount, getFrameDuration, getFrameNumber, getHeight, getImage, getProperty, getPropertyNames, getRate, getRelativeAspect, getStartFrameNumber, getWidth, getX, getXMax, getXMin, getY, getYMax, getYMin, goToEnd, goToStart, initialize, isEnabled, isLooping, isMeasured, isPlaying, isVisible, propertyChange, refreshBufferedImage, removePropertyChangeListener, removePropertyChangeListener, reset, setAngle, setCoords, setEnabled, setEndFrameNumber, setFilterStack, setFrameAngle, setFrameHeight, setFrameRelativeAspect, setFrameWidth, setFrameX, setFrameXY, setFrameY, setHeight, setLooping, setPlaying, setProperty, setRelativeAspect, setStartFrameNumber, setVisible, setWidth, setX, setXY, setY, step
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XuggleVideo

public XuggleVideo(java.lang.String fileName)
            throws java.io.IOException
Creates a XuggleVideo and loads a video file specified by name

Parameters:
fileName - the name of the video file
Throws:
java.io.IOException
Method Detail

play

public void play()
Plays the video at the current rate. Overrides VideoAdapter method.

Specified by:
play in interface Playable
Overrides:
play in class VideoAdapter

stop

public void stop()
Stops the video.

Specified by:
stop in interface Playable
Overrides:
stop in class VideoAdapter

setFrameNumber

public void setFrameNumber(int n)
Sets the frame number. Overrides VideoAdapter setFrameNumber method.

Specified by:
setFrameNumber in interface Video
Overrides:
setFrameNumber in class VideoAdapter
Parameters:
n - the desired frame number
See Also:
Video.getStartFrameNumber(), Video.getEndFrameNumber()

getFrameTime

public double getFrameTime(int n)
Gets the start time of the specified frame in milliseconds.

Specified by:
getFrameTime in interface Video
Overrides:
getFrameTime in class VideoAdapter
Parameters:
n - the frame number
Returns:
the start time of the frame in milliseconds, or -1 if not known

getTime

public double getTime()
Gets the current frame time in milliseconds.

Specified by:
getTime in interface Playable
Overrides:
getTime in class VideoAdapter
Returns:
the current time in milliseconds, or -1 if not known

setTime

public void setTime(double millis)
Sets the frame number to (nearly) a desired time in milliseconds.

Specified by:
setTime in interface Playable
Overrides:
setTime in class VideoAdapter
Parameters:
millis - the desired time in milliseconds

getStartTime

public double getStartTime()
Gets the start frame time in milliseconds.

Specified by:
getStartTime in interface Playable
Overrides:
getStartTime in class VideoAdapter
Returns:
the start time in milliseconds, or -1 if not known

setStartTime

public void setStartTime(double millis)
Sets the start frame to (nearly) a desired time in milliseconds.

Specified by:
setStartTime in interface Playable
Overrides:
setStartTime in class VideoAdapter
Parameters:
millis - the desired start time in milliseconds

getEndTime

public double getEndTime()
Gets the end frame time in milliseconds.

Specified by:
getEndTime in interface Playable
Overrides:
getEndTime in class VideoAdapter
Returns:
the end time in milliseconds, or -1 if not known

setEndTime

public void setEndTime(double millis)
Sets the end frame to (nearly) a desired time in milliseconds.

Specified by:
setEndTime in interface Playable
Overrides:
setEndTime in class VideoAdapter
Parameters:
millis - the desired end time in milliseconds

getDuration

public double getDuration()
Gets the duration of the video.

Specified by:
getDuration in interface Playable
Overrides:
getDuration in class VideoAdapter
Returns:
the duration of the video in milliseconds, or -1 if not known

setRate

public void setRate(double rate)
Sets the relative play rate. Overrides VideoAdapter method.

Specified by:
setRate in interface Playable
Overrides:
setRate in class VideoAdapter
Parameters:
rate - the relative play rate.

dispose

public void dispose()
Disposes of this video.

Specified by:
dispose in interface Video
Overrides:
dispose in class VideoAdapter

setSmoothPlay

public void setSmoothPlay(boolean smooth)
Sets the playSmoothly flag.

Parameters:
smooth - true to play smoothly

isSmoothPlay

public boolean isSmoothPlay()
Gets the playSmoothly flag.

Returns:
true if playing smoothly

finalize

protected void finalize()
Called by the garbage collector when this video is no longer in use.

Overrides:
finalize in class VideoAdapter

getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load XuggleVideo data.

Returns:
the object loader