-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance IP camera driver, update few dependencies
- Loading branch information
Showing
14 changed files
with
315 additions
and
62 deletions.
There are no files selected for viewing
33 changes: 6 additions & 27 deletions
33
webcam-capture-drivers/webcam-capture-driver-ipcam/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<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 excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"/> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/> | ||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/> | ||
<classpathentry kind="src" path="src/examples/java"/> | ||
<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"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src/examples/resources"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
webcam-capture-drivers/webcam-capture-driver-ipcam/src/examples/resources/cameras.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<storage> | ||
<ipcam name="Dasding 1" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=1" /> | ||
<ipcam name="Dasding 2" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=2" /> | ||
<ipcam name="Dasding 4" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=4" /> | ||
<ipcam name="Dasding 6" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=6" /> | ||
<ipcam name="Dasding 7" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=7" /> | ||
<ipcam name="Dasding 10" url="http://www.dasding.de/ext/webcam/webcam770.php?cam=10" /> | ||
</storage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ebcam-capture-driver-ipcam/src/main/java/com/github/sarxos/webcam/ds/ipcam/IpCamMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
package com.github.sarxos.webcam.ds.ipcam; | ||
|
||
import javax.xml.bind.annotation.XmlEnum; | ||
import javax.xml.bind.annotation.XmlEnumValue; | ||
|
||
|
||
/** | ||
* How to obtain new images from IP cameras. | ||
* | ||
* @author Bartosz Firyn (SarXos) | ||
*/ | ||
@XmlEnum | ||
public enum IpCamMode { | ||
|
||
/** | ||
* Device will pull image from IP camera. | ||
*/ | ||
@XmlEnumValue("pull") | ||
PULL, | ||
|
||
/** | ||
* IP camera HTTP server will push new image to the device. | ||
*/ | ||
@XmlEnumValue("pull") | ||
PUSH, | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
...am-capture-driver-ipcam/src/main/java/com/github/sarxos/webcam/ds/ipcam/IpCamStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.github.sarxos.webcam.ds.ipcam; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import javax.xml.bind.JAXBContext; | ||
import javax.xml.bind.JAXBException; | ||
import javax.xml.bind.Unmarshaller; | ||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
import com.github.sarxos.webcam.WebcamException; | ||
import com.github.sarxos.webcam.ds.ipcam.impl.IpCamDescriptor; | ||
|
||
|
||
@XmlRootElement(name = "storage") | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
public class IpCamStorage { | ||
|
||
private static final Class<?>[] CLASSES = new Class<?>[] { | ||
IpCamStorage.class, | ||
IpCamDescriptor.class, | ||
}; | ||
|
||
private static final JAXBContext CTX; | ||
static { | ||
JAXBContext c = null; | ||
try { | ||
c = JAXBContext.newInstance(CLASSES); | ||
} catch (JAXBException e) { | ||
throw new RuntimeException(e); | ||
} finally { | ||
CTX = c; | ||
} | ||
} | ||
|
||
@XmlElement(name = "ipcam") | ||
private List<IpCamDescriptor> descriptors = null; | ||
|
||
private transient File file = null; | ||
|
||
protected IpCamStorage() { | ||
} | ||
|
||
public IpCamStorage(String file) { | ||
this(new File(file)); | ||
} | ||
|
||
public IpCamStorage(File file) { | ||
this.file = file; | ||
} | ||
|
||
protected List<IpCamDescriptor> getDescriptors() { | ||
return descriptors; | ||
} | ||
|
||
public void open() { | ||
|
||
IpCamStorage storage = null; | ||
try { | ||
Unmarshaller unmarshaller = CTX.createUnmarshaller(); | ||
storage = (IpCamStorage) unmarshaller.unmarshal(file); | ||
} catch (JAXBException e) { | ||
throw new WebcamException(e); | ||
} | ||
|
||
for (IpCamDescriptor d : storage.getDescriptors()) { | ||
IpCamDeviceRegistry.register(d.getName(), d.getURL(), d.getMode(), d.getAuth()); | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...re-driver-ipcam/src/main/java/com/github/sarxos/webcam/ds/ipcam/impl/IpCamDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.github.sarxos.webcam.ds.ipcam.impl; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
|
||
import com.github.sarxos.webcam.WebcamException; | ||
import com.github.sarxos.webcam.ds.ipcam.IpCamAuth; | ||
import com.github.sarxos.webcam.ds.ipcam.IpCamMode; | ||
|
||
|
||
@XmlAccessorType(XmlAccessType.FIELD) | ||
public class IpCamDescriptor { | ||
|
||
@XmlAccessorType(XmlAccessType.FIELD) | ||
protected static class AuthParams { | ||
|
||
@XmlAttribute | ||
private String user = null; | ||
|
||
@XmlAttribute | ||
private String password = null; | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
} | ||
|
||
@XmlAttribute | ||
private String name = null; | ||
|
||
@XmlAttribute(name = "url") | ||
private String urlString = null; | ||
|
||
private transient URL url = null; | ||
|
||
@XmlAttribute | ||
private IpCamMode mode = IpCamMode.PULL; | ||
|
||
@XmlElement(name = "auth") | ||
private AuthParams authParams = null; | ||
|
||
private transient IpCamAuth auth = null; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public URL getURL() { | ||
if (urlString != null && url == null) { | ||
try { | ||
url = new URL(urlString); | ||
} catch (MalformedURLException e) { | ||
throw new WebcamException(e); | ||
} | ||
} | ||
return url; | ||
} | ||
|
||
public IpCamMode getMode() { | ||
return mode; | ||
} | ||
|
||
public IpCamAuth getAuth() { | ||
if (authParams != null && auth == null) { | ||
auth = new IpCamAuth(authParams.getUser(), authParams.getPassword()); | ||
} | ||
return auth; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
remove this dependency