All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.sarxos.webcam.ds.fswebcam.FsWebcamDriver Maven / Gradle / Ivy

Go to download

This is one of the capture drivers which can be used by Webcam Capture API to fetch image from webcam device. This specific capture driver is using fswebcam command line tool by by Philip Heron to access the image.

There is a newer version: 0.3.12
Show newest version
package com.github.sarxos.webcam.ds.fswebcam;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.sarxos.webcam.WebcamDevice;
import com.github.sarxos.webcam.WebcamDiscoverySupport;
import com.github.sarxos.webcam.WebcamDriver;
import com.github.sarxos.webcam.ds.fswebcam.impl.VideoDeviceFilenameFilter;


public class FsWebcamDriver implements WebcamDriver, WebcamDiscoverySupport {

	private static final Logger LOG = LoggerFactory.getLogger(FsWebcamDriver.class);

	private static final VideoDeviceFilenameFilter VFFILTER = new VideoDeviceFilenameFilter();

	@Override
	public List getDevices() {

		List devices = new ArrayList();

		for (File vfile : VFFILTER.getVideoFiles()) {
			LOG.info("Found video file {}", vfile);
			devices.add(new FsWebcamDevice(vfile));
		}

		return devices;
	}

	@Override
	public boolean isThreadSafe() {
		return false;
	}

	@Override
	public long getScanInterval() {
		return 10000;
	}

	@Override
	public boolean isScanPossible() {
		return true;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy