Methods Summary |
---|
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.
|
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.
|
public boolean | canRun()return if data is available on all inputConnectors and there
is room in all outputConnectors.
for (int i=0;i<inputConnectorsArray.length;i++)
if (!inputConnectorsArray[i].isValidBufferAvailable() )
return false;
for (int i=0;i<outputConnectorsArray.length;i++)
if (!outputConnectorsArray[i].isEmptyBufferAvailable() )
return false;
return true;
|
public void | connectorPushed(com.sun.media.InputConnector inputConnector)
process();
|
public void | doClose()This function performs the steps to close a module or Player.
|
public void | doDealloc()This function performs the steps to deallocate a module or Player,
and return to the realized state.
|
public void | doFailedPrefetch()Called when prefetch fails.
|
public void | doFailedRealize()Called when realize fails.
|
public boolean | doPrefetch()This function performs the steps to prefetch a module or Player.
// commit connectors to array
resetted = false;
return true;
|
public boolean | doRealize()This function performs the steps of realizing a module or a Player.
return true;
|
public void | doSetMediaTime(javax.media.Time t)This function notifies the module that the media time has changed.
|
public float | doSetRate(float r)This function notifies the module that the playback rate has changed.
return r;
|
public void | doStart()This function performs the steps to start a module or Player.
resetted = false;
|
public void | doStop()This function performs the steps to stop a module or Player,
and return to the prefetched state.
|
protected void | error()
throw new RuntimeException(getClass().getName()+" error");
|
public java.lang.Object | getControl(java.lang.String s)
return null;
|
public final com.sun.media.BasicController | getController()
return controller;
|
public java.lang.Object[] | getControls()Return a list of module controls.
return null;
|
public com.sun.media.InputConnector | getInputConnector(java.lang.String connectorName)Return the InputConnector given the connector name.
return (InputConnector)inputConnectors.get(connectorName);
|
public java.lang.String[] | getInputConnectorNames()Return an array of strings containing this media module's input
port names.
return inputConnectors.getNames();
|
public long | getLatency()
return ((PlaybackEngine)controller).getLatency();
|
public long | getMediaNanoseconds()Return the current time in nanoseconds.
return controller.getMediaNanoseconds();
|
public javax.media.Time | getMediaTime()Return the current Media time.
return controller.getMediaTime();
|
public final java.lang.String | getName()returns the name of this Module in the Player
return name;
|
public com.sun.media.OutputConnector | getOutputConnector(java.lang.String connectorName)Return the OutputConnector given the connector name.
return (OutputConnector)outputConnectors.get(connectorName);
|
public java.lang.String[] | getOutputConnectorNames()Return an array of strings containing this media module's output
port names.
return outputConnectors.getNames();
|
public int | getProtocol()return the data transfer protocol
return protocol;
|
public final int | getState()Return the state of the controller.
return controller.getState();
|
public final boolean | isInterrupted()
return (controller == null ? false : controller.isInterrupted());
|
public boolean | isThreaded()return if this module create threads (so it run on Safe protocol)
like Rendering module or not (as a codec module).
return true;
|
public boolean | prefetchFailed()
return prefetchFailed;
|
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()
}
|
public void | registerInputConnector(java.lang.String name, com.sun.media.InputConnector inputConnector)For each of the inputConnectables to this node, it needs to be
registered with this function.
inputConnectors.put(name , inputConnector);
inputConnector.setModule(this);
|
public void | registerOutputConnector(java.lang.String name, com.sun.media.OutputConnector outputConnector)For each of the outputConnectables from this node, it needs to be
registered with this function.
outputConnectors.put(name , outputConnector);
outputConnector.setModule(this);
|
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.
resetted = true;
|
public final void | setController(com.sun.media.BasicController c)Set the Controller that maintains this module.
controller = c;
|
public void | setFormat(com.sun.media.Connector connector, javax.media.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.
|
public void | setJMD(com.sun.media.JMD jmd)
this.jmd = jmd;
|
public void | setModuleListener(com.sun.media.ModuleListener listener)Specify a ModuleListener to which this Module
will send events.
moduleListener = listener;
|
public void | setName(java.lang.String name)sets the name of this Module. Called by the owning Player
registerModule() method
this.name=name;
|
public void | setProtocol(int protocol)sets the protocol for all the connectors
this.protocol=protocol;
Connector[] connectors= inputConnectors.getConnectors();
for (int i=0; i<connectors.length; i++)
connectors[i].setProtocol(protocol);
connectors= outputConnectors.getConnectors();
for (int i=0; i<connectors.length ; i++)
connectors[i].setProtocol(protocol);
|
protected boolean | verifyBuffer(javax.media.Buffer buffer)Verify to see if the given buffer has valid data sizes.
if (buffer.isDiscard())
return true;
Object data = buffer.getData();
if (buffer.getLength() < 0) {
System.err.println("warning: data length shouldn't be negative: " + buffer.getLength());
}
if (data == null) {
System.err.println("warning: data buffer is null");
if (buffer.getLength() != 0) {
System.err.println("buffer advertized length = " + buffer.getLength() + " but data buffer is null!");
return false;
}
} else if (data instanceof byte[]) {
if (buffer.getLength() > ((byte[])data).length) {
System.err.println("buffer advertized length = " + buffer.getLength() + " but actual length = " + ((byte[])data).length);
return false;
}
} else if (data instanceof int[]) {
if (buffer.getLength() > ((int[])data).length) {
System.err.println("buffer advertized length = " + buffer.getLength() + " but actual length = " + ((int[])data).length);
return false;
}
}
return true;
|