scenic.show
Class SimpleMediaFile

java.lang.Object
  extended by scenic.show.SimpleMediaFile

public class SimpleMediaFile
extends java.lang.Object

This class offers an easy to use interface for playing videos. The video is not displayed directly on the screen. Instead the video is written in to an image that can be used as any other image. Currently this class is only implemented on Windows using DirectShow and QuickTime. On Linux the class does nothing.


Constructor Summary
SimpleMediaFile(java.lang.String filename)
          Creates a media player with the given media file.
 
Method Summary
 void free()
          Frees the resources associated with this object.
 double getCurrentPosition()
          Returns the current position.
 ScenicImage getImage()
          Returns the image that contains the video.
 double getLength()
          Returns the length of the video file.
 ImageInfo[] getOutputFormats()
          Returns the available output formats.
 void pause()
          Pauses the video.
 void play()
          Starts playing the video.
 void setCurrentPosition(double position)
          Sets the current position.
 void setOutputFormat(int width, int height, int format)
          Sets the desired output format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMediaFile

public SimpleMediaFile(java.lang.String filename)
Creates a media player with the given media file. Use capture:// as the filename to open the default video capture device.

Parameters:
filename - Name of the media file.
Method Detail

free

public void free()
Frees the resources associated with this object. This method must be called to free the resources, otherwise the resources are not freed until the object is finalized.


getImage

public ScenicImage getImage()
Returns the image that contains the video.

Returns:
the image

play

public void play()
Starts playing the video.


pause

public void pause()
Pauses the video.


getCurrentPosition

public double getCurrentPosition()
Returns the current position.

Returns:
Current position in seconds.

setCurrentPosition

public void setCurrentPosition(double position)
Sets the current position.

Parameters:
position - The new position in seconds.

getLength

public double getLength()
Returns the length of the video file.

Returns:
Length of the video in seconds.

setOutputFormat

public void setOutputFormat(int width,
                            int height,
                            int format)
Sets the desired output format. This method only works with video capture. The settings must be supported by the capture device. Use getOutputFormats to find out the supported formats.

Parameters:
width - width of the image
height - height of the image
format - format of the image

getOutputFormats

public ImageInfo[] getOutputFormats()
Returns the available output formats. This method works only with video capture.

Returns:
array containing the available output formats