|
@@ -67,21 +67,21 @@ update_process_pipeline()
|
|
// Grab the latest control values
|
|
// Grab the latest control values
|
|
if (!state_io.gain.manual && state_io.gain.control) {
|
|
if (!state_io.gain.manual && state_io.gain.control) {
|
|
state_io.gain.value = mp_camera_control_get_int32(
|
|
state_io.gain.value = mp_camera_control_get_int32(
|
|
- state_io.camera, state_io.gain.control);
|
|
|
|
|
|
+ state_io.camera, state_io.gain.control, FD_TYPE_SENSOR);
|
|
}
|
|
}
|
|
|
|
|
|
if (!state_io.exposure.manual && state_io.exposure.control) {
|
|
if (!state_io.exposure.manual && state_io.exposure.control) {
|
|
state_io.exposure.value = mp_camera_control_get_int32(
|
|
state_io.exposure.value = mp_camera_control_get_int32(
|
|
- state_io.camera, state_io.exposure.control);
|
|
|
|
|
|
+ state_io.camera, state_io.exposure.control, FD_TYPE_SENSOR);
|
|
}
|
|
}
|
|
|
|
|
|
float balance_red = 1.0f;
|
|
float balance_red = 1.0f;
|
|
float balance_blue = 1.0f;
|
|
float balance_blue = 1.0f;
|
|
if (state_io.red.control && state_io.blue.control) {
|
|
if (state_io.red.control && state_io.blue.control) {
|
|
int red = mp_camera_control_get_int32(state_io.camera,
|
|
int red = mp_camera_control_get_int32(state_io.camera,
|
|
- state_io.red.control);
|
|
|
|
|
|
+ state_io.red.control, FD_TYPE_SENSOR);
|
|
int blue = mp_camera_control_get_int32(state_io.camera,
|
|
int blue = mp_camera_control_get_int32(state_io.camera,
|
|
- state_io.blue.control);
|
|
|
|
|
|
+ state_io.blue.control, FD_TYPE_SENSOR);
|
|
balance_red = (float)red / (float)state_io.red.max;
|
|
balance_red = (float)red / (float)state_io.red.max;
|
|
balance_blue = (float)blue / (float)state_io.blue.max;
|
|
balance_blue = (float)blue / (float)state_io.blue.max;
|
|
}
|
|
}
|
|
@@ -165,7 +165,7 @@ capture(MPPipeline *pipeline, const void *data)
|
|
// the value seems to be 248 which creates a 5 frame burst
|
|
// the value seems to be 248 which creates a 5 frame burst
|
|
// for manual gain you can go up to 11 frames
|
|
// for manual gain you can go up to 11 frames
|
|
state_io.gain.value =
|
|
state_io.gain.value =
|
|
- mp_camera_control_get_int32(state_io.camera, V4L2_CID_GAIN);
|
|
|
|
|
|
+ mp_camera_control_get_int32(state_io.camera, V4L2_CID_GAIN, FD_TYPE_SENSOR);
|
|
gain_norm = (float)state_io.gain.value / (float)state_io.gain.max;
|
|
gain_norm = (float)state_io.gain.value / (float)state_io.gain.max;
|
|
state_io.burst_length = (int)fmax(sqrtf(gain_norm) * 10, 2) + 1;
|
|
state_io.burst_length = (int)fmax(sqrtf(gain_norm) * 10, 2) + 1;
|
|
state_io.burst_length = MAX(1, state_io.burst_length);
|
|
state_io.burst_length = MAX(1, state_io.burst_length);
|
|
@@ -257,7 +257,8 @@ update_controls()
|
|
state_io.gain.value != state_io.gain.value_req) {
|
|
state_io.gain.value != state_io.gain.value_req) {
|
|
mp_camera_control_set_int32_bg(mpcamera,
|
|
mp_camera_control_set_int32_bg(mpcamera,
|
|
state_io.gain.control,
|
|
state_io.gain.control,
|
|
- state_io.gain.value_req);
|
|
|
|
|
|
+ state_io.gain.value_req,
|
|
|
|
+ FD_TYPE_SENSOR);
|
|
state_io.gain.value = state_io.gain.value_req;
|
|
state_io.gain.value = state_io.gain.value_req;
|
|
state_changed = true;
|
|
state_changed = true;
|
|
}
|
|
}
|
|
@@ -276,7 +277,8 @@ update_controls()
|
|
state_io.exposure.value != state_io.exposure.value_req) {
|
|
state_io.exposure.value != state_io.exposure.value_req) {
|
|
mp_camera_control_set_int32_bg(mpcamera,
|
|
mp_camera_control_set_int32_bg(mpcamera,
|
|
state_io.exposure.control,
|
|
state_io.exposure.control,
|
|
- state_io.exposure.value_req);
|
|
|
|
|
|
+ state_io.exposure.value_req,
|
|
|
|
+ FD_TYPE_SENSOR);
|
|
state_io.exposure.value = state_io.exposure.value_req;
|
|
state_io.exposure.value = state_io.exposure.value_req;
|
|
state_changed = true;
|
|
state_changed = true;
|
|
}
|
|
}
|
|
@@ -387,7 +389,8 @@ on_frame(MPBuffer buffer, void *_data)
|
|
mp_camera_control_set_int32_bg(
|
|
mp_camera_control_set_int32_bg(
|
|
mpcamera,
|
|
mpcamera,
|
|
V4L2_CID_EXPOSURE_AUTO,
|
|
V4L2_CID_EXPOSURE_AUTO,
|
|
- V4L2_EXPOSURE_AUTO);
|
|
|
|
|
|
+ V4L2_EXPOSURE_AUTO,
|
|
|
|
+ FD_TYPE_SENSOR);
|
|
}
|
|
}
|
|
|
|
|
|
if (!state_io.gain.manual) {
|
|
if (!state_io.gain.manual) {
|
|
@@ -419,14 +422,14 @@ static void
|
|
init_controls()
|
|
init_controls()
|
|
{
|
|
{
|
|
if (mp_camera_query_control(
|
|
if (mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_FOCUS_ABSOLUTE, NULL)) {
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_FOCUS_ABSOLUTE, NULL, FD_TYPE_SENSOR)) {
|
|
// TODO: Set focus state
|
|
// TODO: Set focus state
|
|
state_io.focus.control = V4L2_CID_FOCUS_ABSOLUTE;
|
|
state_io.focus.control = V4L2_CID_FOCUS_ABSOLUTE;
|
|
} else {
|
|
} else {
|
|
state_io.focus.control = 0;
|
|
state_io.focus.control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if (mp_camera_query_control(state_io.camera, V4L2_CID_FOCUS_AUTO, NULL)) {
|
|
|
|
|
|
+ if (mp_camera_query_control(state_io.camera, V4L2_CID_FOCUS_AUTO, NULL, FD_TYPE_SENSOR)) {
|
|
mp_camera_control_set_bool_bg(
|
|
mp_camera_control_set_bool_bg(
|
|
mpcamera, V4L2_CID_FOCUS_AUTO, true);
|
|
mpcamera, V4L2_CID_FOCUS_AUTO, true);
|
|
state_io.focus.auto_control = V4L2_CID_FOCUS_AUTO;
|
|
state_io.focus.auto_control = V4L2_CID_FOCUS_AUTO;
|
|
@@ -435,14 +438,14 @@ init_controls()
|
|
}
|
|
}
|
|
|
|
|
|
state_io.can_af_trigger = mp_camera_query_control(
|
|
state_io.can_af_trigger = mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_AUTO_FOCUS_START, NULL);
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_AUTO_FOCUS_START, NULL, FD_TYPE_SENSOR);
|
|
|
|
|
|
MPControl control;
|
|
MPControl control;
|
|
- if (mp_camera_query_control(state_io.camera, V4L2_CID_GAIN, &control)) {
|
|
|
|
|
|
+ if (mp_camera_query_control(state_io.camera, V4L2_CID_GAIN, &control, FD_TYPE_SENSOR)) {
|
|
state_io.gain.control = V4L2_CID_GAIN;
|
|
state_io.gain.control = V4L2_CID_GAIN;
|
|
state_io.gain.max = control.max;
|
|
state_io.gain.max = control.max;
|
|
} else if (mp_camera_query_control(
|
|
} else if (mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_ANALOGUE_GAIN, &control)) {
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_ANALOGUE_GAIN, &control, FD_TYPE_SENSOR)) {
|
|
state_io.gain.control = V4L2_CID_ANALOGUE_GAIN;
|
|
state_io.gain.control = V4L2_CID_ANALOGUE_GAIN;
|
|
state_io.gain.max = control.max;
|
|
state_io.gain.max = control.max;
|
|
} else {
|
|
} else {
|
|
@@ -451,12 +454,12 @@ init_controls()
|
|
}
|
|
}
|
|
if (state_io.gain.control) {
|
|
if (state_io.gain.control) {
|
|
state_io.gain.value = mp_camera_control_get_int32(
|
|
state_io.gain.value = mp_camera_control_get_int32(
|
|
- state_io.camera, state_io.gain.control);
|
|
|
|
|
|
+ state_io.camera, state_io.gain.control, FD_TYPE_SENSOR);
|
|
} else {
|
|
} else {
|
|
state_io.gain.value = 0;
|
|
state_io.gain.value = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if (mp_camera_query_control(state_io.camera, V4L2_CID_AUTOGAIN, &control)) {
|
|
|
|
|
|
+ if (mp_camera_query_control(state_io.camera, V4L2_CID_AUTOGAIN, &control, FD_TYPE_SENSOR)) {
|
|
state_io.gain.auto_control = V4L2_CID_AUTOGAIN;
|
|
state_io.gain.auto_control = V4L2_CID_AUTOGAIN;
|
|
state_io.gain.manual =
|
|
state_io.gain.manual =
|
|
mp_camera_control_get_bool(state_io.camera,
|
|
mp_camera_control_get_bool(state_io.camera,
|
|
@@ -465,29 +468,29 @@ init_controls()
|
|
state_io.gain.auto_control = 0;
|
|
state_io.gain.auto_control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if (mp_camera_query_control(state_io.camera, V4L2_CID_EXPOSURE, &control)) {
|
|
|
|
|
|
+ if (mp_camera_query_control(state_io.camera, V4L2_CID_EXPOSURE, &control, FD_TYPE_SENSOR)) {
|
|
state_io.exposure.control = V4L2_CID_EXPOSURE;
|
|
state_io.exposure.control = V4L2_CID_EXPOSURE;
|
|
state_io.exposure.max = control.max;
|
|
state_io.exposure.max = control.max;
|
|
state_io.exposure.value = mp_camera_control_get_int32(
|
|
state_io.exposure.value = mp_camera_control_get_int32(
|
|
- state_io.camera, V4L2_CID_EXPOSURE);
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_EXPOSURE, FD_TYPE_SENSOR);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
state_io.exposure.control = 0;
|
|
state_io.exposure.control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
if (mp_camera_query_control(
|
|
if (mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_EXPOSURE_AUTO, &control)) {
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_EXPOSURE_AUTO, &control, FD_TYPE_SENSOR)) {
|
|
state_io.exposure.auto_control = V4L2_CID_EXPOSURE_AUTO;
|
|
state_io.exposure.auto_control = V4L2_CID_EXPOSURE_AUTO;
|
|
state_io.exposure.manual =
|
|
state_io.exposure.manual =
|
|
mp_camera_control_get_int32(state_io.camera,
|
|
mp_camera_control_get_int32(state_io.camera,
|
|
- V4L2_CID_EXPOSURE_AUTO) ==
|
|
|
|
|
|
+ V4L2_CID_EXPOSURE_AUTO, FD_TYPE_SENSOR) ==
|
|
V4L2_EXPOSURE_MANUAL;
|
|
V4L2_EXPOSURE_MANUAL;
|
|
} else {
|
|
} else {
|
|
state_io.exposure.auto_control = 0;
|
|
state_io.exposure.auto_control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
if (mp_camera_query_control(
|
|
if (mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_RED_BALANCE, &control)) {
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_RED_BALANCE, &control, FD_TYPE_SENSOR)) {
|
|
state_io.red.control = V4L2_CID_RED_BALANCE;
|
|
state_io.red.control = V4L2_CID_RED_BALANCE;
|
|
state_io.red.max = control.max;
|
|
state_io.red.max = control.max;
|
|
} else {
|
|
} else {
|
|
@@ -495,7 +498,7 @@ init_controls()
|
|
}
|
|
}
|
|
|
|
|
|
if (mp_camera_query_control(
|
|
if (mp_camera_query_control(
|
|
- state_io.camera, V4L2_CID_BLUE_BALANCE, &control)) {
|
|
|
|
|
|
+ state_io.camera, V4L2_CID_BLUE_BALANCE, &control, FD_TYPE_SENSOR)) {
|
|
state_io.blue.control = V4L2_CID_BLUE_BALANCE;
|
|
state_io.blue.control = V4L2_CID_BLUE_BALANCE;
|
|
state_io.blue.max = control.max;
|
|
state_io.blue.max = control.max;
|
|
} else {
|
|
} else {
|