-
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 possibility to use vlcj-driver on Windows, refs #233
- Loading branch information
Showing
4 changed files
with
184 additions
and
86 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
42 changes: 42 additions & 0 deletions
42
webcam-capture-drivers/driver-vlcj/src/example/java/WebcamPanelForWindows.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,42 @@ | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import javax.swing.JFrame; | ||
|
||
import uk.co.caprica.vlcj.medialist.MediaListItem; | ||
|
||
import com.github.sarxos.webcam.Webcam; | ||
import com.github.sarxos.webcam.WebcamPanel; | ||
import com.github.sarxos.webcam.ds.vlcj.VlcjDriver; | ||
|
||
|
||
public class WebcamPanelForWindows { | ||
|
||
private static List<MediaListItem> EMPTY = new ArrayList<MediaListItem>(); | ||
|
||
/* NOTE! | ||
* | ||
* The vlclib does not implement video device discovery on Windows. | ||
* Therefore, to make it working on this operating system one needs | ||
* to manually provide the list of media list items from vlcj. This | ||
* is not necessary on Linux and Mac. | ||
*/ | ||
|
||
private static final MediaListItem dev0 = new MediaListItem("HP HD Webcam [Fixed]", "dshow://", EMPTY); | ||
private static final MediaListItem dev1 = new MediaListItem("USB2.0 Camera", "dshow://", EMPTY); | ||
private static final MediaListItem dev2 = new MediaListItem("Logitech Webcam", "dshow://", EMPTY); | ||
|
||
static { | ||
Webcam.setDriver(new VlcjDriver(Arrays.asList(dev0, dev1, dev2))); | ||
} | ||
|
||
public static void main(String[] args) { | ||
JFrame window = new JFrame("Webcam Panel"); | ||
window.add(new WebcamPanel(Webcam.getDefault())); | ||
window.setResizable(false); | ||
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
window.pack(); | ||
window.setVisible(true); | ||
} | ||
} |
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