前面说了hw_get_module和camhal3entry,camchi的交互
下面详细看一下部分细节:
1.我一直好奇的sensorInfo怎么来的
调用过程:
CameraModule::init()过程
chi_get_num_cameras
ExtensionModule::EnumerateCameras
ChiGetCameraInfo
ChiContext::GetCameraInfo
比较重要的函数:
以前一直分不清各种cameraId,特意留意一下
这里cameraId是按照sensorId来遍历
InitializeStaticMetadata(cameraId, pCameraInfo)它从 m_pHwEnvironment->GetCameraInfo获得cameraInfo
CameraInfo* pCameraInfo = static_cast<CameraInfo*>(pChiCameraInfo->pLegacy);
pImageSensorData->GetSensorStaticCapability(&staticCaps, cameraId);获得sensor的一些特性
m_sensorInfoTable[cameraID].pData //这个应该是由com.qti.sensormodule.***.bin来的
CamxResult ChiContext::GetCameraInfo(
UINT32 cameraId,
ChiCameraInfo* pCameraInfo)
{
CamxResult result = CamxResultSuccess;
if ((NULL != pCameraInfo) && (cameraId < GetNumCameras()))
{
result = InitializeStaticMetadata(cameraId, pCameraInfo);
ImageSensorModuleData* pImageSensorModuleData =
// NOWHINE CP036a: Since the function is const, had to add the const_cast
const_cast<ImageSensorModuleData*>(m_pHwEnvironment->GetImageSensorModuleData(cameraId));
ImageSensorData* pImageSensorData = pImageSensorModuleData->GetSensorDataObject();
const ResolutionInformation* pResolutionInfo = pImageSensorData->GetResolutionInfo();
pCameraInfo->numSensorModes = pResolutionInfo->resolutionDataCount;
SensorModuleStaticCaps staticCaps = { 0 };
pImageSensorData->GetSensorStaticCapability(&staticCaps, cameraId);
pCameraInfo->sensorCaps.pixelSize = staticCaps.pixelSize;
pCameraInfo->sensorCaps.activeArray.left = staticCaps.activeArraySize.xMin;
pCameraInfo->sensorCaps.activeArray.top = staticCaps.activeArraySize.yMin;
pCameraInfo->sensorCaps.activeArray.width = staticCaps.activeArraySize.width;
pCameraInfo->sensorCaps.activeArray.height = staticCaps.activeArraySize.height;
pCameraInfo->sensorCaps.pRawOTPData = staticCaps.OTPData.EEPROMInfo.rawOTPData.pRawData;
pCameraInfo->sensorCaps.rawOTPDataSize = staticCaps.OTPData.EEPROMInfo.rawOTPData.rawDataSize;
pCameraInfo->sensorCaps.size = sizeof(CHISENSORCAPS);
pCameraInfo->sensorCaps.pSensorName = staticCaps.pSensorName;
if (NULL != pImageSensorModuleData->GetLensInfo())
{
pCameraInfo->lensCaps.focalLength = static_cast<FLOAT>(pImageSensorModuleData->GetLensInfo()->focalLength);
pCameraInfo->lensCaps.horViewAngle = static_cast<FLOAT>(pImageSensorModuleData->GetLensInfo()->horizontalViewAngle);
}
pCameraInfo->lensCaps.size = sizeof(CHILENSCAPS);
pCameraInfo->lensCaps.isFixedFocus = (pImageSensorModuleData->GetActuatorDataObject() == NULL) ? TRUE : FALSE;
pCameraInfo->size = sizeof(CHICAMERAINFO);
}
else
{
CAMX_LOG_WARN(CamxLogGroupHAL,
"Invalid arguments cameraId = %d, m_numImageSensors = %d, pCameraInfo = %p",
cameraId,
GetNumCameras(),
pCameraInfo);
result = CamxResultEInvalidArg;
}
return result;
}
接前两篇文章,初步分析了LegacyCameraProviderImpl_2_4::initialize