|
|
|
@ -128,7 +128,8 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
ACameraIdList *camera_id_list = 0;
|
|
|
|
|
ACameraManager_getCameraIdList(camera_manager, &camera_id_list);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < camera_id_list->numCameras; ++i) {
|
|
|
|
|
for (int i = 0; i < camera_id_list->numCameras; ++i)
|
|
|
|
|
{
|
|
|
|
|
const char *id = camera_id_list->cameraIds[i];
|
|
|
|
|
if (cameraId.compare(id) != 0) {
|
|
|
|
|
continue;
|
|
|
|
@ -146,18 +147,6 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
camera_facing = facing;
|
|
|
|
|
|
|
|
|
|
// if (camera_facing == 0 && facing != ACAMERA_LENS_FACING_FRONT)
|
|
|
|
|
{
|
|
|
|
|
// ACameraMetadata_free(camera_metadata);
|
|
|
|
|
// continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (camera_facing == 1 && facing != ACAMERA_LENS_FACING_BACK)
|
|
|
|
|
{
|
|
|
|
|
// ACameraMetadata_free(camera_metadata);
|
|
|
|
|
// continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
camera_id = cameraId;
|
|
|
|
|
camera_id.assign(id, strlen(id));
|
|
|
|
|
|
|
|
|
@ -174,23 +163,25 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry e = {0};
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, &e);
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, &e);
|
|
|
|
|
// format of the data: format, width, height, input?, type int32
|
|
|
|
|
|
|
|
|
|
// DisplayDimension foundRes(4000, 4000);
|
|
|
|
|
// DisplayDimension maxJPG(0, 0);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < e.count; i += 4) {
|
|
|
|
|
for (int i = 0; i < e.count; i += 4)
|
|
|
|
|
{
|
|
|
|
|
int32_t input = e.data.i32[i + 3];
|
|
|
|
|
int32_t format = e.data.i32[i + 0];
|
|
|
|
|
if (input) continue;
|
|
|
|
|
|
|
|
|
|
if (format == AIMAGE_FORMAT_YUV_420_888 || format == AIMAGE_FORMAT_JPEG) {
|
|
|
|
|
if (format == AIMAGE_FORMAT_YUV_420_888 || format == AIMAGE_FORMAT_JPEG)
|
|
|
|
|
{
|
|
|
|
|
DisplayDimension res(e.data.i32[i + 1], e.data.i32[i + 2]);
|
|
|
|
|
if (!disp.IsSameRatio(res)) continue;
|
|
|
|
|
|
|
|
|
|
if (format == AIMAGE_FORMAT_YUV_420_888 && res > disp) {
|
|
|
|
|
if (format == AIMAGE_FORMAT_YUV_420_888 && res > disp)
|
|
|
|
|
{
|
|
|
|
|
foundIt = true;
|
|
|
|
|
foundRes = res;
|
|
|
|
|
}/* else if (format == AIMAGE_FORMAT_JPEG && res > maxJPG) {
|
|
|
|
@ -198,32 +189,33 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry e = {0};
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_CONTROL_AF_AVAILABLE_MODES, &e);
|
|
|
|
|
afSupported = !(e.count == 0 || (e.count == 1 && e.data.u8[0] == ACAMERA_CONTROL_AF_MODE_OFF));
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_CONTROL_AF_AVAILABLE_MODES, &e);
|
|
|
|
|
afSupported = (status == ACAMERA_OK) && !(e.count == 0 || (e.count == 1 && e.data.u8[0] == ACAMERA_CONTROL_AF_MODE_OFF));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry val = {0};
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE,
|
|
|
|
|
&val);
|
|
|
|
|
if (status == ACAMERA_OK) {
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE, &val);
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
{
|
|
|
|
|
exposureRange.min_ = val.data.i64[0];
|
|
|
|
|
if (exposureRange.min_ < kMinExposureTime) {
|
|
|
|
|
if (exposureRange.min_ < kMinExposureTime)
|
|
|
|
|
{
|
|
|
|
|
exposureRange.min_ = kMinExposureTime;
|
|
|
|
|
}
|
|
|
|
|
exposureRange.max_ = val.data.i64[1];
|
|
|
|
|
if (exposureRange.max_ > kMaxExposureTime) {
|
|
|
|
|
if (exposureRange.max_ > kMaxExposureTime)
|
|
|
|
|
{
|
|
|
|
|
exposureRange.max_ = kMaxExposureTime;
|
|
|
|
|
}
|
|
|
|
|
// exposureTime = exposureRange.value(2);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ALOGW("Unsupported ACAMERA_SENSOR_INFO_EXPOSURE_TIME_RANGE");
|
|
|
|
|
exposureRange.min_ = exposureRange.max_ = 0l;
|
|
|
|
|
// exposureTime_ = 0l;
|
|
|
|
@ -232,14 +224,14 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry val = {0};
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_CONTROL_AE_COMPENSATION_RANGE,
|
|
|
|
|
&val);
|
|
|
|
|
if (status == ACAMERA_OK) {
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata, ACAMERA_CONTROL_AE_COMPENSATION_RANGE, &val);
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
{
|
|
|
|
|
aeCompensationRange.min_ = val.data.i32[0];
|
|
|
|
|
aeCompensationRange.max_ = val.data.i32[1];
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ALOGW("Unsupported ACAMERA_CONTROL_AE_COMPENSATION_RANGE");
|
|
|
|
|
aeCompensationRange.min_ = aeCompensationRange.max_ = 0l;
|
|
|
|
|
}
|
|
|
|
@ -247,39 +239,38 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry val = {0};
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE,
|
|
|
|
|
&val);
|
|
|
|
|
|
|
|
|
|
if (status == ACAMERA_OK) {
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE, &val);
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
{
|
|
|
|
|
sensitivityRange.min_ = val.data.i32[0];
|
|
|
|
|
sensitivityRange.max_ = val.data.i32[1];
|
|
|
|
|
|
|
|
|
|
// sensitivity = sensitivityRange.value(2);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ALOGW("failed for ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE");
|
|
|
|
|
sensitivityRange.min_ = sensitivityRange.max_ = 0;
|
|
|
|
|
// sensitivity_ = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
ACameraMetadata_const_entry e = {0};
|
|
|
|
|
ACameraMetadata_getConstEntry(camera_metadata,
|
|
|
|
|
ACAMERA_CONTROL_AVAILABLE_SCENE_MODES, &e);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < e.count; i++) {
|
|
|
|
|
if (ACAMERA_CONTROL_SCENE_MODE_HDR == e.data.u8[i]) {
|
|
|
|
|
camera_status_t status = ACameraMetadata_getConstEntry(camera_metadata,ACAMERA_CONTROL_AVAILABLE_SCENE_MODES, &e);
|
|
|
|
|
for (int i = 0; i < e.count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (ACAMERA_CONTROL_SCENE_MODE_HDR == e.data.u8[i])
|
|
|
|
|
{
|
|
|
|
|
hdrSupported = true;
|
|
|
|
|
break;
|
|
|
|
|
} else if (ACAMERA_CONTROL_SCENE_MODE_NIGHT == e.data.u8[i]) {
|
|
|
|
|
}
|
|
|
|
|
else if (ACAMERA_CONTROL_SCENE_MODE_NIGHT == e.data.u8[i])
|
|
|
|
|
{
|
|
|
|
|
nightModeSupported = true;
|
|
|
|
|
} else if (ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT == e.data.u8[i]) {
|
|
|
|
|
}
|
|
|
|
|
else if (ACAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT == e.data.u8[i])
|
|
|
|
|
{
|
|
|
|
|
nightPortraitModeSupported = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ACameraMetadata_free(camera_metadata);
|
|
|
|
@ -295,7 +286,12 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: PATCH!!!!
|
|
|
|
|
if (camera_id == "1") {
|
|
|
|
|
if (camera_id == "0")
|
|
|
|
|
{
|
|
|
|
|
afSupported = true;
|
|
|
|
|
}
|
|
|
|
|
if (camera_id == "1")
|
|
|
|
|
{
|
|
|
|
|
camera_facing = 1;
|
|
|
|
|
}
|
|
|
|
|
if (camera_id == "2")
|
|
|
|
@ -360,13 +356,11 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
|
|
|
|
|
if (m_params.sensibility > 0) {
|
|
|
|
|
int32_t sensitivity = m_params.sensibility;
|
|
|
|
|
res = ACaptureRequest_setEntry_i32(capture_request, ACAMERA_SENSOR_SENSITIVITY, 1,
|
|
|
|
|
&sensitivity);
|
|
|
|
|
res = ACaptureRequest_setEntry_i32(capture_request, ACAMERA_SENSOR_SENSITIVITY, 1, &sensitivity);
|
|
|
|
|
}
|
|
|
|
|
if (m_params.exposureTime > 0) {
|
|
|
|
|
int64_t exposureTime = m_params.exposureTime * 1000000;
|
|
|
|
|
res = ACaptureRequest_setEntry_i64(capture_request, ACAMERA_SENSOR_EXPOSURE_TIME, 1,
|
|
|
|
|
&exposureTime);
|
|
|
|
|
res = ACaptureRequest_setEntry_i64(capture_request, ACAMERA_SENSOR_EXPOSURE_TIME, 1, &exposureTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|