diff --git a/pom.xml b/pom.xml
index d07658d..6304500 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
io.github.eduramiba
webcam-capture-driver-native
- 1.2.0
+ 1.2.0-8
4.0.0
jar
@@ -39,7 +39,7 @@
- 11
+ 8
UTF-8
UTF-8
@@ -49,7 +49,7 @@
0.3.13-SNAPSHOT
5.16.0
- 19
+
3.13.0
@@ -94,11 +94,11 @@
${driver.jna.version}
-
- org.openjfx
- javafx-graphics
- ${driver.javafx.version}
-
+
+
+
+
+
@@ -124,11 +124,11 @@
jna-platform
-
- org.openjfx
- javafx-graphics
- provided
-
+
+
+
+
+
diff --git a/src/main/java/com/github/eduramiba/webcamcapture/TestDriver.java b/src/main/java/com/github/eduramiba/webcamcapture/TestDriver.java
index b99695e..d6a1e09 100644
--- a/src/main/java/com/github/eduramiba/webcamcapture/TestDriver.java
+++ b/src/main/java/com/github/eduramiba/webcamcapture/TestDriver.java
@@ -1,83 +1,83 @@
-package com.github.eduramiba.webcamcapture;
-
-import com.github.eduramiba.webcamcapture.drivers.NativeDriver;
-import com.github.eduramiba.webcamcapture.drivers.WebcamDeviceWithBufferOperations;
-import com.github.sarxos.webcam.Webcam;
-import com.github.sarxos.webcam.WebcamDevice;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.scene.Scene;
-import javafx.scene.image.ImageView;
-import javafx.scene.image.WritableImage;
-import javafx.scene.layout.HBox;
-import javafx.stage.Stage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestDriver extends Application {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestDriver.class);
-
- public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
-
- public static void main(String[] args) {
- Webcam.setDriver(new NativeDriver());
-
- launch(args);
- }
-
- @Override
- public void start(Stage stage) throws Exception {
- final ImageView imageView = new ImageView();
- final HBox root = new HBox();
- root.getChildren().add(imageView);
-
- Webcam.getWebcams().stream()
- .findFirst()
- .ifPresent((final Webcam camera) -> {
- final WebcamDevice device = camera.getDevice();
- LOG.info("Found camera: {}, device = {}", camera, device);
-
- final int width = device.getResolution().width;
- final int height = device.getResolution().height;
- final WritableImage fxImage = new WritableImage(width, height);
- Platform.runLater(() -> {
- imageView.setImage(fxImage);
- stage.setWidth(width);
- stage.setHeight(height);
- stage.centerOnScreen();
- });
-
- camera.getLock().disable();
- camera.open();
- if (device instanceof WebcamDeviceWithBufferOperations) {
- final WebcamDeviceWithBufferOperations dev = ((WebcamDeviceWithBufferOperations) device);
- EXECUTOR.scheduleAtFixedRate(new Runnable() {
- private long lastFrameTimestamp = -1;
-
- @Override
- public void run() {
- if (dev.updateFXIMage(fxImage, lastFrameTimestamp)) {
- lastFrameTimestamp = dev.getLastFrameTimestamp();
- }
-
- }
- }, 0, 16, TimeUnit.MILLISECONDS);
- }
- });
-
- stage.setOnCloseRequest(t -> {
- Platform.exit();
- System.exit(0);
- });
-
- // Create the Scene
- final Scene scene = new Scene(root);
- stage.setScene(scene);
- stage.setTitle("Webcam example");
- stage.show();
- }
-}
+//package com.github.eduramiba.webcamcapture;
+//
+//import com.github.eduramiba.webcamcapture.drivers.NativeDriver;
+//import com.github.eduramiba.webcamcapture.drivers.WebcamDeviceWithBufferOperations;
+//import com.github.sarxos.webcam.Webcam;
+//import com.github.sarxos.webcam.WebcamDevice;
+//import java.util.concurrent.Executors;
+//import java.util.concurrent.ScheduledExecutorService;
+//import java.util.concurrent.TimeUnit;
+//import javafx.application.Application;
+//import javafx.application.Platform;
+//import javafx.scene.Scene;
+//import javafx.scene.image.ImageView;
+//import javafx.scene.image.WritableImage;
+//import javafx.scene.layout.HBox;
+//import javafx.stage.Stage;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//public class TestDriver extends Application {
+//
+// private static final Logger LOG = LoggerFactory.getLogger(TestDriver.class);
+//
+// public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
+//
+// public static void main(String[] args) {
+// Webcam.setDriver(new NativeDriver());
+//
+// launch(args);
+// }
+//
+// @Override
+// public void start(Stage stage) throws Exception {
+// final ImageView imageView = new ImageView();
+// final HBox root = new HBox();
+// root.getChildren().add(imageView);
+//
+// Webcam.getWebcams().stream()
+// .findFirst()
+// .ifPresent((final Webcam camera) -> {
+// final WebcamDevice device = camera.getDevice();
+// LOG.info("Found camera: {}, device = {}", camera, device);
+//
+// final int width = device.getResolution().width;
+// final int height = device.getResolution().height;
+// final WritableImage fxImage = new WritableImage(width, height);
+// Platform.runLater(() -> {
+// imageView.setImage(fxImage);
+// stage.setWidth(width);
+// stage.setHeight(height);
+// stage.centerOnScreen();
+// });
+//
+// camera.getLock().disable();
+// camera.open();
+// if (device instanceof WebcamDeviceWithBufferOperations) {
+// final WebcamDeviceWithBufferOperations dev = ((WebcamDeviceWithBufferOperations) device);
+// EXECUTOR.scheduleAtFixedRate(new Runnable() {
+// private long lastFrameTimestamp = -1;
+//
+// @Override
+// public void run() {
+// if (dev.updateFXIMage(fxImage, lastFrameTimestamp)) {
+// lastFrameTimestamp = dev.getLastFrameTimestamp();
+// }
+//
+// }
+// }, 0, 16, TimeUnit.MILLISECONDS);
+// }
+// });
+//
+// stage.setOnCloseRequest(t -> {
+// Platform.exit();
+// System.exit(0);
+// });
+//
+// // Create the Scene
+// final Scene scene = new Scene(root);
+// stage.setScene(scene);
+// stage.setTitle("Webcam example");
+// stage.show();
+// }
+//}
diff --git a/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFDriver.java b/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFDriver.java
index dbf969e..612a614 100644
--- a/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFDriver.java
+++ b/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFDriver.java
@@ -19,7 +19,7 @@ public class AVFDriver implements WebcamDriver {
@Override
public synchronized List getDevices() {
- final var lib = LibVideoCapture.INSTANCE;
+ final LibVideoCapture lib = LibVideoCapture.INSTANCE;
final List list = new ArrayList<>();
@@ -61,25 +61,25 @@ public class AVFDriver implements WebcamDriver {
}
private static String deviceUniqueId(final int deviceIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibVideoCapture.INSTANCE.vcavf_get_device_unique_id(deviceIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
private static String deviceModelId(final int deviceIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibVideoCapture.INSTANCE.vcavf_get_device_model_id(deviceIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
private static String deviceName(final int deviceIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibVideoCapture.INSTANCE.vcavf_get_device_name(deviceIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
private static String deviceFormat(final int deviceIndex, final int formatIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibVideoCapture.INSTANCE.vcavf_get_device_format(deviceIndex, formatIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
diff --git a/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFVideoDevice.java b/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFVideoDevice.java
index b0209a7..aeb263d 100644
--- a/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFVideoDevice.java
+++ b/src/main/java/com/github/eduramiba/webcamcapture/drivers/avfoundation/driver/AVFVideoDevice.java
@@ -109,7 +109,7 @@ public class AVFVideoDevice implements WebcamDeviceExtended {
return;
}
- final var lib = LibVideoCapture.INSTANCE;
+ final LibVideoCapture lib = LibVideoCapture.INSTANCE;
final int authStatus = lib.vcavf_has_videocapture_auth();
if (authStatus != STATUS_AUTHORIZED) {
@@ -261,7 +261,7 @@ public class AVFVideoDevice implements WebcamDeviceExtended {
// Init buffer if still not initialized:
this.bytesPerRow = LibVideoCapture.INSTANCE.vcavf_frame_bytes_per_row(deviceIndex);
- final var bufferSizeBytes = bytesPerRow * resolution.height;
+ final int bufferSizeBytes = bytesPerRow * resolution.height;
this.imgBuffer = ByteBuffer.allocateDirect(bufferSizeBytes);
this.arrayByteBuffer = new byte[imgBuffer.capacity()];
}
diff --git a/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaDriver.java b/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaDriver.java
index 68c31dd..f74c19b 100644
--- a/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaDriver.java
+++ b/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaDriver.java
@@ -25,7 +25,7 @@ public class NokhwaDriver implements WebcamDriver {
@Override
public synchronized List getDevices() {
- final var lib = LibNokhwa.INSTANCE;
+ final LibNokhwa lib = LibNokhwa.INSTANCE;
final List list = new ArrayList<>();
@@ -86,19 +86,19 @@ public class NokhwaDriver implements WebcamDriver {
}
private static String deviceUniqueId(final int deviceIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibNokhwa.INSTANCE.cnokhwa_device_unique_id(deviceIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
private static String deviceName(final int deviceIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibNokhwa.INSTANCE.cnokhwa_device_name(deviceIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
private static String deviceFormatType(final int deviceIndex, final int formatIndex) {
- final var bufferP = Native.getDirectBufferPointer(buffer);
+ final com.sun.jna.Pointer bufferP = Native.getDirectBufferPointer(buffer);
LibNokhwa.INSTANCE.cnokhwa_device_format_type(deviceIndex, formatIndex, bufferP, buffer.capacity());
return bufferP.getString(0, StandardCharsets.UTF_8.name());
}
diff --git a/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaVideoDevice.java b/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaVideoDevice.java
index 9b556fe..d2effb5 100644
--- a/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaVideoDevice.java
+++ b/src/main/java/com/github/eduramiba/webcamcapture/drivers/nokhwa/NokhwaVideoDevice.java
@@ -108,7 +108,7 @@ public class NokhwaVideoDevice implements WebcamDeviceExtended {
return;
}
- final var lib = LibNokhwa.INSTANCE;
+ final LibNokhwa lib = LibNokhwa.INSTANCE;
final int authStatus = lib.cnokhwa_has_videocapture_auth();
if (authStatus != STATUS_AUTHORIZED) {
@@ -240,7 +240,7 @@ public class NokhwaVideoDevice implements WebcamDeviceExtended {
final PixelWriter pw = writableImage.getPixelWriter();
- final ByteBuffer readBuffer = imgBuffer.asReadOnlyBuffer().position(0);
+ final ByteBuffer readBuffer = (ByteBuffer) imgBuffer.asReadOnlyBuffer().position(0);
pw.setPixels(
0, 0, videoWidth, videoHeight,
PixelFormat.getByteRgbInstance(), readBuffer, bytesPerRow
@@ -256,7 +256,7 @@ public class NokhwaVideoDevice implements WebcamDeviceExtended {
// Init buffer if still not initialized:
this.bytesPerRow = LibNokhwa.INSTANCE.cnokhwa_frame_bytes_per_row(deviceIndex);
- final var bufferSizeBytes = bytesPerRow * resolution.height;
+ final int bufferSizeBytes = bytesPerRow * resolution.height;
this.imgBuffer = ByteBuffer.allocateDirect(bufferSizeBytes);
this.arrayByteBuffer = new byte[imgBuffer.capacity()];
@@ -297,7 +297,7 @@ public class NokhwaVideoDevice implements WebcamDeviceExtended {
new int[]{0, 1, 2}
);
- final ByteBuffer readBuffer = imgBuffer.asReadOnlyBuffer().position(0);
+ final ByteBuffer readBuffer = (ByteBuffer) imgBuffer.asReadOnlyBuffer().position(0);
readBuffer.get(arrayByteBuffer, 0, readBuffer.capacity());
final DataBuffer dataBuffer = new DataBufferByte(arrayByteBuffer, arrayByteBuffer.length);