Compare commits
1 Commits
camerafpsr
...
cameraphy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f725aebc89 |
@@ -15,6 +15,7 @@ import android.util.Range;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@@ -97,34 +98,24 @@ public final class LogUtils {
|
|||||||
builder.append("\n (none)");
|
builder.append("\n (none)");
|
||||||
} else {
|
} else {
|
||||||
for (String id : cameraIds) {
|
for (String id : cameraIds) {
|
||||||
builder.append("\n --camera-id=").append(id);
|
builder.append("\n --video-source=camera --camera-id=").append(id);
|
||||||
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
|
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
|
||||||
|
|
||||||
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
|
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
|
||||||
builder.append(" (").append(getCameraFacingName(facing)).append(", ");
|
builder.append(" (").append(getCameraFacingName(facing)).append(", ");
|
||||||
|
|
||||||
Rect activeSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
|
Rect activeSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
|
||||||
builder.append(activeSize.width()).append("x").append(activeSize.height());
|
builder.append(activeSize.width()).append("x").append(activeSize.height()).append(", ");
|
||||||
|
|
||||||
try {
|
// Capture frame rates for low-FPS mode are the same for every resolution
|
||||||
// Capture frame rates for low-FPS mode are the same for every resolution
|
Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
|
||||||
Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
|
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
||||||
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
builder.append("fps=").append(uniqueLowFps).append(')');
|
||||||
builder.append(", fps=").append(uniqueLowFps);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Some devices may provide invalid ranges, causing an IllegalArgumentException "lower must be less than or equal to upper"
|
|
||||||
Ln.w("Could not get available frame rates for camera " + id, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(')');
|
|
||||||
|
|
||||||
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
|
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
|
||||||
if (Arrays.asList(capabilities).contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
|
if (Arrays.asList(capabilities).contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
|
||||||
builder.append("\n Logical multi-camera, backed by physical cameras:");
|
Set<String> phy = characteristics.getPhysicalCameraIds();
|
||||||
for (String phyId : characteristics.getPhysicalCameraIds()) {
|
builder.append("\n PHYSICAL: ").append(phy);
|
||||||
CameraCharacteristics phyCharacteristics = cameraManager.getCameraCharacteristics(phyId);
|
|
||||||
appendPhysicalCamera(builder, phyId, phyCharacteristics);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeSizes) {
|
if (includeSizes) {
|
||||||
@@ -154,13 +145,6 @@ public final class LogUtils {
|
|||||||
return builder.toString();
|
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) {
|
private static SortedSet<Integer> getUniqueSet(Range<Integer>[] ranges) {
|
||||||
SortedSet<Integer> set = new TreeSet<>();
|
SortedSet<Integer> set = new TreeSet<>();
|
||||||
for (Range<Integer> range : ranges) {
|
for (Range<Integer> range : ranges) {
|
||||||
|
|||||||
Reference in New Issue
Block a user