流程图
applySettings.png
APP 层应用参数设置
mCameraDevice.applySettings(mCameraSettings);
frameworks 层获取参数设置发送获取图像的请求
private void applyToRequest(AndroidCamera2Settings settings) {
// TODO: If invoked when in PREVIEW_READY state, a new preview size will not take effect
// 获取所有的参数设置,然后放到一个 Map 集合
// 创建捕获请求时会调用 CaptureRequest.Builder.set() 设置捕获请求的参数设置
mPersistentSettings.union(settings.getRequestSettings());
...
// If we're already previewing, reflect most settings immediately
try {
// 向相机设备发送获取图像的请求
mSession.setRepeatingRequest(
mPersistentSettings.createRequest(mCamera,
CameraDevice.TEMPLATE_PREVIEW, mPreviewSurface)/*创建一次捕获请求*/,
/*listener*/mCameraResultStateCallback, /*handler*/this);
} catch (CameraAccessException ex) {
Log.e(TAG, "Failed to apply updated request settings", ex);
}
...
}
网友评论