se.lth.cs.jpeg
Class JPEGPlayer

java.lang.Object
  |
  +--se.lth.cs.jpeg.AbstractJPEGStream
        |
        +--se.lth.cs.jpeg.JPEGPlayer

public class JPEGPlayer
extends AbstractJPEGStream

A camera substitute. Plays back a recording (xxx.Jpeg file, as created by SunVideoPlus).

Hacker mode

There is a hacker mode available. It is enabled if you start your application with something like

% java -Dsunvideo.hackermode YourApplication...
The hacker mode gives you a window where you can manipulate skip rate, frame rate, and use a special still mode. In still mode, the first five frames of the film are shown cyclically, rather than the entire film. (The still mode thus mimicks a setting where nothing happens in front of the camera.)

The still mode is turned off by clicking a check button. This way you can interactively decide when something should happen in the film.

Rules for determining image dimensions and frame rate

Image dimensions are determined from the video stream; the first image is decompressed and its dimensions found out.

The frame rate is trickier. SunVideoPlus creates a .VCR file for each recording, containing information about image dimensions, frame rate, and so on. If a file with the same name as the video file but with extension .VCR exists, it is read and searched for information about frame rate. Otherwise some default value is assumed (currently 12). (An alternative constructor, where the user can explicitly state the frame rate, is also given.)


Field Summary
 
Fields inherited from class se.lth.cs.jpeg.AbstractJPEGStream
NORMAL_SIZE, SMALL_SIZE
 
Constructor Summary
JPEGPlayer(java.lang.String fileName)
          Create a JPEG player with no ID and load a JPEG video from the given .Jpeg file.
JPEGPlayer(java.lang.String fileName, float rate)
          Create a JPEG player with the given ID and load a JPEG video from the given .Jpeg file.
 
Method Summary
 JPEGEvent getNextFrame()
          Returns an image (JPEG encoded) from the video sequence.
 void setSkip(int skip)
           
 
Methods inherited from class se.lth.cs.jpeg.AbstractJPEGStream
getDimension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGPlayer

public JPEGPlayer(java.lang.String fileName)
Create a JPEG player with no ID and load a JPEG video from the given .Jpeg file. The frame rate is determined from the .VCR file (if it exists, otherwise a default value is assumed).

Parameters:
fileName - Name of video file (.Jpeg) to load

JPEGPlayer

public JPEGPlayer(java.lang.String fileName,
                  float rate)
Create a JPEG player with the given ID and load a JPEG video from the given .Jpeg file. Use the frame rate passed as parameter.

Parameters:
fileName - Name of video file (.Jpeg) to load
rate - Frame rate of the video, e.g., 10 for a video sequence filmed at 10 frames/second. (-1=parse .VCR)
Method Detail

getNextFrame

public JPEGEvent getNextFrame()
Returns an image (JPEG encoded) from the video sequence. Note that this method may return the same image several times in a row in some situations. If you, for example, use a video that was recorded at 10 frames/second but request 20 frames/second, you will typically get every image twice.

Specified by:
getNextFrame in class AbstractJPEGStream

setSkip

public void setSkip(int skip)