|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
|
|
|
|
public class CameraCapture extends SurfaceCapture {
|
|
|
|
|
|
|
|
|
@ -33,6 +34,8 @@ public class CameraCapture extends SurfaceCapture {
|
|
|
|
|
private CameraDevice cameraDevice;
|
|
|
|
|
private Executor cameraExecutor;
|
|
|
|
|
|
|
|
|
|
private final AtomicBoolean disconnected = new AtomicBoolean();
|
|
|
|
|
|
|
|
|
|
public CameraCapture(String cameraId, Size explicitSize) {
|
|
|
|
|
this.cameraId = cameraId;
|
|
|
|
|
this.explicitSize = explicitSize;
|
|
|
|
@ -101,7 +104,8 @@ public class CameraCapture extends SurfaceCapture {
|
|
|
|
|
@Override
|
|
|
|
|
public void onDisconnected(CameraDevice camera) {
|
|
|
|
|
Ln.w("Camera disconnected");
|
|
|
|
|
// TODO
|
|
|
|
|
disconnected.set(true);
|
|
|
|
|
requestReset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -186,4 +190,9 @@ public class CameraCapture extends SurfaceCapture {
|
|
|
|
|
throw (CameraAccessException) e.getCause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isClosed() {
|
|
|
|
|
return disconnected.get();
|
|
|
|
|
}
|
|
|
|
|
}
|