-
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.
Add Linux support to GStreamer capture driver, refs #100
- Loading branch information
Showing
6 changed files
with
172 additions
and
34 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
...re-drivers/webcam-capture-driver-gstreamer/src/example/java/ListSupportedResolutions.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,28 @@ | ||
import java.awt.Dimension; | ||
|
||
import com.github.sarxos.webcam.Webcam; | ||
import com.github.sarxos.webcam.ds.gstreamer.GStreamerDriver; | ||
|
||
|
||
public class ListSupportedResolutions { | ||
|
||
// uncomment if you would like debug prints to be visible, and don't | ||
// forget to add logback JAR and XML file as well | ||
static { | ||
// WebcamLogConfigurator.configure("src/example/resources/logback.xml"); | ||
} | ||
|
||
static { | ||
Webcam.setDriver(new GStreamerDriver()); | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
for (Webcam webcam : Webcam.getWebcams()) { | ||
System.out.println("webcam --- " + webcam.getName()); | ||
for (Dimension d : webcam.getViewSizes()) { | ||
System.out.println("supported resolution: " + d.width + "x" + d.height); | ||
} | ||
} | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
...r/src/main/java/com/github/sarxos/webcam/ds/gstreamer/impl/VideoDeviceFilenameFilter.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,27 @@ | ||
package com.github.sarxos.webcam.ds.gstreamer.impl; | ||
|
||
import java.io.File; | ||
import java.io.FilenameFilter; | ||
|
||
|
||
public class VideoDeviceFilenameFilter implements FilenameFilter { | ||
|
||
private static final File DEV = new File("/dev"); | ||
|
||
@Override | ||
public boolean accept(File dir, String name) { | ||
return dir.getName().equals("dev") && name.startsWith("video") && Character.isDigit(name.charAt(5)); | ||
} | ||
|
||
public File[] getVideoFiles() { | ||
|
||
String[] names = DEV.list(this); | ||
File[] files = new File[names.length]; | ||
|
||
for (int i = 0; i < names.length; i++) { | ||
files[i] = new File(DEV, names[i]); | ||
} | ||
|
||
return files; | ||
} | ||
} |