com.sun.media
类 BasicRendererModule

java.lang.Object
  继承者 com.sun.media.BasicModule
      继承者 com.sun.media.BasicSinkModule
          继承者 com.sun.media.BasicRendererModule
所有已实现的接口:
Module, StateTransistor, Controls

public class BasicRendererModule
extends BasicSinkModule

BasicRenderer is a module which have InputConnectors and no OutputConnectors. It receives data from its input connector and put its output in output device such as file, URL, screen, audio device, output DataSource or null.
MediaRenderers can be either Pull driven (as AudioPlayer) or Push driven (as File renderer). VideoRenderer might be implemented as either Push or Pull.
MediaRenderers are stopAtTime aware (so that the audio renderer would stop at the correct time) and are responsible to stop the player at the required time (no separate thread for poling TimeBase).
There is no need to define buffers allocation and connectors behavior here, as it is done in module.

Common functionality of renderers would be put here as we start the implementation
We need the level 3 design to continue working on this class


字段摘要
protected  PlaybackEngine engine
           
protected  float frameRate
           
protected  int framesPlayed
           
protected  boolean framesWereBehind
           
protected  InputConnector ic
           
protected  boolean prefetching
           
protected  Renderer renderer
           
protected  boolean started
           
 
从类 com.sun.media.BasicSinkModule 继承的字段
prerolling, stopTime
 
从类 com.sun.media.BasicModule 继承的字段
controller, inputConnectors, inputConnectorsArray, jmd, moduleListener, name, outputConnectors, outputConnectorsArray, prefetchFailed, protocol, resetted
 
构造方法摘要
protected BasicRendererModule(Renderer r)
           
 
方法摘要
 void abortPrefetch()
          Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching.
 void doClose()
          This function performs the steps to close a module or Player.
 void doDealloc()
          This function performs the steps to deallocate a module or Player, and return to the realized state.
 void doFailedPrefetch()
          Called when prefetch fails.
 void doneReset()
           
 boolean doPrefetch()
          This function performs the steps to prefetch a module or Player.
protected  boolean doProcess()
          The loop to process the data.
 boolean doRealize()
          This function performs the steps of realizing a module or a Player.
 void doStart()
          This function performs the steps to start a module or Player.
 void doStop()
          This function performs the steps to stop a module or Player, and return to the prefetched state.
 java.lang.Object getControl(java.lang.String s)
          Obtain the object that implements the specified Class or Interface The full class or interface name must be used.
 java.lang.Object[] getControls()
          Return a list of module controls.
 int getFramesPlayed()
           
 Renderer getRenderer()
           
 long getRTPTime()
           
protected  boolean handlePreroll(Buffer buf)
          Handle the prerolling a buffer.
 boolean isThreaded()
          return if this module create threads (so it run on Safe protocol) like Rendering module or not (as a codec module).
protected  void process()
          function which does the real processing.
 int processBuffer(Buffer buffer)
          Break down one larger buffer into smaller pieces so the processing won't take that long to block.
protected  boolean reinitRenderer(Format input)
          Attempt to re-initialize the renderer given a new input format.
 void reset()
          reset this module only.
 void resetFramesPlayed()
           
protected  boolean scheduleBuffer(Buffer buf)
          Handed a buffer, this function does the scheduling of the buffer processing.
 void setFormat(Connector connector, Format format)
          Selects a format for this Connector (the default is null).
 void setPreroll(long wanted, long actual)
          Enable prerolling.
protected  void setRenderer(Renderer r)
           
 void triggerReset()
           
 
从类 com.sun.media.BasicSinkModule 继承的方法
doSetMediaTime, doSetRate, getClock, getMediaNanoseconds, getMediaTime, getTimeBase, setClock, setStopTime, setTimeBase
 
从类 com.sun.media.BasicModule 继承的方法
abortRealize, canRun, connectorPushed, doFailedRealize, error, getController, getInputConnector, getInputConnectorNames, getLatency, getName, getOutputConnector, getOutputConnectorNames, getProtocol, getState, isInterrupted, prefetchFailed, registerInputConnector, registerOutputConnector, setController, setJMD, setModuleListener, setName, setProtocol, verifyBuffer
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

engine

protected PlaybackEngine engine

renderer

protected Renderer renderer

ic

protected InputConnector ic

framesPlayed

protected int framesPlayed

frameRate

protected float frameRate

framesWereBehind

protected boolean framesWereBehind

prefetching

protected boolean prefetching

started

protected boolean started
构造方法详细信息

BasicRendererModule

protected BasicRendererModule(Renderer r)
方法详细信息

isThreaded

public boolean isThreaded()
从类 BasicModule 复制的描述
return if this module create threads (so it run on Safe protocol) like Rendering module or not (as a codec module).

覆盖:
BasicModule 中的 isThreaded

doRealize

public boolean doRealize()
从类 BasicModule 复制的描述
This function performs the steps of realizing a module or a Player.

指定者:
接口 StateTransistor 中的 doRealize
覆盖:
BasicModule 中的 doRealize
返回:
true if successful.

doPrefetch

public boolean doPrefetch()
从类 BasicModule 复制的描述
This function performs the steps to prefetch a module or Player.

指定者:
接口 StateTransistor 中的 doPrefetch
覆盖:
BasicModule 中的 doPrefetch
返回:
true if successful.

doFailedPrefetch

public void doFailedPrefetch()
从类 BasicModule 复制的描述
Called when prefetch fails.

指定者:
接口 StateTransistor 中的 doFailedPrefetch
覆盖:
BasicModule 中的 doFailedPrefetch

abortPrefetch

public void abortPrefetch()
从类 BasicModule 复制的描述
Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching. Release all resources claimed previously by the prefetch call.

指定者:
接口 StateTransistor 中的 abortPrefetch
覆盖:
BasicModule 中的 abortPrefetch

doStart

public void doStart()
从类 BasicModule 复制的描述
This function performs the steps to start a module or Player.

指定者:
接口 StateTransistor 中的 doStart
覆盖:
BasicSinkModule 中的 doStart

doStop

public void doStop()
从类 BasicModule 复制的描述
This function performs the steps to stop a module or Player, and return to the prefetched state.

指定者:
接口 StateTransistor 中的 doStop
覆盖:
BasicSinkModule 中的 doStop

doDealloc

public void doDealloc()
从类 BasicModule 复制的描述
This function performs the steps to deallocate a module or Player, and return to the realized state.

指定者:
接口 StateTransistor 中的 doDealloc
覆盖:
BasicModule 中的 doDealloc

doClose

public void doClose()
从类 BasicModule 复制的描述
This function performs the steps to close a module or Player.

指定者:
接口 StateTransistor 中的 doClose
覆盖:
BasicModule 中的 doClose

reset

public void reset()
从类 BasicModule 复制的描述
reset this module only.
 if (state== Started)
    throw Exception()
 for (all connectors)
    connector.reset()
 
The resetted flag is falsified only when the module is later restarted.

指定者:
接口 Module 中的 reset
覆盖:
BasicModule 中的 reset

triggerReset

public void triggerReset()
覆盖:
BasicSinkModule 中的 triggerReset

doneReset

public void doneReset()
覆盖:
BasicSinkModule 中的 doneReset

reinitRenderer

protected boolean reinitRenderer(Format input)
Attempt to re-initialize the renderer given a new input format.


setRenderer

protected void setRenderer(Renderer r)

getRenderer

public Renderer getRenderer()

process

protected void process()
从类 BasicModule 复制的描述
function which does the real processing.
 if canRun {
    for (all inputConnectors)
      ic.getValidBuffer()
    for (all outputConnectors)
      oc.getEmptyBuffer()
    
    for (all inputConnectors)
      ic.readReport()
    for (all outputConnectors)
      oc.writeReport()
 }
 

指定者:
BasicModule 中的 process

doProcess

protected boolean doProcess()
The loop to process the data. It handles the getting and putting back of the data buffers. It in turn calls scheduleBuffer(Buffer) to do the bulk of processing.


scheduleBuffer

protected boolean scheduleBuffer(Buffer buf)
Handed a buffer, this function does the scheduling of the buffer processing. It in turn calls processBuffer to do the real processing.


processBuffer

public int processBuffer(Buffer buffer)
Break down one larger buffer into smaller pieces so the processing won't take that long to block.


setPreroll

public void setPreroll(long wanted,
                       long actual)
Enable prerolling.

覆盖:
BasicSinkModule 中的 setPreroll

handlePreroll

protected boolean handlePreroll(Buffer buf)
Handle the prerolling a buffer. It will preroll until the media has reach the current media time before displaying.


getRTPTime

public long getRTPTime()

getControls

public java.lang.Object[] getControls()
从类 BasicModule 复制的描述
Return a list of module controls.

指定者:
接口 Controls 中的 getControls
覆盖:
BasicModule 中的 getControls
返回:
the collection of object controls

getControl

public java.lang.Object getControl(java.lang.String s)
从接口 Controls 复制的描述
Obtain the object that implements the specified Class or Interface The full class or interface name must be used.

If the control is not supported then null is returned.

指定者:
接口 Controls 中的 getControl
覆盖:
BasicModule 中的 getControl
返回:
the object that implements the control, or null.

setFormat

public void setFormat(Connector connector,
                      Format format)
从类 BasicModule 复制的描述
Selects a format for this Connector (the default is null). The setFormat() method is typically called by the Manager as part of the Connector connection method call. Typically the connector would delegate this call to its owning Module.

指定者:
接口 Module 中的 setFormat
覆盖:
BasicModule 中的 setFormat

getFramesPlayed

public int getFramesPlayed()

resetFramesPlayed

public void resetFramesPlayed()