Skip to content

Commit

Permalink
Fix more javadocs, change repos, fix classpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos committed Sep 23, 2014
1 parent 6b47935 commit df24bfd
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 285 deletions.
7 changes: 0 additions & 7 deletions webcam-capture-drivers/driver-fswebcam/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/example/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/**
* Class used to register IP camera devices.
*
*
* @author Bartosz Firyn (SarXos)
*/
public class IpCamDeviceRegistry {
Expand All @@ -29,8 +29,9 @@ public class IpCamDeviceRegistry {

/**
* Register IP camera.
*
*
* @param ipcam the IP camera to be register
* @return IP camera device
*/
public static IpCamDevice register(IpCamDevice ipcam) {

Expand Down Expand Up @@ -62,7 +63,7 @@ public static IpCamDevice register(String name, String url, IpCamMode mode, IpCa

/**
* Register new IP camera device.
*
*
* @param name the name of the device
* @param url the URL to be used
* @param mode the camera mode to be used
Expand All @@ -75,7 +76,7 @@ public static IpCamDevice register(String name, URL url, IpCamMode mode, IpCamAu

/**
* Is device registered?
*
*
* @param ipcam the IP camera device
* @return True if device is registsred, false otherwise
*/
Expand All @@ -97,7 +98,7 @@ public static boolean isRegistered(IpCamDevice ipcam) {

/**
* Is device with given name registered?
*
*
* @param name the name of device
* @return True if device is registered, false otherwise
*/
Expand All @@ -119,7 +120,7 @@ public static boolean isRegistered(String name) {

/**
* Is device with given URL registered?
*
*
* @param url the URL used by device
* @return True if device is registered, false otherwise
*/
Expand All @@ -138,8 +139,8 @@ public static boolean isRegistered(URL url) {

/**
* Is device with given URL registered?
*
* @param url the URL used by device
*
* @param uri the URI used by device
* @return True if device is registered, false otherwise
*/
public static boolean isRegistered(URI uri) {
Expand Down Expand Up @@ -167,8 +168,9 @@ public static boolean isRegistered(URI uri) {

/**
* Unregister IP camera.
*
*
* @param ipcam the IP camera to be unregister
* @return True if IP camera device has been unregistered, false otherwise
*/
public static boolean unregister(IpCamDevice ipcam) {
try {
Expand All @@ -179,8 +181,8 @@ public static boolean unregister(IpCamDevice ipcam) {
}

/**
* Run discovery service once if device has been removed to trigger
* disconnected webcam discovery event and keep webcams list up-to-date.
* Run discovery service once if device has been removed to trigger disconnected webcam
* discovery event and keep webcams list up-to-date.
*/
private static void rescan() {
WebcamDiscoveryService discovery = Webcam.getDiscoveryServiceRef();
Expand All @@ -192,7 +194,8 @@ private static void rescan() {
/**
* Unregister IP camera with given name.
*
* @param ipcam the IP camera to be unregister
* @param name the name of IP camera to be unregister
* @return True if device has been registered, false otherwise
*/
public static boolean unregister(String name) {
Iterator<IpCamDevice> di = DEVICES.iterator();
Expand All @@ -209,7 +212,7 @@ public static boolean unregister(String name) {

/**
* Get all registered IP cameras.
*
*
* @return Collection of registered IP cameras
*/
public static List<IpCamDevice> getIpCameras() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

/**
* IP camera driver.
*
*
* @author Bartosz Firyn (sarxos)
*/
public class IpCamDriver implements WebcamDriver, WebcamDiscoverySupport {

/**
* Thread factory.
*
*
* @author Bartosz Firyn (sarxos)
*/
private static class DeviceCheckThreadFactory implements ThreadFactory {
Expand Down Expand Up @@ -62,9 +62,9 @@ public Thread newThread(Runnable r) {
private static final ThreadFactory THREAD_FACTORY = new DeviceCheckThreadFactory();

/**
* The callable to query single IP camera device. Callable getter will
* return device if it's online or null if it's offline.
*
* The callable to query single IP camera device. Callable getter will return device if it's
* online or null if it's offline.
*
* @author Bartosz Firyn (sarxos)
*/
private static class DeviceOnlineCheck implements Callable<IpCamDevice> {
Expand All @@ -78,8 +78,9 @@ private static class DeviceOnlineCheck implements Callable<IpCamDevice> {

/**
* The callable to query single IP camera device.
*
*
* @param device the device to check online status
* @param latch the count down latch
*/
public DeviceOnlineCheck(IpCamDevice device, CountDownLatch latch) {
this.device = device;
Expand All @@ -102,8 +103,8 @@ public IpCamDevice call() throws Exception {
private volatile long scanInterval = 10000;

/**
* Discovery scan timeout in milliseconds. This is maximum time which
* executor will wait for online detection to succeed.
* Discovery scan timeout in milliseconds. This is maximum time which executor will wait for
* online detection to succeed.
*/
private volatile long scanTimeout = 10000;

Expand Down Expand Up @@ -214,9 +215,8 @@ public long getScanInterval() {
}

/**
* Set new scan interval. Value must be given in milliseconds and shall not
* be negative.
*
* Set new scan interval. Value must be given in milliseconds and shall not be negative.
*
* @param scanInterval
*/
public void setScanInterval(long scanInterval) {
Expand All @@ -234,7 +234,7 @@ public boolean isScanPossible() {

/**
* Set discovery scanning possible.
*
*
* @param scanning
*/
public void setScanPossible(boolean scanning) {
Expand All @@ -249,9 +249,9 @@ public long getScanTimeout() {
}

/**
* Set new scan timeout. This value cannot be less than 1000 milliseconds
* (which equals 1 second).
*
* Set new scan timeout. This value cannot be less than 1000 milliseconds (which equals 1
* second).
*
* @param scanTimeout the scan timeout in milliseconds
*/
public void setScanTimeout(long scanTimeout) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
package com.github.sarxos.webcam.ds.vlcj;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
import uk.co.caprica.vlcj.medialist.MediaList;
import uk.co.caprica.vlcj.medialist.MediaListItem;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.discoverer.MediaDiscoverer;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;

import com.github.sarxos.webcam.WebcamDevice;
import com.github.sarxos.webcam.WebcamDiscoverySupport;
import com.github.sarxos.webcam.WebcamDriver;
import com.github.sarxos.webcam.util.OsUtils;
import com.sun.jna.Native;


/**
* This is capture driver which uses <code>vlcj</code> library to gain access to
* the camera device.
*
* This is capture driver which uses <code>vlcj</code> library to gain access to the camera device.
* The library can be found at:<br>
* <br>
* http://www.capricasoftware.co.uk/projects/vlcj/index.html
*
* @author Bartosz Firyn (SarXos)
* @see http://www.capricasoftware.co.uk/projects/vlcj/index.html
*/
public class VlcjDriver implements WebcamDriver, WebcamDiscoverySupport {

Expand All @@ -36,7 +31,7 @@ public class VlcjDriver implements WebcamDriver, WebcamDiscoverySupport {
System.setProperty("vlcj.log", "DEBUG");
}
}

/**
* Default webcam discovery scan interval in milliseconds.
*/
Expand All @@ -51,7 +46,7 @@ public class VlcjDriver implements WebcamDriver, WebcamDiscoverySupport {
* Native library discoverer.
*/
private static NativeDiscovery nativeDiscovery;

/**
* The scan interval.
*/
Expand All @@ -67,7 +62,7 @@ public VlcjDriver() {
}

public VlcjDriver(List<MediaListItem> mediaListItems) {
this.mediaListItems = mediaListItems;
this.mediaListItems = mediaListItems;
initialize();
}

Expand All @@ -79,9 +74,9 @@ protected static void initialize() {
}

/**
* Initialize natives. If argument is true the natives are being loaded. In
* case of false this method do nothing. It's used mostly in unit tests.
*
* Initialize natives. If argument is true the natives are being loaded. In case of false this
* method do nothing. It's used mostly in unit tests.
*
* @param load the control to decide whether to load natives or ignore them
*/
protected static void initialize(boolean load) {
Expand All @@ -90,32 +85,13 @@ protected static void initialize(boolean load) {
if (!nativeFound) {
throw new IllegalStateException("The libvlc native library has not been found");
}
//Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
// Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
}
}


/**
* Method to get devices list on Windows.
*
* @return Webcam devices list
*/
private List<WebcamDevice> getDevicesPreconf() {



List<WebcamDevice> devices = new ArrayList<WebcamDevice>();

MediaListItem mli = new MediaListItem("HP HD Webcam [Fixed]", "dshow://", new ArrayList<MediaListItem>());

devices.add(mediaListItemToDevice(mli));

return devices;
}

@Override
public List<WebcamDevice> getDevices() {

if (OsUtils.getOS() == OsUtils.WIN) {
System.err.println("WARNING: VLCj does not support webcam devices discovery on Windows platform");
}
Expand Down Expand Up @@ -149,7 +125,7 @@ public List<WebcamDevice> getDevices() {

/**
* Converts media list itemn into webcam device.
*
*
* @param item the item to be converted to webcam device instance
* @return Webcam device created from media list item
*/
Expand All @@ -159,7 +135,7 @@ protected WebcamDevice mediaListItemToDevice(MediaListItem item) {

/**
* Creates media player factory.
*
*
* @return New media player factory
*/
protected MediaPlayerFactory createMediaPlayerFactory() {
Expand All @@ -185,10 +161,9 @@ public long getScanInterval() {
}

/**
* Set new scan interval. Value must be positive number. If negative or zero
* is used, then the corresponding getter will return default scan interval
* value.
*
* Set new scan interval. Value must be positive number. If negative or zero is used, then the
* corresponding getter will return default scan interval value.
*
* @param scanInterval the new scan interval in milliseconds
* @see VlcjDriver#DEFAULT_SCAN_INTERVAL
*/
Expand All @@ -200,7 +175,7 @@ public void setScanInterval(long scanInterval) {
public boolean isScanPossible() {
return OsUtils.getOS() != OsUtils.WIN;
}

protected static NativeDiscovery getNativeDiscovery() {
if (nativeDiscovery == null) {
nativeDiscovery = new NativeDiscovery();
Expand Down
2 changes: 1 addition & 1 deletion webcam-capture-examples/webcam-capture-applet/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</classpathentry>
<classpathentry kind="src" path="src/main/html"/>
<classpathentry kind="src" path="src/etc/resources"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
Expand Down
Loading

0 comments on commit df24bfd

Please sign in to comment.