removed video mode filter and added pixel format name to the resolution list

This commit is contained in:
ori agranat
2019-10-04 20:17:05 +03:00
parent 259753e582
commit 285125cc22
2 changed files with 2 additions and 3 deletions

View File

@@ -80,8 +80,7 @@ public class Camera {
var initTimeMs = (System.nanoTime() - initTimeout) / 1e6;
System.out.printf("Camera initialized in %.2fms\n", initTimeMs);
}
var trueVideoModes = UsbCam.enumerateVideoModes();
availableVideoModes = Arrays.stream(trueVideoModes).filter(v -> v.fps >= MINIMUM_FPS && v.width >= MINIMUM_WIDTH && v.height >= MINIMUM_HEIGHT && v.pixelFormat == VideoMode.PixelFormat.kYUYV).toArray(VideoMode[]::new);
availableVideoModes = UsbCam.enumerateVideoModes();
if (availableVideoModes.length == 0) {
System.err.println("Camera not supported!");
throw new RuntimeException(new CameraException(CameraException.CameraExceptionType.BAD_CAMERA));

View File

@@ -121,7 +121,7 @@ public class CameraManager {
public static List<String> getResolutionList() throws CameraException {
if (!SettingsManager.GeneralSettings.curr_camera.equals("")) {
return Arrays.stream(CameraManager.getCamera(SettingsManager.GeneralSettings.curr_camera).getAvailableVideoModes())
.map(res -> String.format("%s X %s at %s fps", res.width, res.height, res.fps)).collect(Collectors.toList());
.map(res -> String.format("%s X %s at %s fps using %s ", res.width, res.height, res.fps, res.pixelFormat.toString())).collect(Collectors.toList());
}
throw new CameraException(CameraException.CameraExceptionType.NO_CAMERA);
}