|
|
|
@ -117,6 +117,7 @@ NdkCamera::NdkCamera(int32_t width, int32_t height, const NdkCamera::CAMERA_PARA
|
|
|
|
|
|
|
|
|
|
m_imagesCaptured = ~0;
|
|
|
|
|
|
|
|
|
|
maxFrameDuration = 0;
|
|
|
|
|
afSupported = false;
|
|
|
|
|
awbMode = ACAMERA_CONTROL_AWB_MODE_AUTO;
|
|
|
|
|
aeLockAvailable = false;
|
|
|
|
@ -483,6 +484,12 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry e = {0};
|
|
|
|
|
status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_SENSOR_INFO_MAX_FRAME_DURATION, &e);
|
|
|
|
|
maxFrameDuration = (status == ACAMERA_OK) ? *e.data.i64 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry val = {0};
|
|
|
|
|
status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE, &val);
|
|
|
|
@ -587,6 +594,9 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
status = ACaptureRequest_setEntry_i32(capture_request, ACAMERA_CONTROL_AE_TARGET_FPS_RANGE,2,fpsRange);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t ctrlMode = sceneModeSupported ? ACAMERA_CONTROL_MODE_USE_SCENE_MODE : ACAMERA_CONTROL_MODE_AUTO;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_MODE, 1, &ctrlMode);
|
|
|
|
|
|
|
|
|
|
uint8_t flashMode = ACAMERA_FLASH_MODE_OFF;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_FLASH_MODE, 1, &flashMode);
|
|
|
|
|
|
|
|
|
@ -730,6 +740,10 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
status = ACaptureRequest_setEntry_i64(capture_request, ACAMERA_SENSOR_EXPOSURE_TIME, 1, &exposureTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64_t frameDuration = maxFrameDuration / 2;
|
|
|
|
|
status = ACaptureRequest_setEntry_i64(capture_request, ACAMERA_SENSOR_FRAME_DURATION, 1, &frameDuration);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// TODO:
|
|
|
|
|
// m_imagesCaptured = 0;
|
|
|
|
@ -951,11 +965,19 @@ void NdkCamera::onImageAvailable(AImageReader* reader)
|
|
|
|
|
// XYLOG(XYLOG_SEVERITY_DEBUG, "m_imagesCaptured=%u wait for next image", m_imagesCaptured);
|
|
|
|
|
// Not Ready Or Taken
|
|
|
|
|
AImage_delete(image);
|
|
|
|
|
/* if (m_imagesCaptured != ~0)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "Skip Image index=%u", m_imagesCaptured);
|
|
|
|
|
m_imagesCaptured++;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mResult.duration = GetMicroTimeStamp() - m_startTime;
|
|
|
|
|
|
|
|
|
|
mFinalResult = mResult;
|
|
|
|
|
|
|
|
|
|
int32_t format;
|
|
|
|
|
AImage_getFormat(image, &format);
|
|
|
|
|
|
|
|
|
@ -1408,12 +1430,20 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
int64_t exTime = (status == ACAMERA_OK) ? val.data.i64[0] : -1;
|
|
|
|
|
mResult.exposureTime = exTime;
|
|
|
|
|
|
|
|
|
|
val = {0};
|
|
|
|
|
status = ACameraMetadata_getConstEntry(result, ACAMERA_CONTROL_AF_MODE, &val);
|
|
|
|
|
mResult.autoFocus = (status == ACAMERA_OK) ? *(val.data.u8) : 0;
|
|
|
|
|
|
|
|
|
|
val = { 0 };
|
|
|
|
|
status = ACameraMetadata_getConstEntry(result, ACAMERA_CONTROL_AE_MODE, &val);
|
|
|
|
|
uint8_t aeMode = (status == ACAMERA_OK) ? val.data.u8[0] : 0;
|
|
|
|
|
// ACaptureRequest_setEntry_i32(capture_request, ACAMERA_SENSOR_SENSITIVITY, 1, &sensitivity_);
|
|
|
|
|
mResult.autoExposure = aeMode;
|
|
|
|
|
|
|
|
|
|
val = { 0 };
|
|
|
|
|
status = ACameraMetadata_getConstEntry(result, ACAMERA_SENSOR_FRAME_DURATION, &val);
|
|
|
|
|
int64_t frameDuration = (status == ACAMERA_OK) ? val.data.i64[0] : 0;
|
|
|
|
|
mResult.frameDuration = frameDuration;
|
|
|
|
|
|
|
|
|
|
val = { 0 };
|
|
|
|
|
float focusDistance = NAN;
|
|
|
|
|
if (afSupported && (m_params.autoFocus != 0))
|
|
|
|
|