com.sun.media
类 BasicModule

java.lang.Object
  继承者 com.sun.media.BasicModule
所有已实现的接口:
Module, StateTransistor, Controls
直接已知子类:
BasicFilterModule, BasicSinkModule, BasicSourceModule

public abstract class BasicModule
extends java.lang.Object
implements Module, StateTransistor

BasicModule Implements a basic JMF Module.


字段摘要
protected  BasicController controller
           
protected  com.sun.media.BasicModule.Registry inputConnectors
          registry of all input connectors created by this module.
protected  InputConnector[] inputConnectorsArray
           
protected  JMD jmd
           
protected  ModuleListener moduleListener
           
protected  java.lang.String name
          the instance name of the module, declared in the manager
protected  com.sun.media.BasicModule.Registry outputConnectors
          registry of all output connectors created by this module.
protected  OutputConnector[] outputConnectorsArray
           
protected  boolean prefetchFailed
           
protected  int protocol
           
protected  boolean resetted
           
 
构造方法摘要
BasicModule()
           
 
方法摘要
 void abortPrefetch()
          Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching.
 void abortRealize()
          Called when the realize() is aborted, i.e. deallocate() was called while realizing.
 boolean canRun()
          return if data is available on all inputConnectors and there is room in all outputConnectors.
 void connectorPushed(InputConnector inputConnector)
          A callback function denoting data was written to one of this Module input Connectors.
 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 doFailedRealize()
          Called when realize fails.
 boolean doPrefetch()
          This function performs the steps to prefetch a module or Player.
 boolean doRealize()
          This function performs the steps of realizing a module or a Player.
 void doSetMediaTime(Time t)
          This function notifies the module that the media time has changed.
 float doSetRate(float r)
          This function notifies the module that the playback rate has changed.
 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.
protected  void error()
           
 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.
 BasicController getController()
           
 java.lang.Object[] getControls()
          Return a list of module controls.
 InputConnector getInputConnector(java.lang.String connectorName)
          Return the InputConnector given the connector name.
 java.lang.String[] getInputConnectorNames()
          Return an array of strings containing this media module's input port names.
 long getLatency()
           
 long getMediaNanoseconds()
          Return the current time in nanoseconds.
 Time getMediaTime()
          Return the current Media time.
 java.lang.String getName()
          returns the name of this Module in the Player
 OutputConnector getOutputConnector(java.lang.String connectorName)
          Return the OutputConnector given the connector name.
 java.lang.String[] getOutputConnectorNames()
          Return an array of strings containing this media module's output port names.
 int getProtocol()
          return the data transfer protocol
 int getState()
          Return the state of the controller.
 boolean isInterrupted()
          Query to see if the module has just been interrupted.
 boolean isThreaded()
          return if this module create threads (so it run on Safe protocol) like Rendering module or not (as a codec module).
 boolean prefetchFailed()
           
protected abstract  void process()
          function which does the real processing.
 void registerInputConnector(java.lang.String name, InputConnector inputConnector)
          For each of the inputConnectables to this node, it needs to be registered with this function.
 void registerOutputConnector(java.lang.String name, OutputConnector outputConnector)
          For each of the outputConnectables from this node, it needs to be registered with this function.
 void reset()
          reset this module only.
 void setController(BasicController c)
          Set the Controller that maintains this module.
 void setFormat(Connector connector, Format format)
          Selects a format for this Connector (the default is null).
 void setJMD(JMD jmd)
          Set the JMD debugger instance for the module to use.
 void setModuleListener(ModuleListener listener)
          Specify a ModuleListener to which this Module will send events.
 void setName(java.lang.String name)
          sets the name of this Module.
 void setProtocol(int protocol)
          sets the protocol for all the connectors
protected  boolean verifyBuffer(Buffer buffer)
          Verify to see if the given buffer has valid data sizes.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

inputConnectors

protected com.sun.media.BasicModule.Registry inputConnectors
registry of all input connectors created by this module.


outputConnectors

protected com.sun.media.BasicModule.Registry outputConnectors
registry of all output connectors created by this module.


inputConnectorsArray

protected InputConnector[] inputConnectorsArray

outputConnectorsArray

protected OutputConnector[] outputConnectorsArray

protocol

protected int protocol

name

protected java.lang.String name
the instance name of the module, declared in the manager


moduleListener

protected ModuleListener moduleListener

controller

protected BasicController controller

resetted

protected boolean resetted

prefetchFailed

protected boolean prefetchFailed

jmd

protected JMD jmd
构造方法详细信息

BasicModule

public BasicModule()
方法详细信息

doRealize

public boolean doRealize()
This function performs the steps of realizing a module or a Player.

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

doFailedRealize

public void doFailedRealize()
Called when realize fails.

指定者:
接口 StateTransistor 中的 doFailedRealize

abortRealize

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

指定者:
接口 StateTransistor 中的 abortRealize

connectorPushed

public void connectorPushed(InputConnector inputConnector)
从接口 Module 复制的描述
A callback function denoting data was written to one of this Module input Connectors. This function is needed in case of Push protocol Typical reaction of the module is to process one frame in the calling thread and return.

指定者:
接口 Module 中的 connectorPushed
参数:
inputConnector - the inputConnector of the connection which have received data.

doPrefetch

public boolean doPrefetch()
This function performs the steps to prefetch a module or Player.

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

doFailedPrefetch

public void doFailedPrefetch()
Called when prefetch fails.

指定者:
接口 StateTransistor 中的 doFailedPrefetch

abortPrefetch

public void abortPrefetch()
Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching. Release all resources claimed previously by the prefetch call.

指定者:
接口 StateTransistor 中的 abortPrefetch

doStart

public void doStart()
This function performs the steps to start a module or Player.

指定者:
接口 StateTransistor 中的 doStart

doStop

public void doStop()
This function performs the steps to stop a module or Player, and return to the prefetched state.

指定者:
接口 StateTransistor 中的 doStop

doDealloc

public void doDealloc()
This function performs the steps to deallocate a module or Player, and return to the realized state.

指定者:
接口 StateTransistor 中的 doDealloc

doClose

public void doClose()
This function performs the steps to close a module or Player.

指定者:
接口 StateTransistor 中的 doClose

doSetMediaTime

public void doSetMediaTime(Time t)
This function notifies the module that the media time has changed.

指定者:
接口 StateTransistor 中的 doSetMediaTime

doSetRate

public float doSetRate(float r)
This function notifies the module that the playback rate has changed.

指定者:
接口 StateTransistor 中的 doSetRate

getControls

public java.lang.Object[] getControls()
Return a list of module controls.

指定者:
接口 Controls 中的 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
返回:
the object that implements the control, or null.

setModuleListener

public void setModuleListener(ModuleListener listener)
Specify a ModuleListener to which this Module will send events.

指定者:
接口 Module 中的 setModuleListener
参数:
listener - The listener to which the Module will post events.

setFormat

public void setFormat(Connector connector,
                      Format format)
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

getInputConnectorNames

public java.lang.String[] getInputConnectorNames()
Return an array of strings containing this media module's input port names.

指定者:
接口 Module 中的 getInputConnectorNames
返回:
list of input connectors as strings.

getOutputConnectorNames

public java.lang.String[] getOutputConnectorNames()
Return an array of strings containing this media module's output port names.

指定者:
接口 Module 中的 getOutputConnectorNames
返回:
list of output connectors as strings.

getInputConnector

public InputConnector getInputConnector(java.lang.String connectorName)
Return the InputConnector given the connector name.

指定者:
接口 Module 中的 getInputConnector
参数:
connectorName - the name of the connector.
返回:
InputConnector associated with this name.

getOutputConnector

public OutputConnector getOutputConnector(java.lang.String connectorName)
Return the OutputConnector given the connector name.

指定者:
接口 Module 中的 getOutputConnector
参数:
connectorName - the name of the connector
返回:
OutputConnector associated with this name.

registerInputConnector

public void registerInputConnector(java.lang.String name,
                                   InputConnector inputConnector)
For each of the inputConnectables to this node, it needs to be registered with this function.

指定者:
接口 Module 中的 registerInputConnector

registerOutputConnector

public void registerOutputConnector(java.lang.String name,
                                    OutputConnector outputConnector)
For each of the outputConnectables from this node, it needs to be registered with this function.

指定者:
接口 Module 中的 registerOutputConnector

reset

public void reset()
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

verifyBuffer

protected boolean verifyBuffer(Buffer buffer)
Verify to see if the given buffer has valid data sizes.


isInterrupted

public final boolean isInterrupted()
从接口 Module 复制的描述
Query to see if the module has just been interrupted.

指定者:
接口 Module 中的 isInterrupted
返回:
true if the module has been interrupted.

isThreaded

public boolean isThreaded()
return if this module create threads (so it run on Safe protocol) like Rendering module or not (as a codec module).


canRun

public boolean canRun()
return if data is available on all inputConnectors and there is room in all outputConnectors.


process

protected abstract void process()
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()
 }
 


error

protected void error()

getController

public final BasicController getController()
返回:
the Controller that maintains this module.

setController

public final void setController(BasicController c)
Set the Controller that maintains this module.


getState

public final int getState()
Return the state of the controller.


getName

public final java.lang.String getName()
returns the name of this Module in the Player

指定者:
接口 Module 中的 getName

setName

public void setName(java.lang.String name)
sets the name of this Module. Called by the owning Player registerModule() method

指定者:
接口 Module 中的 setName

setJMD

public void setJMD(JMD jmd)
从接口 Module 复制的描述
Set the JMD debugger instance for the module to use.

指定者:
接口 Module 中的 setJMD

getMediaTime

public Time getMediaTime()
Return the current Media time.


getMediaNanoseconds

public long getMediaNanoseconds()
Return the current time in nanoseconds.


getLatency

public long getLatency()

setProtocol

public void setProtocol(int protocol)
sets the protocol for all the connectors


getProtocol

public int getProtocol()
return the data transfer protocol


prefetchFailed

public boolean prefetchFailed()