com.sun.media
类 PlaybackEngine

java.lang.Object
  继承者 com.sun.media.BasicController
      继承者 com.sun.media.PlaybackEngine
所有已实现的接口:
ModuleListener, Clock, Controller, Duration
直接已知子类:
ProcessEngine

public class PlaybackEngine
extends BasicController
implements ModuleListener

PlaybackEngine implements the media engine for playback.


字段摘要
protected  javax.media.control.BitRateControl bitRateControl
           
protected  java.awt.Container container
           
protected  javax.media.protocol.DataSource dsource
           
protected  java.util.Vector filters
           
protected  javax.media.control.FramePositioningControl framePositioningControl
           
protected  javax.media.control.FrameRateControl frameRateControl
           
protected  java.lang.String genericProcessorError
           
protected  JMD jmd
           
protected  BasicSinkModule masterSink
           
protected  java.util.Vector modules
           
protected static boolean needSavingDB
           
protected  Demultiplexer parser
           
protected  BasicPlayer player
           
protected  boolean prefetched
           
 boolean prefetchEnabled
           
protected  com.sun.media.controls.ProgressControl progressControl
           
protected  java.lang.String realizeError
           
protected  java.util.Vector sinks
           
protected  com.sun.media.PlaybackEngine.SlaveClock slaveClock
           
protected  BasicSourceModule source
           
protected  boolean started
           
protected  java.lang.String timeBaseError
           
static boolean TRACE_ON
           
protected  BasicTrackControl[] trackControls
           
protected  Track[] tracks
           
protected  java.util.Vector waitEnded
           
protected  java.util.Vector waitPrefetched
           
protected  java.util.Vector waitResetted
           
protected  java.util.Vector waitStopped
           
 
从类 com.sun.media.BasicController 继承的字段
processError, state, stopThreadEnabled
 
从接口 javax.media.Controller 继承的字段
LATENCY_UNKNOWN, Prefetched, Prefetching, Realized, Realizing, Started, Unrealized
 
从接口 javax.media.Clock 继承的字段
RESET
 
从接口 javax.media.Duration 继承的字段
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
构造方法摘要
PlaybackEngine(BasicPlayer p)
           
 
方法摘要
protected  void abortConfigure()
          Called when doConfigure() is aborted.
protected  void abortPrefetch()
          Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching.
protected  void abortRealize()
          Called when the realize() is aborted, i.e. deallocate() was called while realizing.
 boolean audioEnabled()
          Return true if audio is present.
 void bufferPrefetched(Module src)
          This method is called when the module has prefetched all the data.
protected  com.sun.media.GraphNode buildTrackFromGraph(BasicTrackControl tc, com.sun.media.GraphNode node)
          Construct a track (connected modules) from the specified node graph.
protected  void connectModules(OutputConnector oc, InputConnector ic, BasicModule dst)
          Connect the two given modules.
protected  BasicModule createModule(com.sun.media.GraphNode n, java.util.Vector used)
          Create a realized filter module given the plugIn codec.
 void createProgressControl()
          Create the progress status control.
protected  java.awt.Component createVisualContainer(java.util.Vector visuals)
           
 void dataBlocked(Module src, boolean blocked)
          This method is called when the module detected a data blockage.
protected  void doClose()
          Invoked by close() to cleanup the Controller.
protected  boolean doConfigure()
          Configuring the engine.
protected  boolean doConfigure1()
          Configure - Part I.
protected  boolean doConfigure2()
          Configure - Part II.
protected  void doDeallocate()
          Called by deallocate().
protected  void doFailedPrefetch()
          Called when the prefetch() has failed.
protected  void doFailedRealize()
          Called when realize() has failed.
protected  boolean doPrefetch()
          The stub function to perform the steps to prefetch the controller.
protected  boolean doPrefetch1()
          doPrefetch - Part I
protected  boolean doPrefetch2()
          doPrefetch - Part II
protected  boolean doRealize()
          The stub function to perform the steps to realize the controller.
protected  boolean doRealize1()
          doRealize Part I
protected  boolean doRealize2()
          doRealize Part II
protected  void doReset()
          The real reset code.
protected  void doSetMediaTime(Time when)
           
 float doSetRate(float r)
           
protected  void doStart()
          Start immediately.
protected  void doStart1()
          doStart - Part I.
protected  void doStart2()
          doStart - Part II
protected  void doStop()
          Invoked from stop().
protected  void doStop1()
          doStop - Part I.
protected  void doStop2()
          doStop - Part II.
protected  BasicSinkModule findMasterSink()
          Returns the DataSink which holds the timebase.
 void formatChanged(Module src, Format oldFormat, Format newFormat)
          This method is called when a format change has occurred and the module has successfully coped with it.
 void formatChangedFailure(Module src, Format oldFormat, Format newFormat)
          This method is called when a format change has occurred and the Module has failed to deal with it.
 void framesBehind(Module src, float frames, InputConnector ic)
          This method is called when a module detects frame delay.
protected  long getBitRate()
           
 java.lang.String getCNAME()
           
 Control[] getControls()
          Return a list of Control objects this Controller supports.
 Time getDuration()
          Return the duration of the media.
 GainControl getGainControl()
          Get audio gain control.
 long getLatency()
          Return the run-time latency.
protected  PlugIn getPlugIn(BasicModule m)
          Get the plugin from a module.
 Time getStartLatency()
          Returns the start latency.
 TimeBase getTimeBase()
          Override the parent's method to not check for realized state.
 java.awt.Component getVisualComponent()
          Get the visual component where the video is presented.
 void internalErrorOccurred(Module src)
          This method is called when an irrecoverable internal error has occurred either on the plugin or on the controlling module.
protected  boolean isConfigurable()
          The PlaybackEngine is configurable.
 boolean isRTP()
           
protected  BasicModule lastModule(BasicModule bm)
          Given a chain of FilterModules, return the last one of the chain.
protected  void localStop()
           
 void markedDataArrived(Module src, Buffer buffer)
          This method is called when a buffer with the marker bit set arrives.
 void mediaEnded(Module src)
          This method is called when the module has reached the end of media.
 void pluginTerminated(Module src)
          This method is called when the plugin controlled by the module has been closed.
protected  void reset()
          Flush (reset) the flow graph.
protected  void resetBitRate()
           
 void resetted(Module src)
          This method is called when the module has been resetted.
 void setMediaTime(Time when)
          Override BasicController's setMediaTime so as not to set the media time on the master clock twice.
static void setMemoryTrace(boolean on)
          Turn on memory trace to assit debugging.
 void setProgressControl(com.sun.media.controls.ProgressControl p)
           
protected  void setRenderBufferSize(Renderer r)
           
 void setSource(javax.media.protocol.DataSource ds)
          Verifies to see if the engine accepts the given source.
 void setStopTime(Time t)
          Override BasicController.setStopTime to allow for more accurate stop time set.
 void setTimeBase(TimeBase tb)
          Override the parent's method to not check for realized state.
 void stop()
          This is stop by request.
 void stopAtTime(Module src)
          This method is called when the module has reached the scheduled stop time.
 void updateFormats()
          Update the format info per track on the progress control.
 void updateRates()
          Update the aggregate bit rate and frame rate per track on the progress control.
 boolean videoEnabled()
          Return true if video is present.
 
从类 com.sun.media.BasicController 继承的方法
addControllerListener, close, completeConfigure, completePrefetch, completeRealize, configure, deallocate, dispatchEvent, doFailedConfigure, getClock, getControl, getMediaNanoseconds, getMediaTime, getRate, getState, getStopTime, getSyncTime, getTargetState, interrupt, isInterrupted, mapToTimeBase, prefetch, realize, removeControllerListener, resetInterrupt, sendEvent, setClock, setMediaLength, setRate, setTargetState, stopAtTime, stopControllerOnly, syncStart, syncStartInProgress, throwError
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

player

protected BasicPlayer player

dsource

protected javax.media.protocol.DataSource dsource

modules

protected java.util.Vector modules

filters

protected java.util.Vector filters

sinks

protected java.util.Vector sinks

waitPrefetched

protected java.util.Vector waitPrefetched

waitStopped

protected java.util.Vector waitStopped

waitEnded

protected java.util.Vector waitEnded

waitResetted

protected java.util.Vector waitResetted

tracks

protected Track[] tracks

parser

protected Demultiplexer parser

masterSink

protected BasicSinkModule masterSink

source

protected BasicSourceModule source

slaveClock

protected com.sun.media.PlaybackEngine.SlaveClock slaveClock

prefetched

protected boolean prefetched

started

protected boolean started

prefetchEnabled

public boolean prefetchEnabled

needSavingDB

protected static boolean needSavingDB

bitRateControl

protected javax.media.control.BitRateControl bitRateControl

frameRateControl

protected javax.media.control.FrameRateControl frameRateControl

framePositioningControl

protected javax.media.control.FramePositioningControl framePositioningControl

jmd

protected JMD jmd

container

protected java.awt.Container container

TRACE_ON

public static boolean TRACE_ON

trackControls

protected BasicTrackControl[] trackControls

progressControl

protected com.sun.media.controls.ProgressControl progressControl

realizeError

protected java.lang.String realizeError

timeBaseError

protected java.lang.String timeBaseError

genericProcessorError

protected java.lang.String genericProcessorError
构造方法详细信息

PlaybackEngine

public PlaybackEngine(BasicPlayer p)
方法详细信息

setMemoryTrace

public static void setMemoryTrace(boolean on)
Turn on memory trace to assit debugging.


isConfigurable

protected boolean isConfigurable()
The PlaybackEngine is configurable.

指定者:
BasicController 中的 isConfigurable

setSource

public void setSource(javax.media.protocol.DataSource ds)
               throws java.io.IOException,
                      IncompatibleSourceException
Verifies to see if the engine accepts the given source.

抛出:
java.io.IOException
IncompatibleSourceException

doConfigure

protected boolean doConfigure()
Configuring the engine.

覆盖:
BasicController 中的 doConfigure

doConfigure1

protected boolean doConfigure1()
Configure - Part I.


doConfigure2

protected boolean doConfigure2()
Configure - Part II.


doRealize

protected boolean doRealize()
从类 BasicController 复制的描述
The stub function to perform the steps to realize the controller. Call realize() for the public method. This is called from a separately running thread. So do take necessary precautions to protect shared resources. It's OK to put an empty stub function body here.

Return true if the realize is successful. Return false and set the processError string if failed.

This function is not declared synchronized because first it is already guaranteed by realize() not to be called more than once simultaneously. Secondly if this is synchronized, then other synchronized methods, deallocate() and processEvent() will be blocked since they are synchronized methods. Override this to implement subclass behavior.

指定者:
BasicController 中的 doRealize
返回:
true if successful.

doRealize1

protected boolean doRealize1()
doRealize Part I


doRealize2

protected boolean doRealize2()
doRealize Part II


findMasterSink

protected BasicSinkModule findMasterSink()
Returns the DataSink which holds the timebase.


abortConfigure

protected void abortConfigure()
Called when doConfigure() is aborted.

覆盖:
BasicController 中的 abortConfigure

abortRealize

protected void abortRealize()
Called when the realize() is aborted, i.e. deallocate() was called while realizing. Release all resources claimed previously by the realize() call.

指定者:
BasicController 中的 abortRealize

doFailedRealize

protected void doFailedRealize()
Called when realize() has failed.

覆盖:
BasicController 中的 doFailedRealize

doPrefetch

protected boolean doPrefetch()
The stub function to perform the steps to prefetch the controller.

指定者:
BasicController 中的 doPrefetch
返回:
true if successful.

doPrefetch1

protected boolean doPrefetch1()
doPrefetch - Part I


doPrefetch2

protected boolean doPrefetch2()
doPrefetch - Part II


abortPrefetch

protected void abortPrefetch()
Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching. Release all resources claimed previously by the prefetch call. Override this to implement subclass behavior.

指定者:
BasicController 中的 abortPrefetch

doFailedPrefetch

protected void doFailedPrefetch()
Called when the prefetch() has failed.

覆盖:
BasicController 中的 doFailedPrefetch

doStart

protected void doStart()
Start immediately. Invoked from start(tbt) when the scheduled start time is reached. Use the public start(tbt) method for the public interface. Override this to implement subclass behavior.

指定者:
BasicController 中的 doStart

doStart1

protected void doStart1()
doStart - Part I.


doStart2

protected void doStart2()
doStart - Part II


stop

public void stop()
This is stop by request.

指定者:
接口 Clock 中的 stop
覆盖:
BasicController 中的 stop

localStop

protected void localStop()

doStop

protected void doStop()
Invoked from stop(). Override this to implement subclass behavior.

覆盖:
BasicController 中的 doStop

doStop1

protected void doStop1()
doStop - Part I.


doStop2

protected void doStop2()
doStop - Part II.


setStopTime

public void setStopTime(Time t)
Override BasicController.setStopTime to allow for more accurate stop time set.

指定者:
接口 Clock 中的 setStopTime
覆盖:
BasicController 中的 setStopTime
参数:
t - The time at which you want the Clock to stop, in media time.

doDeallocate

protected void doDeallocate()
Called by deallocate(). Subclasses should implement this for its specific behavior.

覆盖:
BasicController 中的 doDeallocate

doClose

protected void doClose()
Invoked by close() to cleanup the Controller. Override this to implement subclass behavior.

覆盖:
BasicController 中的 doClose

isRTP

public boolean isRTP()

getCNAME

public java.lang.String getCNAME()

setMediaTime

public void setMediaTime(Time when)
Override BasicController's setMediaTime so as not to set the media time on the master clock twice.

指定者:
接口 Clock 中的 setMediaTime
覆盖:
BasicController 中的 setMediaTime
参数:
when - The new media time.

doSetMediaTime

protected void doSetMediaTime(Time when)
覆盖:
BasicController 中的 doSetMediaTime

doSetRate

public float doSetRate(float r)
覆盖:
BasicController 中的 doSetRate

reset

protected void reset()
Flush (reset) the flow graph. This is a blocking call and should only be called when the engine is stopped.


doReset

protected void doReset()
The real reset code. This is a blocking call and should only be called when the engine is stopped.


bufferPrefetched

public void bufferPrefetched(Module src)
从接口 ModuleListener 复制的描述
This method is called when the module has prefetched all the data.

指定者:
接口 ModuleListener 中的 bufferPrefetched

stopAtTime

public void stopAtTime(Module src)
从接口 ModuleListener 复制的描述
This method is called when the module has reached the scheduled stop time.

指定者:
接口 ModuleListener 中的 stopAtTime

mediaEnded

public void mediaEnded(Module src)
从接口 ModuleListener 复制的描述
This method is called when the module has reached the end of media.

指定者:
接口 ModuleListener 中的 mediaEnded

resetted

public void resetted(Module src)
从接口 ModuleListener 复制的描述
This method is called when the module has been resetted.

指定者:
接口 ModuleListener 中的 resetted

dataBlocked

public void dataBlocked(Module src,
                        boolean blocked)
从接口 ModuleListener 复制的描述
This method is called when the module detected a data blockage.

指定者:
接口 ModuleListener 中的 dataBlocked
blocked - is set to true if the data is blocked, false if the data has been blocked but have now be released.

framesBehind

public void framesBehind(Module src,
                         float frames,
                         InputConnector ic)
从接口 ModuleListener 复制的描述
This method is called when a module detects frame delay. The number returned is the # of frames behind detected.

指定者:
接口 ModuleListener 中的 framesBehind

markedDataArrived

public void markedDataArrived(Module src,
                              Buffer buffer)
从接口 ModuleListener 复制的描述
This method is called when a buffer with the marker bit set arrives.

指定者:
接口 ModuleListener 中的 markedDataArrived

formatChanged

public void formatChanged(Module src,
                          Format oldFormat,
                          Format newFormat)
从接口 ModuleListener 复制的描述
This method is called when a format change has occurred and the module has successfully coped with it.

指定者:
接口 ModuleListener 中的 formatChanged

formatChangedFailure

public void formatChangedFailure(Module src,
                                 Format oldFormat,
                                 Format newFormat)
从接口 ModuleListener 复制的描述
This method is called when a format change has occurred and the Module has failed to deal with it.

指定者:
接口 ModuleListener 中的 formatChangedFailure

pluginTerminated

public void pluginTerminated(Module src)
从接口 ModuleListener 复制的描述
This method is called when the plugin controlled by the module has been closed.

指定者:
接口 ModuleListener 中的 pluginTerminated

internalErrorOccurred

public void internalErrorOccurred(Module src)
从接口 ModuleListener 复制的描述
This method is called when an irrecoverable internal error has occurred either on the plugin or on the controlling module.

指定者:
接口 ModuleListener 中的 internalErrorOccurred

audioEnabled

public boolean audioEnabled()
Return true if audio is present.


videoEnabled

public boolean videoEnabled()
Return true if video is present.


getControls

public Control[] getControls()
Return a list of Control objects this Controller supports. In this case, it is all the controls from all the modules controlled by this engine.

指定者:
接口 Controller 中的 getControls
覆盖:
BasicController 中的 getControls
返回:
list of Controller controls.

getGainControl

public GainControl getGainControl()
Get audio gain control.


getVisualComponent

public java.awt.Component getVisualComponent()
Get the visual component where the video is presented.


createVisualContainer

protected java.awt.Component createVisualContainer(java.util.Vector visuals)

getStartLatency

public Time getStartLatency()
Returns the start latency. Don't know until the particular node is implemented.

指定者:
接口 Controller 中的 getStartLatency
覆盖:
BasicController 中的 getStartLatency
返回:
the start latency.

getLatency

public long getLatency()
Return the run-time latency. It's the time it takes for a packet to travel from the first module to the last module. The time is computed in nanoseconds.


getDuration

public Time getDuration()
Return the duration of the media. It's unknown until we implement a particular node.

指定者:
接口 Duration 中的 getDuration
覆盖:
BasicController 中的 getDuration
返回:
the duration of the media.

setProgressControl

public void setProgressControl(com.sun.media.controls.ProgressControl p)

createProgressControl

public void createProgressControl()
Create the progress status control.


updateFormats

public void updateFormats()
Update the format info per track on the progress control.


updateRates

public void updateRates()
Update the aggregate bit rate and frame rate per track on the progress control.


getBitRate

protected long getBitRate()

resetBitRate

protected void resetBitRate()

setTimeBase

public void setTimeBase(TimeBase tb)
                 throws IncompatibleTimeBaseException
Override the parent's method to not check for realized state. There's no need to.

指定者:
接口 Clock 中的 setTimeBase
覆盖:
BasicController 中的 setTimeBase
参数:
tb - The new TimeBase or null to reset the Clock to its default TimeBase.
抛出:
IncompatibleTimeBaseException - Thrown if the Clock can't use the specified TimeBase.

getTimeBase

public TimeBase getTimeBase()
Override the parent's method to not check for realized state. There's no need to.

指定者:
接口 Clock 中的 getTimeBase
覆盖:
BasicController 中的 getTimeBase

buildTrackFromGraph

protected com.sun.media.GraphNode buildTrackFromGraph(BasicTrackControl tc,
                                                      com.sun.media.GraphNode node)
Construct a track (connected modules) from the specified node graph. Return a non-null GraphNode if the track cannot be built. The non-null node returned is the node that failed to be opened.


setRenderBufferSize

protected void setRenderBufferSize(Renderer r)

lastModule

protected BasicModule lastModule(BasicModule bm)
Given a chain of FilterModules, return the last one of the chain.


createModule

protected BasicModule createModule(com.sun.media.GraphNode n,
                                   java.util.Vector used)
Create a realized filter module given the plugIn codec.


connectModules

protected void connectModules(OutputConnector oc,
                              InputConnector ic,
                              BasicModule dst)
Connect the two given modules.


getPlugIn

protected PlugIn getPlugIn(BasicModule m)
Get the plugin from a module. For debugging.