com.github.sarxos.webcam.ds.dummy.WebcamDummyDriver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webcam-capture Show documentation
Show all versions of webcam-capture Show documentation
This library allows you to use your PC webcam, IP or network cameras directly from Java. It's compatible with most operating systems (Windows, Linux, MacOS).
package com.github.sarxos.webcam.ds.dummy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.github.sarxos.webcam.WebcamDevice;
import com.github.sarxos.webcam.WebcamDiscoverySupport;
import com.github.sarxos.webcam.WebcamDriver;
public class WebcamDummyDriver implements WebcamDriver, WebcamDiscoverySupport {
private int count;
public WebcamDummyDriver(int count) {
this.count = count;
}
@Override
public long getScanInterval() {
return 10000;
}
@Override
public boolean isScanPossible() {
return true;
}
@Override
public List getDevices() {
List devices = new ArrayList();
for (int i = 0; i < count; i++) {
devices.add(new WebcamDummyDevice(i));
}
return Collections.unmodifiableList(devices);
}
@Override
public boolean isThreadSafe() {
return false;
}
}