打印摄像头支持的预览size
private int getCameraOrientation() {
if (cameraManager != null) {
try {
CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
CameraCharacteristics cameraCharacteristics = cameraManager.getCameraCharacteristics(mCameraId);
StreamConfigurationMap streamConfigurationMap = cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Size[] sizes = streamConfigurationMap.getOutputSizes(ImageReader.class);
for (Size size : sizes) {
logI("sizes " + size.toString());
}
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
return 0;
}
|