use of javax.media.Renderer in project Spark by igniterealtime.
the class JMFInit method detectDirectAudio.
private void detectDirectAudio() {
Class<?> cls;
int plType = PlugInManager.RENDERER;
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
try {
// Check if this is the Windows Performance Pack - hack
Class.forName("VFWAuto");
// Check if DS capture is supported, otherwise fail DS renderer
// since NT doesn't have capture
Class.forName("com.sun.media.protocol.dsound.DSound");
// Find the renderer class and instantiate it.
cls = Class.forName(dar);
Renderer rend = (Renderer) cls.newInstance();
try {
// Set the format and open the device
AudioFormat af = new AudioFormat(AudioFormat.LINEAR, 44100, 16, 2);
rend.setInputFormat(af);
rend.open();
Format[] inputFormats = rend.getSupportedInputFormats();
// Register the device
PlugInManager.addPlugIn(dar, inputFormats, new Format[0], plType);
// Move it to the top of the list
Vector<String> rendList = PlugInManager.getPlugInList(null, null, plType);
int listSize = rendList.size();
if (rendList.elementAt(listSize - 1).equals(dar)) {
rendList.removeElementAt(listSize - 1);
rendList.insertElementAt(dar, 0);
PlugInManager.setPlugInList(rendList, plType);
PlugInManager.commit();
// Log.debug("registered");
}
rend.close();
} catch (Throwable t) {
// Log.debug("Error " + t);
}
} catch (Throwable tt) {
// Nothing to do
}
}
use of javax.media.Renderer in project Smack by igniterealtime.
the class JMFInit method detectS8DirectAudio.
private static void detectS8DirectAudio() {
Class<?> cls;
int plType = PlugInManager.RENDERER;
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
try {
// Check if this is the solaris Performance Pack - hack
cls = Class.forName("SunVideoAuto");
// Find the renderer class and instantiate it.
cls = Class.forName(dar);
Renderer rend = (Renderer) cls.getConstructor().newInstance();
if (rend instanceof ExclusiveUse && !((ExclusiveUse) rend).isExclusive()) {
// sol8+, DAR supports mixing
@SuppressWarnings("unchecked") Vector<String> rendList = PlugInManager.getPlugInList(null, null, plType);
int listSize = rendList.size();
boolean found = false;
String rname;
for (int i = 0; i < listSize; i++) {
rname = rendList.elementAt(i);
if (rname.equals(dar)) {
// DAR is in the registry
found = true;
rendList.removeElementAt(i);
break;
}
}
if (found) {
rendList.insertElementAt(dar, 0);
PlugInManager.setPlugInList(rendList, plType);
PlugInManager.commit();
}
}
} catch (Throwable tt) {
// Do nothing.
}
}
use of javax.media.Renderer in project Smack by igniterealtime.
the class JMFInit method detectDirectAudio.
private static void detectDirectAudio() {
Class<?> cls;
int plType = PlugInManager.RENDERER;
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
try {
// Check if this is the Windows Performance Pack - hack
cls = Class.forName("VFWAuto");
// Check if DS capture is supported, otherwise fail DS renderer
// since NT doesn't have capture
cls = Class.forName("com.sun.media.protocol.dsound.DSound");
// Find the renderer class and instantiate it.
cls = Class.forName(dar);
Renderer rend = (Renderer) cls.getConstructor().newInstance();
try {
// Set the format and open the device
AudioFormat af = new AudioFormat(AudioFormat.LINEAR, 44100, 16, 2);
rend.setInputFormat(af);
rend.open();
Format[] inputFormats = rend.getSupportedInputFormats();
// Register the device
PlugInManager.addPlugIn(dar, inputFormats, new Format[0], plType);
// Move it to the top of the list
@SuppressWarnings("unchecked") Vector<String> rendList = PlugInManager.getPlugInList(null, null, plType);
int listSize = rendList.size();
if (rendList.elementAt(listSize - 1).equals(dar)) {
rendList.removeElementAt(listSize - 1);
rendList.insertElementAt(dar, 0);
PlugInManager.setPlugInList(rendList, plType);
PlugInManager.commit();
// Log.debug("registered");
}
rend.close();
} catch (Throwable t) {
// Log.debug("Error " + t);
}
} catch (Throwable tt) {
// Do nothing.
}
}
use of javax.media.Renderer in project Spark by igniterealtime.
the class JMFInit method detectS8DirectAudio.
private void detectS8DirectAudio() {
Class<?> cls;
int plType = PlugInManager.RENDERER;
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
try {
// Check if this is the solaris Performance Pack - hack
Class.forName("SunVideoAuto");
// Find the renderer class and instantiate it.
cls = Class.forName(dar);
Renderer rend = (Renderer) cls.newInstance();
if (rend instanceof ExclusiveUse && !((ExclusiveUse) rend).isExclusive()) {
// sol8+, DAR supports mixing
Vector<String> rendList = PlugInManager.getPlugInList(null, null, plType);
int listSize = rendList.size();
boolean found = false;
String rname;
for (int i = 0; i < listSize; i++) {
rname = rendList.elementAt(i);
if (rname.equals(dar)) {
// DAR is in the registry
found = true;
rendList.removeElementAt(i);
break;
}
}
if (found) {
rendList.insertElementAt(dar, 0);
PlugInManager.setPlugInList(rendList, plType);
PlugInManager.commit();
}
}
} catch (Throwable tt) {
// Nothing to do
}
}
Aggregations