…lines 1–23 unchanged (23 lines)
24 private Rect crop;
25 private boolean control = true;
26 private int displayId;
27 private String cameraId;
28 private Size cameraSize;
29 private CameraFacing cameraFacing;
30 private CameraAspectRatio cameraAspectRatio;
31 private boolean showTouches;
32 private boolean stayAwake;
33 private List<CodecOption> videoCodecOptions;
34 private List<CodecOption> audioCodecOptions;
35
36 private String videoEncoder;
…lines 37–128 unchanged (92 lines)
129 }
130
131 public CameraFacing getCameraFacing() {
132 return cameraFacing;
133 }
134
135 public CameraAspectRatio getCameraAspectRatio() {
136 return cameraAspectRatio;
137 }
138
139 public boolean getShowTouches() {
140 return showTouches;
141 }
142
143 public boolean getStayAwake() {
…lines 144–375 unchanged (232 lines)
376 if (facing == null) {
377 throw new IllegalArgumentException("Camera facing " + value + " not supported");
378 }
379 options.cameraFacing = facing;
380 }
381 break;
382 case "camera_ar":
383 if (!value.isEmpty()) {
384 options.cameraAspectRatio = parseCameraAspectRatio(value);
385 }
386 break;
387 case "send_device_meta":
388 options.sendDeviceMeta = Boolean.parseBoolean(value);
389 break;
390 case "send_frame_meta":
391 options.sendFrameMeta = Boolean.parseBoolean(value);
392 break;
…lines 393–434 unchanged (42 lines)
435 }
436 int width = Integer.parseInt(tokens[0]);
437 int height = Integer.parseInt(tokens[1]);
438 return new Size(width, height);
439 }
440
441 private static CameraAspectRatio parseCameraAspectRatio(String ar) {
442 if ("sensor".equals(ar)) {
443 return CameraAspectRatio.sensorAspectRatio();
444 }
445
446 String[] tokens = ar.split(":");
447 if (tokens.length == 2) {
448 int w = Integer.parseInt(tokens[0]);
449 int h = Integer.parseInt(tokens[1]);
450 return CameraAspectRatio.fromFraction(w, h);
451 }
452
453 float floatAr = Float.parseFloat(tokens[0]);
454 return CameraAspectRatio.fromFloat(floatAr);
455 }
456}
457