Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

PlayingDirector Class Reference

This class can be used to control the playing of a video, in video based applications. More...

List of all members.

Public Methods

 PlayingDirector ()
 PlayingDirector (int nrFrames, int frameInc, double frameRate)
int getNrFrames ()
void setNrFrames (int nrFrames)
int getCurrentFrame ()
void setCurrentFrame (int fr)
int getFrameInc ()
void setFrameInc (int frameInc)
boolean isRealTime ()
void setRealTime (boolean rt)
double getFrameRate ()
void setFrameRate (double fps)
void addPlayingObserver (PlayingObserver o)
void removePlayingObserver (PlayingObserver o)
void doReset ()
void doStop ()
void doPlay ()
void doStep ()
void doFrameChanged (int frameNr, Object src)
void stopThread ()


Detailed Description

This class can be used to control the playing of a video, in video based applications.

This class controls a thread that iterates over a sequence of numbers (say the frame numbers of a sequence). PlayingObservers can be registered to be notified each time a new number arrives. A PlayingObserver can be used, for instance, to display each frame.

A PlayingObserver is notified in two steps: prepareNewFrame and updateNewFrame. prepareNewFrame is called from the PlayingObserver thread, and updateNewFrame is called from the AWT event dispatch thread. If a PlayingObserver has to call some Swing related function (change the interface to display new frame), this call has to be done in the updateNewFrame: Swing is not thread-safe, and all the calls to Swing components have to be done from the AWT event dispatch thread. If the PlayingObserver has to perform some other processing not related to Swing (for instance, retrieve a new frame from the sequence), better put this call in prepareNewFrame. This will prevent the AWT event thread from being too busy and thus the GUI will react better to user input.

When the PlayingDirector reaches a new sequence number, it first calls the prepareNewFrame of all the PlayingObservers (sequentially), and then it tells the AWT event thread to call the updateNewFrame method of all the observers. Once all the updateNewFrame has been called, the PlayingDirector moves to a new sequence number.


Constructor & Destructor Documentation

PlayingDirector::PlayingDirector   [inline]
 

PlayingDirector::PlayingDirector int    nrFrames,
int    frameInc,
double    frameRate
[inline]
 


Member Function Documentation

int PlayingDirector::getNrFrames   [inline]
 

void PlayingDirector::setNrFrames int    nrFrames [inline]
 

int PlayingDirector::getCurrentFrame   [inline]
 

void PlayingDirector::setCurrentFrame int    fr [inline]
 

int PlayingDirector::getFrameInc   [inline]
 

void PlayingDirector::setFrameInc int    frameInc [inline]
 

boolean PlayingDirector::isRealTime   [inline]
 

void PlayingDirector::setRealTime boolean    rt [inline]
 

double PlayingDirector::getFrameRate   [inline]
 

void PlayingDirector::setFrameRate double    fps [inline]
 

void PlayingDirector::addPlayingObserver PlayingObserver    o [inline]
 

void PlayingDirector::removePlayingObserver PlayingObserver    o [inline]
 

void PlayingDirector::doReset   [inline]
 

void PlayingDirector::doStop   [inline]
 

void PlayingDirector::doPlay   [inline]
 

void PlayingDirector::doStep   [inline]
 

void PlayingDirector::doFrameChanged int    frameNr,
Object    src
[inline]
 

void PlayingDirector::stopThread   [inline]
 


The documentation for this class was generated from the following file:
Generated on Tue Jan 8 14:14:26 2002 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001