Methods Summary |
---|
public void | connect()
// Dont connect a second time
if (connected)
return;
// Create a new V4LSourceStream array
streams = new V4LSourceStream[1];
// Try to open the stream for the specified locator
// The locator has information such as cardno, format, size...
try {
stream = new V4LSourceStream(getLocator());
controls = stream.getControls();
} catch (Exception ex) {
throw new IOException(ex.toString());
} catch (Error er) {
throw new IOException(er.toString());
}
streams[0] = stream;
connected = true;
|
public void | disconnect()
if (!connected)
return;
synchronized (stream) {
try {
if (started)
stop();
} catch (IOException e) {}
stream.close();
connected = false;
}
|
public javax.media.CaptureDeviceInfo | getCaptureDeviceInfo()
return stream.getCaptureDeviceInfo();
|
public java.lang.String | getContentType()
if (!connected){
throw new Error("DataSource not connected yet!");
}
return contentType;
|
public java.lang.Object | getControl(java.lang.String controlType)
try {
Class cls = Class.forName(controlType);
Object cs[] = getControls();
for (int i = 0; i < cs.length; i++) {
if (cls.isInstance(cs[i]))
return cs[i];
}
return null;
} catch (Exception e) { // no such controlType or such control
return null;
}
|
public java.lang.Object[] | getControls()
return controls;
|
public javax.media.Time | getDuration()
// Unbounded
return duration;
|
public javax.media.control.FormatControl[] | getFormatControls()
return stream.getFormatControls();
|
public javax.media.protocol.PushBufferStream[] | getStreams()
return streams;
|
public void | start()
// we need to throw error if connect() has not been called
if (!connected)
throw new java.lang.Error("DataSource must be connected before it can be started");
synchronized (stream) {
if (started)
return;
started = true;
stream.start(true);
}
|
public void | stop()
synchronized (stream) {
if ((!connected) || (!started))
return;
started = false;
stream.start(false);
}
|