net.sf.fmj.media.content.unknown
Class Handler

java.lang.Object
  extended by net.sf.fmj.ejmf.toolkit.media.AbstractClock
      extended by net.sf.fmj.ejmf.toolkit.media.AbstractController
          extended by net.sf.fmj.ejmf.toolkit.media.AbstractPlayer
              extended by net.sf.fmj.media.AbstractProcessor
                  extended by net.sf.fmj.media.content.unknown.Handler
All Implemented Interfaces:
Clock, Controller, ControllerListener, Duration, MediaHandler, Player, Processor
Direct Known Subclasses:
Handler

public class Handler
extends AbstractProcessor

The main handler for media. Builds a playback filter graph and starts threads to process it. Note that while this is actually a Player, it is also a Processor. The unknown processor simply extends this class and puts it in a different mode (PROCESSOR).

Author:
Ken Larson

Field Summary
protected static int PLAYER
           
protected static int PROCESSOR
           
 
Fields inherited from class net.sf.fmj.media.AbstractProcessor
outputContentDescriptor
 
Fields inherited from interface javax.media.Processor
Configured, Configuring
 
Fields inherited from interface javax.media.Controller
LATENCY_UNKNOWN, Prefetched, Prefetching, Realized, Realizing, Started, Unrealized
 
Fields inherited from interface javax.media.Clock
RESET
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
Handler()
           
Handler(int mode)
           
 
Method Summary
 boolean doConfigure()
           
 void doPlayerClose()
          Close the Player.
 boolean doPlayerDeallocate()
          Implement to deallocate the Player.
 boolean doPlayerPrefetch()
          Implement to prefetch the Player.
 boolean doPlayerRealize()
          Implement to realize the Player.
 void doPlayerSetMediaTime(Time t)
          Override to provide implementation-specific functionality.
 float doPlayerSetRate(float rate)
          Override to provide implementation-specific functionality.
 boolean doPlayerStop()
          Implement to stop the Player.
 boolean doPlayerSyncStart(Time time)
          Implement to start the Player.
 java.awt.Component getControlPanelComponent()
          Get the control panel Component for this Player.
 DataSource getDataOutput()
           
 Time getPlayerDuration()
          Returns the duration of the media played by this Player only.
 Time getPlayerStartLatency()
          Returns the start latency of the media played by this Player only.
 ContentDescriptor[] getSupportedContentDescriptors()
           
 TrackControl[] getTrackControls()
           
 java.awt.Component getVisualComponent()
          Get the visual Component for this Player.
 void setSource(DataSource source)
          Called by javax.media.Manager.
 
Methods inherited from class net.sf.fmj.media.AbstractProcessor
configure, getContentDescriptor, postConfigureCompleteEvent, setContentDescriptor, synchronousConfigure
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.media.AbstractPlayer
addController, controllerUpdate, doClose, doDeallocate, doPrefetch, doRealize, doSetMediaTime, doSetRate, doStop, doSyncStart, endOfMedia, getControllers, getDuration, getGainControl, getSource, getStartLatency, removeController, setControlPanelComponent, setGainControl, setMediaTime, setRate, setVisualComponent, start, synchronousStart
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.media.AbstractController
addControl, addControllerListener, blockUntilStart, close, deallocate, getControl, getControls, getMediaTime, getPreviousState, getState, getTargetState, getThreadQueue, getTimeBase, postControllerClosedEvent, postControllerErrorEvent, postDataStarvedEvent, postDeallocateEvent, postEndOfMediaEvent, postEvent, postPrefetchCompleteEvent, postRealizeCompleteEvent, postRestartingEvent, postStartEvent, postStopAtTimeEvent, postStopByRequestEvent, postStopEvent, postTransitionEvent, prefetch, realize, removeControl, removeControllerListener, setState, setStopTime, setTargetState, setTimeBase, stop, stopAtTime, stopController, stopInRestart, synchronousPrefetch, synchronousRealize, synchronousSyncStart, syncStart
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.media.AbstractClock
getMediaNanoseconds, getMediaStartTime, getRate, getStopTime, getSyncTime, getTimeBaseStartTime, mapToTimeBase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.Player
addController, getGainControl, removeController, start
 
Methods inherited from interface javax.media.Controller
addControllerListener, close, deallocate, getControl, getControls, getStartLatency, getState, getTargetState, prefetch, realize, removeControllerListener
 
Methods inherited from interface javax.media.Clock
getMediaNanoseconds, getMediaTime, getRate, getStopTime, getSyncTime, getTimeBase, mapToTimeBase, setMediaTime, setRate, setStopTime, setTimeBase, stop, syncStart
 
Methods inherited from interface javax.media.Duration
getDuration
 

Field Detail

PLAYER

protected static final int PLAYER
See Also:
Constant Field Values

PROCESSOR

protected static final int PROCESSOR
See Also:
Constant Field Values
Constructor Detail

Handler

public Handler()

Handler

public Handler(int mode)
Method Detail

setSource

public void setSource(DataSource source)
               throws IncompatibleSourceException
Description copied from class: AbstractPlayer
Called by javax.media.Manager. This is the litmus test that tells whether this Player can support the given DataSource. If it can't, this method should throw a IncompatibleSourceException. Our only requirement here is that the DataSource has not already been set. Subclasses may wish to override this method to extend the acceptance criteria.

Specified by:
setSource in interface MediaHandler
Overrides:
setSource in class AbstractPlayer
Parameters:
source - The DataSource to test
Throws:
IncompatibleSourceException - Thrown if the DataSource has already been set on this MediaHandler, or if the DataSource is not a PullDataSource

doPlayerClose

public void doPlayerClose()
Description copied from class: AbstractPlayer
Close the Player. Typically this method will release as many resources as possible, especially those that may be needed by other Players.

This method should not be called directly. Instead, call close().

Specified by:
doPlayerClose in class AbstractPlayer

doPlayerDeallocate

public boolean doPlayerDeallocate()
Description copied from class: AbstractPlayer
Implement to deallocate the Player.

This method should not be called directly. Instead, call deallocate().

Specified by:
doPlayerDeallocate in class AbstractPlayer
Returns:
True if successful, false otherwise.

doPlayerPrefetch

public boolean doPlayerPrefetch()
Description copied from class: AbstractPlayer
Implement to prefetch the Player.

This method should not be called directly. Instead, call prefetch().

Specified by:
doPlayerPrefetch in class AbstractPlayer
Returns:
True if successful, false otherwise.

doPlayerRealize

public boolean doPlayerRealize()
Description copied from class: AbstractPlayer
Implement to realize the Player.

This method should not be called directly. Instead, call realize().

Specified by:
doPlayerRealize in class AbstractPlayer
Returns:
True if successful, false otherwise.

getControlPanelComponent

public java.awt.Component getControlPanelComponent()
Description copied from class: AbstractPlayer
Get the control panel Component for this Player.

Specified by:
getControlPanelComponent in interface Player
Overrides:
getControlPanelComponent in class AbstractPlayer
Returns:
The control panel Component, or null if it has not been set.

doPlayerSetMediaTime

public void doPlayerSetMediaTime(Time t)
Description copied from class: AbstractPlayer
Override to provide implementation-specific functionality. When this method is called, it is guaranteed that the Controller is Stopped and that the given time is within the Controller's duration.

This method should not be called directly. Instead, call setMediaTime().

Specified by:
doPlayerSetMediaTime in class AbstractPlayer
Parameters:
t - The media time to set

doPlayerSetRate

public float doPlayerSetRate(float rate)
Description copied from class: AbstractPlayer
Override to provide implementation-specific functionality. When this method is called, it is guaranteed that the Controller is Stopped.

This method should not be called directly. Instead, call setRate().

Specified by:
doPlayerSetRate in class AbstractPlayer
Parameters:
rate - The requested rate to set
Returns:
The actual rate that was set

doPlayerStop

public boolean doPlayerStop()
Description copied from class: AbstractPlayer
Implement to stop the Player.

This method should not be called directly. Instead, call stop().

Specified by:
doPlayerStop in class AbstractPlayer
Returns:
True if successful, false otherwise.

doPlayerSyncStart

public boolean doPlayerSyncStart(Time time)
Description copied from class: AbstractPlayer
Implement to start the Player.

This method should not be called directly. Instead, call start().

Specified by:
doPlayerSyncStart in class AbstractPlayer
Returns:
True if successful, false otherwise.

getPlayerDuration

public Time getPlayerDuration()
Description copied from class: AbstractPlayer
Returns the duration of the media played by this Player only. It does not consider any of the Controllers that this Player may be managing.

Specified by:
getPlayerDuration in class AbstractPlayer

getPlayerStartLatency

public Time getPlayerStartLatency()
Description copied from class: AbstractPlayer
Returns the start latency of the media played by this Player only. It does not consider any of the Controllers that this Player may be managing.

Specified by:
getPlayerStartLatency in class AbstractPlayer

getVisualComponent

public java.awt.Component getVisualComponent()
Description copied from class: AbstractPlayer
Get the visual Component for this Player.

Specified by:
getVisualComponent in interface Player
Overrides:
getVisualComponent in class AbstractPlayer
Returns:
The visual Component, or null if it has not been set.

doConfigure

public boolean doConfigure()
Specified by:
doConfigure in class AbstractProcessor

getDataOutput

public DataSource getDataOutput()
                         throws NotRealizedError
Throws:
NotRealizedError

getTrackControls

public TrackControl[] getTrackControls()
                                throws NotConfiguredError
Specified by:
getTrackControls in interface Processor
Overrides:
getTrackControls in class AbstractProcessor
Throws:
NotConfiguredError

getSupportedContentDescriptors

public ContentDescriptor[] getSupportedContentDescriptors()
                                                   throws NotConfiguredError
Specified by:
getSupportedContentDescriptors in interface Processor
Overrides:
getSupportedContentDescriptors in class AbstractProcessor
Throws:
NotConfiguredError