本讲是android camera native framework专题的第15讲,我们介绍cameraserver进程启动之与cameraid和cameradevice相关变量梳理。
更多资源:
资源 | 描述 |
---|---|
在线课程 | |
知识星球 | 星球名称:深入浅出android camera 星球id: 17296815 |
极客笔记圈 |
cameraprovidermanager与camera id和device相关的变量梳理
相关代码(来自android 13)
frameworks\av\services\camera\libcameraservice\common\cameraprovidermanager.h
std::vector> mproviders;
struct providerinfo : public virtual refbase {
std::vector> mdevices;
std::unordered_set muniquecameraids;
std::vector muniqueapi1compatiblecameraids;
// the initial public camera ids published by the camera provider.
// currently logical multi-camera is not supported for hot-plug camera.
// and we use this list to keep track of initial public camera ids
// advertised by the provider, and to distinguish against "hidden"
// physical camera ids.
std::vector mproviderpubliccameraids;
struct deviceinfo {
const std::vector& mpubliccameraids;
}
}
cameraservice与camera id和device相关的变量梳理
cameraservice | cameraprovidermanager |
---|---|
mnumberofcameras mnumberofcameraswithoutsystemcamera |
所有provider的muniquecameraids总和 |
mnormaldeviceids mnormaldeviceidswithoutsystemcamera |
所有provider的muniqueapi1compatiblecameraids总和,剔除hidden_secure_camera,针对logical multi-cam每个facing只暴露一个logical camera id出去 |
mcamerastates(camera id -> camera state) | logical device的ondevicestatuschanged |
mtorchstatusmap(camera id -> torch status) -removestates做remove -addstates做add | logical device的ondevicestatuschanged |
mperfclassprimarycameraids – 参考mnormaldeviceidswithoutsystemcamera | muniquecameraids |
代码逻辑请参考视频讲解(来自android 13)
// number of camera devices (excluding hidden secure cameras)
int mnumberofcameras;
// number of camera devices (excluding hidden secure cameras and
// system cameras)
int mnumberofcameraswithoutsystemcamera;
std::vector mnormaldeviceids;
std::vector mnormaldeviceidswithoutsystemcamera;
std::set mperfclassprimarycameraids;
// mapping from camera id -> state for each device, map is protected by mcamerastateslock
std::map> mcamerastates;
// camera id -> torch status
keyedvector mtorchstatusmap;