mirror of https://github.com/Genymobile/scrcpy
Add --camera-facing
Add an option to select the camera by its lens facing (front, back or external). PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213> Co-authored-by: Romain Vimont <rom@rom1v.com> Signed-off-by: Romain Vimont <rom@rom1v.com>camera.37
parent
7f8d079c8c
commit
faebb7d70a
@ -0,0 +1,33 @@
|
||||
package com.genymobile.scrcpy;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
|
||||
public enum CameraFacing {
|
||||
FRONT("front", CameraCharacteristics.LENS_FACING_FRONT),
|
||||
BACK("back", CameraCharacteristics.LENS_FACING_BACK),
|
||||
@SuppressLint("InlinedApi") // introduced in API 23
|
||||
EXTERNAL("external", CameraCharacteristics.LENS_FACING_EXTERNAL);
|
||||
|
||||
private final String name;
|
||||
private final int value;
|
||||
|
||||
CameraFacing(String name, int value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
int value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
static CameraFacing findByName(String name) {
|
||||
for (CameraFacing facing : CameraFacing.values()) {
|
||||
if (name.equals(facing.name)) {
|
||||
return facing;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue