Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent event)
String strAction;
strAction = event.getActionCommand ();
if ( strAction.equals(buttonDetect.getActionCommand()) )
detectDevices ();
|
public boolean | addToList(int code, java.lang.String value)
// Register the device
try {
String className = value;
Class pic = Class.forName(className);
Object instance = pic.newInstance();
if (instance instanceof CaptureDeviceInfo) {
CaptureDeviceInfo cdi = (CaptureDeviceInfo) instance;
if (cdi.getName() != null || cdi.getLocator() != null) {
if (CaptureDeviceManager.addDevice(cdi)) {
return true;
}
}
}
}
catch (Exception e) {
System.err.println(e);
}
catch (Error er) {
System.err.println(er);
}
return false;
|
public void | commit(int code)
int i;
for (i = 0; i < devices.size(); i++)
CaptureDeviceManager.removeDevice((CaptureDeviceInfo) devices.elementAt(i));
for (i = 0; i < deviceVector.size(); i++) {
String name = (String) deviceVector.elementAt(i);
for (int j = 0; j < devices.size(); j++) {
if (((CaptureDeviceInfo)devices.elementAt(j)).getName().equals(name)) {
CaptureDeviceManager.addDevice((CaptureDeviceInfo)devices.elementAt(j));
break;
}
}
}
try {
CaptureDeviceManager.commit();
}
catch (IOException ioe) {
System.err.println("CaptureDeviceManager.commit() - " + ioe);
}
|
private void | createPanelDevices()
if ( panelDevices != null )
panelLeft.remove ( panelDevices );
panelDevices = new VectorPanel ( JMFI18N.getResource("jmfregistry.capture.vector.label"), this, 0 );
panelLeft.add ( panelDevices, BorderLayout.CENTER );
panelLeft.validate();
|
private void | detectDevices()
// Check if VFWAuto or SunVideoAuto is available
Class directAudio = null;
Class autoAudio = null;
Class autoVideo = null;
Class autoVideoPlus = null;
Object instanceAudio;
Object instanceVideo;
Object instanceVideoPlus;
PopupWait popupWait;
try {
directAudio = Class.forName("DirectSoundAuto");
}
catch (Exception e) {
}
try {
autoAudio = Class.forName("JavaSoundAuto");
}
catch (Exception e) {
}
try {
autoVideo = Class.forName("VFWAuto");
}
catch (Exception e) {
}
if (autoVideo == null) {
try {
autoVideo = Class.forName("SunVideoAuto");
}
catch (Exception ee) {
}
try {
autoVideoPlus = Class.forName("SunVideoPlusAuto");
}
catch (Exception ee) {
}
}
if (autoVideo == null) {
try {
autoVideo = Class.forName("V4LAuto");
} catch (Exception eee) {
}
}
if ( directAudio == null && autoAudio == null &&
autoVideo == null && autoVideoPlus == null )
return;
popupWait = new PopupWait ( getFrame(),
JMFI18N.getResource("jmstudio.mssg.capturequery")
+ "\n" + JMFI18N.getResource("jmfregistry.appname") + " "
+ JMFI18N.getResource("jmstudio.mssg.lookingcapture") );
popupWait.setVisible ( true );
try {
if ( directAudio != null )
instanceAudio = directAudio.newInstance ();
if ( autoAudio != null )
instanceAudio = autoAudio.newInstance ();
if ( autoVideo != null )
instanceVideo = autoVideo.newInstance ();
if (autoVideoPlus != null)
instanceVideoPlus = autoVideoPlus.newInstance ();
}
catch ( ThreadDeath td ) {
popupWait.dispose();
throw td;
}
catch (Throwable t) {
MessageDialog.createErrorDialog ( new Frame(), JMFI18N.getResource("jmstudio.error.capturequery") );
}
popupWait.dispose();
createPanelDevices ();
|
public java.util.Vector | getList(int code)
devices = CaptureDeviceManager.getDeviceList(null);
devices = (Vector) devices.clone();
deviceVector = new Vector(10);
Enumeration enum = devices.elements();
while (enum.hasMoreElements()) {
CaptureDeviceInfo cdi = (CaptureDeviceInfo) enum.nextElement();
deviceVector.addElement(cdi.getName());
}
return deviceVector;
|
private java.lang.String | printFormats(java.lang.Object fa)
if (! (fa instanceof Format[])) {
return "null";
}
else {
Format [] formats = (Format []) fa;
String text = "";
for (int i = 0; i < formats.length; i++) {
text += i + ". " + formats[i].getClass().getName() + "\n " + formats[i] + "\n";
}
return text;
}
|
public void | selectedIndex(int code, int index)
String text = "";
String name = null;
CaptureDeviceInfo cdi = null;
if ( index >= 0 )
name = (String) deviceVector.elementAt ( index );
if ( name != null )
cdi = CaptureDeviceManager.getDevice ( name );
if (cdi != null) {
text += JMFI18N.getResource("jmfregistry.details.name") + " = "
+ cdi.getName() + "\n\n";
text += JMFI18N.getResource("jmfregistry.details.locator") + " = "
+ cdi.getLocator() + "\n\n";
text += JMFI18N.getResource("jmfregistry.details.outformats")
+ "---->\n\n" + printFormats(cdi.getFormats()) + "\n\n";
}
textArea.setText(text);
|
public void | setList(int code, java.util.Vector v)
deviceVector = v;
|
public java.util.Vector | stringArrayToVector(java.lang.String[] array)
Vector v = new Vector();
if (array != null)
for (int i = 0; i < array.length; i++)
v.addElement(array[i]);
return v;
|
public java.lang.String[] | vectorToStringArray(java.util.Vector v)
String [] sa = new String[v.size()];
Enumeration e = v.elements();
int i = 0;
while (e.hasMoreElements())
sa[i++] = (String) e.nextElement();
return sa;
|