Compare commits

..

2 Commits

Author SHA1 Message Date
Romain Vimont
ad8ced5b1e Log physical cameras 2023-11-05 12:16:14 +01:00
Romain Vimont
36b17ee068 Simplify --list-cameras ouptut
Remove --video-source=camera from the output of --list-cameras (this is
implicit).
2023-11-05 11:52:33 +01:00

View File

@@ -15,7 +15,6 @@ import android.util.Range;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -98,7 +97,7 @@ public final class LogUtils {
builder.append("\n (none)");
} else {
for (String id : cameraIds) {
builder.append("\n --video-source=camera --camera-id=").append(id);
builder.append("\n --camera-id=").append(id);
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
@@ -114,8 +113,11 @@ public final class LogUtils {
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
if (Arrays.asList(capabilities).contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
Set<String> phy = characteristics.getPhysicalCameraIds();
builder.append("\n PHYSICAL: ").append(phy);
builder.append("\n Logical multi-camera, backed by physical cameras:");
for (String phyId : characteristics.getPhysicalCameraIds()) {
CameraCharacteristics phyCharacteristics = cameraManager.getCameraCharacteristics(phyId);
appendPhysicalCamera(builder, phyId, phyCharacteristics);
}
}
if (includeSizes) {
@@ -145,6 +147,13 @@ public final class LogUtils {
return builder.toString();
}
private static void appendPhysicalCamera(StringBuilder builder, String id, CameraCharacteristics characteristics) {
builder.append("\n --camera-id=").append(id).append(" (");
Rect activeSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
builder.append(activeSize.width()).append("x").append(activeSize.height()).append(")");
}
private static SortedSet<Integer> getUniqueSet(Range<Integer>[] ranges) {
SortedSet<Integer> set = new TreeSet<>();
for (Range<Integer> range : ranges) {