Methods Summary |
---|
java.lang.Thread | chpThread()
Thread thread = null;
if ( /*securityPrivelege && */ (jmfSecurity != null) ) {
String permission = null;
try {
if (jmfSecurity.getName().startsWith("jmf-security")) {
permission = "thread";
jmfSecurity.requestPermission(m, cl, args, JMFSecurity.THREAD);
m[0].invoke(cl[0], args[0]);
permission = "thread group";
jmfSecurity.requestPermission(m, cl, args, JMFSecurity.THREAD_GROUP);
m[0].invoke(cl[0], args[0]);
} else if (jmfSecurity.getName().startsWith("internet")) {
PolicyEngine.checkPermission(PermissionID.THREAD);
PolicyEngine.assertPermission(PermissionID.THREAD);
}
} catch (Throwable e) {
if (JMFSecurityManager.DEBUG) {
System.err.println("Unable to get " + permission +
" privilege " + e);
}
securityPrivelege = false;
// TODO: Do the right thing if permissions cannot be obtained.
// User should be notified via an event
}
}
if ( (jmfSecurity != null) && (jmfSecurity.getName().startsWith("jdk12"))) {
try {
Constructor cons = jdk12CreateThreadRunnableAction.cons;
thread = (Thread) jdk12.doPrivM.invoke(
jdk12.ac,
new Object[] {
cons.newInstance(
new Object[] {
Thread.class,
this
})});
thread.setName("DirectSound Request Thread");
cons = jdk12PriorityAction.cons;
jdk12.doPrivM.invoke(
jdk12.ac,
new Object[] {
cons.newInstance(
new Object[] {
thread,
new Integer(Thread.MAX_PRIORITY)
})});
} catch (Exception e) {
e.printStackTrace();
}
} else {
thread = new Thread(this);
thread.setName("DirectSound Request Thread");
thread.setPriority(Thread.MAX_PRIORITY);
}
return thread;
|
public void | close()Close the renderer and the device.
super.close();
|
protected com.sun.media.renderer.audio.device.AudioOutput | createDevice(javax.media.format.AudioFormat format)Create the device - DirectAudioOutput.
return (new DirectAudioOutput());
|
public java.lang.String | getName()
return NAME;
|
private static synchronized boolean | grabDevice()Grab the audio device without opening it.
// If the device can be claimed without being opened,
// then fill in this method.
return true;
|
protected boolean | initDevice(javax.media.format.AudioFormat in)
Format newInput = in;
// Free the old ulaw decoder if there's one.
if (ulawDecoder != null) {
ulawDecoder.close();
ulawDecoder = null;
}
// Initialize a ulaw decoder if the input format is ulaw.
Format outs[] = new Format[1];
if (ulawFormat.matches(in)) {
ulawDecoder = SimpleGraphBuilder.findCodec(in, linearFormat, null, outs);
if (ulawDecoder != null) {
ulawOutputFormat = newInput = outs[0];
} else
return false;
}
devFormat = in;
return super.initDevice((AudioFormat)newInput);
|
public boolean | isExclusive()
return false;
|
private native int | nBufferAvailable(int peer)
|
private native void | nCheckUnderflow(int peer)
|
private native void | nClose(int peer)
|
private native void | nDrain(int peer)
|
private native void | nFlush(int peer)
|
private native long | nGetSamplesPlayed(int peer)
|
private native int | nOpen(int rate, int sizeInBits, int channels, int bufSize)native method declaraions
|
private native void | nPause(int peer)
|
private native void | nResume(int peer)
|
private native boolean | nSetFrequency(int peer, int frequency)
|
private native void | nSetGain(int peer, float g)
|
private native void | nSetMute(int peer, boolean m)
|
private native int | nWrite(int peer, byte[] data, int off, int len, boolean swapBytes, boolean signChange)
|
public void | open()
if (device == null && inputFormat != null) {
if (!initDevice(inputFormat))
throw new ResourceUnavailableException("Cannot intialize audio device for playback");
}
|
public int | processData(javax.media.Buffer buffer)
if (!checkInput(buffer))
return BUFFER_PROCESSED_FAILED;
// Process linear data
if (ulawDecoder == null) {
return super.doProcessData(buffer);
}
// Pre-processing ulaw data, then feed it into JavaSound.
if (decodeBuffer == null) {
decodeBuffer = new Buffer();
decodeBuffer.setFormat(ulawOutputFormat);
}
decodeBuffer.setLength(0);
decodeBuffer.setOffset(0);
decodeBuffer.setFlags(buffer.getFlags());
decodeBuffer.setTimeStamp(buffer.getTimeStamp());
decodeBuffer.setSequenceNumber(buffer.getSequenceNumber());
int rc = ulawDecoder.process(buffer, decodeBuffer);
if (rc == BUFFER_PROCESSED_OK) {
return super.doProcessData(decodeBuffer);
}
return BUFFER_PROCESSED_FAILED;
|
public void | run()
((Runnable) device).run();
|