net.sf.fmj.gst.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.gst.media.content.unknown.Handler
All Implemented Interfaces:
Clock, Controller, ControllerListener, Duration, MediaHandler, Player

public class Handler
extends AbstractPlayer

Handler for GStreamer, which bypasses most of JMF (parsers, codecs). TODO: properly indicate EOM.

Author:
Ken Larson

Field Summary
 
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()
           
 
Method Summary
 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 t)
          Implement to start the Player.
 java.awt.Component getControlPanelComponent()
          Get the control panel Component for this Player.
 Time getMediaTime()
          Calculates the current media time based on the current time-base time, the time-base start time, the media start time, and the rate.
 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.
 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.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, 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.Controller
addControllerListener, close, deallocate, getControl, getControls, getState, getTargetState, prefetch, realize, removeControllerListener
 
Methods inherited from interface javax.media.Clock
getMediaNanoseconds, getRate, getStopTime, getSyncTime, getTimeBase, mapToTimeBase, setStopTime, setTimeBase, stop, syncStart
 

Constructor Detail

Handler

public Handler()
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.

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 t)
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

getMediaTime

public Time getMediaTime()
Description copied from class: AbstractController
Calculates the current media time based on the current time-base time, the time-base start time, the media start time, and the rate.

Specified by:
getMediaTime in interface Clock
Overrides:
getMediaTime in class AbstractController
Returns:
The current media time

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.

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.