-
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.
VLCj driver resolution problem and cannot choose camera, fixes #124
- Loading branch information
Showing
7 changed files
with
263 additions
and
83 deletions.
There are no files selected for viewing
53 changes: 27 additions & 26 deletions
53
webcam-capture-drivers/webcam-capture-driver-vlcj/.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,26 +1,27 @@ | ||
<?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 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="output" path="target/classes"/> | ||
</classpath> | ||
<?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 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> | ||
<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="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
19 changes: 19 additions & 0 deletions
19
...m-capture-drivers/webcam-capture-driver-vlcj/src/example/java/ListPureDevicesExample.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,19 @@ | ||
import com.github.sarxos.webcam.WebcamDevice; | ||
import com.github.sarxos.webcam.WebcamDriver; | ||
import com.github.sarxos.webcam.ds.vlcj.VlcjDriver; | ||
|
||
|
||
/** | ||
* This class intends to be used only for VLCj Webcam Driver test purpose! | ||
* | ||
* @author Bartosz Firyn (sarxos) | ||
*/ | ||
public class ListPureDevicesExample { | ||
|
||
public static void main(String[] args) { | ||
WebcamDriver driver = new VlcjDriver(); | ||
for (WebcamDevice device : driver.getDevices()) { | ||
System.out.println(device); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
webcam-capture-drivers/webcam-capture-driver-vlcj/src/example/java/ListWebcamsExample.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,33 @@ | ||
import java.util.List; | ||
|
||
import com.github.sarxos.webcam.Webcam; | ||
import com.github.sarxos.webcam.ds.vlcj.VlcjDriver; | ||
|
||
|
||
/** | ||
* This class provides a simple example of how to use VLCj driver to list | ||
* webcams available in the system.<br> | ||
* <br> | ||
* | ||
* WARNING: It works correctly only in case when used on Linux box. Windows VLCj | ||
* implementation does not support webcam discovery!!! | ||
* | ||
* @author Bartosz Firyn (sarxos) | ||
*/ | ||
public class ListWebcamsExample { | ||
|
||
static { | ||
Webcam.setDriver(new VlcjDriver()); | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
List<Webcam> webcams = Webcam.getWebcams(); | ||
|
||
System.out.format("Webcams detected: %d \n", webcams.size()); | ||
|
||
for (int i = 0; i < webcams.size(); i++) { | ||
System.out.format("%d: %s \n", i + 1, webcams.get(i)); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
webcam-capture-drivers/webcam-capture-driver-vlcj/src/example/java/WebcamPanelExample.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,30 @@ | ||
import javax.swing.JFrame; | ||
|
||
import com.github.sarxos.webcam.Webcam; | ||
import com.github.sarxos.webcam.WebcamPanel; | ||
import com.github.sarxos.webcam.WebcamResolution; | ||
import com.github.sarxos.webcam.ds.vlcj.VlcjDriver; | ||
|
||
|
||
public class WebcamPanelExample { | ||
|
||
static { | ||
Webcam.setDriver(new VlcjDriver()); | ||
} | ||
|
||
public static void main(String[] args) throws InterruptedException { | ||
|
||
Webcam webcam = Webcam.getWebcams().get(0); | ||
webcam.setViewSize(WebcamResolution.VGA.getSize()); | ||
|
||
WebcamPanel panel = new WebcamPanel(webcam); | ||
panel.setFPSDisplayed(true); | ||
|
||
JFrame window = new JFrame("Webcam Panel using VLCj"); | ||
window.add(panel); | ||
window.setResizable(false); | ||
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
window.pack(); | ||
window.setVisible(true); | ||
} | ||
} |
Oops, something went wrong.