Methods Summary |
---|
public javax.media.Format | canConnectTo(com.sun.media.InputConnector inputConnector, javax.media.Format useThisFormat)check if a connection to the specified InputConnector would succeed.
if ( getProtocol() != inputConnector.getProtocol() )
throw new RuntimeException("protocols do not match:: ");
return null;
|
public javax.media.Format | connectTo(com.sun.media.InputConnector inputConnector, javax.media.Format useThisFormat)Connects an InputConnector to this OutputConnector.
Format format=canConnectTo(inputConnector,useThisFormat);
// if (format==null)
// return null;
this.inputConnector=inputConnector;
inputConnector.setOutputConnector(this);
int bufferSize=Math.max(getSize(),inputConnector.getSize());
circularBuffer = new CircularBuffer(bufferSize);
inputConnector.setCircularBuffer(circularBuffer);
return null;
|
public javax.media.Buffer | getEmptyBuffer()Get an empty buffer object.
// System.out.println(getClass().getName()+":: getEmptyBuffer");
switch ( protocol ) {
case ProtocolPush:
if (!isEmptyBufferAvailable () && reset)
return null;
reset = false;
return circularBuffer.getEmptyBuffer();
case ProtocolSafe:
synchronized (circularBuffer) {
reset = false;
while (!reset && !isEmptyBufferAvailable()) {
try {
circularBuffer.wait();
} catch (Exception e) {}
}
if (reset)
return null;
Buffer buffer = circularBuffer.getEmptyBuffer();
circularBuffer.notifyAll();
return buffer;
}
default:
throw new RuntimeException();
}
|
public com.sun.media.InputConnector | getInputConnector()Return the InputConnectore this OutputConnector is connected
to. If this Connector is unconnected return null.
return inputConnector;
|
public boolean | isEmptyBufferAvailable()checks if there are empty Buffer objects in the Connector's queue.
return circularBuffer.canWrite();
|
public void | reset()
synchronized (circularBuffer) {
reset = true;
super.reset();
if (inputConnector != null)
inputConnector.reset();
circularBuffer.notifyAll();
}
|
public void | writeReport()put media chunk in the queue
// System.out.println(getClass().getName()+":: writeReport ");
switch ( protocol ) {
case ProtocolPush:
synchronized (circularBuffer) {
if (reset /* && pendingWriteReport */)
return;
circularBuffer.writeReport();
}
getInputConnector().getModule().connectorPushed( getInputConnector() );
return;
case ProtocolSafe:
synchronized (circularBuffer ) {
if (reset)
return;
circularBuffer.writeReport();
circularBuffer.notifyAll();
return;
}
default:
throw new RuntimeException();
}
|