sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.27k stars 1.11k forks source link

replace Webcam.setDriver to Webcam.registerDriver #507

Open henriquem opened 8 years ago

henriquem commented 8 years ago

Hello!

I would like to use two kind differents of Driver : VlcjDriver + IpCamDriver Today I have Webcam.setDriver(new VlcjDriver(Arrays.asList(new MediaListItem(........));

How I replace above to Webcam.registerDriver ? I know that registerDriver allow your append more than 1 Driver. It is accepted: Webcam.registerDriver (IpCamDriver.class); Webcam.registerDriver (VlcjDriver.class);

But, Where I will set up the address camera of vlclDriver ?

Cheers!

sarxos commented 7 years ago

I'm not sure if I understand your idea, but you can use WebcamCompositeDriver to "merge" different drivers into a single one.

https://github.com/sarxos/webcam-capture/blob/7e82df6ba87cdff3edfc4c8318ac0f0769db4a4a/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamCompositeDriver.java

Here is example:

https://github.com/sarxos/webcam-capture/blob/7e82df6ba87cdff3edfc4c8318ac0f0769db4a4a/webcam-capture-drivers/driver-ipcam/src/examples/java/DualNativeAndMjpegWebcamExample.java