|
@@ -83,21 +83,24 @@ update_process_pipeline()
|
|
.device_rotation = state_io.device_rotation,
|
|
.device_rotation = state_io.device_rotation,
|
|
|
|
|
|
.gain.control = state_io.gain.control,
|
|
.gain.control = state_io.gain.control,
|
|
|
|
+ .gain.auto_control = state_io.gain.auto_control,
|
|
.gain.value = state_io.gain.value,
|
|
.gain.value = state_io.gain.value,
|
|
.gain.max = state_io.gain.max,
|
|
.gain.max = state_io.gain.max,
|
|
.gain.manual = state_io.gain.manual,
|
|
.gain.manual = state_io.gain.manual,
|
|
|
|
|
|
.exposure.control = state_io.exposure.control,
|
|
.exposure.control = state_io.exposure.control,
|
|
|
|
+ .exposure.auto_control = state_io.exposure.auto_control,
|
|
.exposure.value = state_io.exposure.value,
|
|
.exposure.value = state_io.exposure.value,
|
|
.exposure.max = state_io.exposure.max,
|
|
.exposure.max = state_io.exposure.max,
|
|
.exposure.manual = state_io.exposure.manual,
|
|
.exposure.manual = state_io.exposure.manual,
|
|
|
|
|
|
.focus.control = state_io.focus.control,
|
|
.focus.control = state_io.focus.control,
|
|
|
|
+ .focus.auto_control = state_io.focus.auto_control,
|
|
.focus.value = state_io.focus.value,
|
|
.focus.value = state_io.focus.value,
|
|
.focus.max = state_io.focus.max,
|
|
.focus.max = state_io.focus.max,
|
|
.focus.manual = state_io.focus.manual,
|
|
.focus.manual = state_io.focus.manual,
|
|
|
|
|
|
- .balance = {balance_red, 1.0f, balance_blue},
|
|
|
|
|
|
+ .balance = { balance_red, 1.0f, balance_blue },
|
|
};
|
|
};
|
|
|
|
|
|
struct mp_process_pipeline_state pipeline_state = {
|
|
struct mp_process_pipeline_state pipeline_state = {
|
|
@@ -359,6 +362,9 @@ init_controls()
|
|
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)) {
|
|
mp_camera_control_set_bool_bg(
|
|
mp_camera_control_set_bool_bg(
|
|
state_io.camera, V4L2_CID_FOCUS_AUTO, true);
|
|
state_io.camera, V4L2_CID_FOCUS_AUTO, true);
|
|
|
|
+ state_io.focus.auto_control = V4L2_CID_FOCUS_AUTO;
|
|
|
|
+ } else {
|
|
|
|
+ state_io.focus.auto_control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
state_io.can_af_trigger = mp_camera_query_control(
|
|
state_io.can_af_trigger = mp_camera_query_control(
|
|
@@ -383,8 +389,14 @@ init_controls()
|
|
state_io.gain.value = 0;
|
|
state_io.gain.value = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- state_io.gain.manual =
|
|
|
|
- mp_camera_control_get_bool(state_io.camera, V4L2_CID_AUTOGAIN) == 0;
|
|
|
|
|
|
+ if (mp_camera_query_control(state_io.camera, V4L2_CID_AUTOGAIN, &control)) {
|
|
|
|
+ state_io.gain.auto_control = V4L2_CID_AUTOGAIN;
|
|
|
|
+ state_io.gain.manual =
|
|
|
|
+ mp_camera_control_get_bool(state_io.camera,
|
|
|
|
+ V4L2_CID_AUTOGAIN) == 0;
|
|
|
|
+ } else {
|
|
|
|
+ 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)) {
|
|
state_io.exposure.control = V4L2_CID_EXPOSURE;
|
|
state_io.exposure.control = V4L2_CID_EXPOSURE;
|
|
@@ -396,10 +408,16 @@ init_controls()
|
|
state_io.exposure.control = 0;
|
|
state_io.exposure.control = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- state_io.exposure.manual =
|
|
|
|
- mp_camera_control_get_int32(state_io.camera,
|
|
|
|
- V4L2_CID_EXPOSURE_AUTO) ==
|
|
|
|
- V4L2_EXPOSURE_MANUAL;
|
|
|
|
|
|
+ if (mp_camera_query_control(
|
|
|
|
+ state_io.camera, V4L2_CID_EXPOSURE_AUTO, &control)) {
|
|
|
|
+ state_io.exposure.auto_control = V4L2_CID_EXPOSURE_AUTO;
|
|
|
|
+ state_io.exposure.manual =
|
|
|
|
+ mp_camera_control_get_int32(state_io.camera,
|
|
|
|
+ V4L2_CID_EXPOSURE_AUTO) ==
|
|
|
|
+ V4L2_EXPOSURE_MANUAL;
|
|
|
|
+ } else {
|
|
|
|
+ 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)) {
|
|
@@ -422,9 +440,9 @@ init_controls()
|
|
* State transfer from Main -> IO
|
|
* State transfer from Main -> IO
|
|
*/
|
|
*/
|
|
static void
|
|
static void
|
|
-update_state(MPPipeline *pipeline, const struct mp_io_pipeline_state *state)
|
|
|
|
|
|
+update_state(MPPipeline *pipeline, const mp_state_io *new_state)
|
|
{
|
|
{
|
|
- if (state_io.camera != state->camera) {
|
|
|
|
|
|
+ if (state_io.camera != new_state->camera) {
|
|
if (state_io.camera != NULL) {
|
|
if (state_io.camera != NULL) {
|
|
mp_process_pipeline_sync();
|
|
mp_process_pipeline_sync();
|
|
mp_camera_stop_capture(mpcamera);
|
|
mp_camera_stop_capture(mpcamera);
|
|
@@ -436,7 +454,7 @@ update_state(MPPipeline *pipeline, const struct mp_io_pipeline_state *state)
|
|
capture_source = NULL;
|
|
capture_source = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
- state_io.camera = state->camera;
|
|
|
|
|
|
+ state_io.camera = new_state->camera;
|
|
if (state_io.camera) {
|
|
if (state_io.camera) {
|
|
libmegapixels_open(state_io.camera);
|
|
libmegapixels_open(state_io.camera);
|
|
mpcamera = mp_camera_new(state_io.camera);
|
|
mpcamera = mp_camera_new(state_io.camera);
|
|
@@ -495,29 +513,39 @@ update_state(MPPipeline *pipeline, const struct mp_io_pipeline_state *state)
|
|
init_controls();
|
|
init_controls();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- state_io.configuration = state->configuration;
|
|
|
|
- state_io.burst_length = state->burst_length;
|
|
|
|
- state_io.preview_width = state->preview_width;
|
|
|
|
- state_io.preview_height = state->preview_height;
|
|
|
|
- state_io.device_rotation = state->device_rotation;
|
|
|
|
|
|
+ state_io.configuration = new_state->configuration;
|
|
|
|
+ state_io.burst_length = new_state->burst_length;
|
|
|
|
+ state_io.preview_width = new_state->preview_width;
|
|
|
|
+ state_io.preview_height = new_state->preview_height;
|
|
|
|
+ state_io.device_rotation = new_state->device_rotation;
|
|
|
|
|
|
if (state_io.camera) {
|
|
if (state_io.camera) {
|
|
- state_io.gain.manual_req = state->gain_is_manual;
|
|
|
|
- state_io.gain.value_req = state->gain;
|
|
|
|
- state_io.exposure.manual_req = state->exposure_is_manual;
|
|
|
|
- state_io.exposure.value_req = state->exposure;
|
|
|
|
-
|
|
|
|
- state_io.flash_enabled = state->flash_enabled;
|
|
|
|
|
|
+ state_io.gain.value = new_state->gain.value;
|
|
|
|
+ state_io.gain.value_req = new_state->gain.value_req;
|
|
|
|
+ state_io.gain.manual = new_state->gain.manual;
|
|
|
|
+ state_io.gain.manual_req = new_state->gain.manual_req;
|
|
|
|
+
|
|
|
|
+ state_io.exposure.value = new_state->exposure.value;
|
|
|
|
+ state_io.exposure.value_req = new_state->exposure.value_req;
|
|
|
|
+ state_io.exposure.manual = new_state->exposure.manual;
|
|
|
|
+ state_io.exposure.manual_req = new_state->exposure.manual_req;
|
|
|
|
+
|
|
|
|
+ state_io.focus.value = new_state->focus.value;
|
|
|
|
+ state_io.focus.value_req = new_state->focus.value_req;
|
|
|
|
+ state_io.focus.manual = new_state->focus.manual;
|
|
|
|
+ state_io.focus.manual_req = new_state->focus.manual_req;
|
|
|
|
+
|
|
|
|
+ state_io.flash_enabled = new_state->flash_enabled;
|
|
}
|
|
}
|
|
|
|
|
|
update_process_pipeline();
|
|
update_process_pipeline();
|
|
}
|
|
}
|
|
|
|
|
|
void
|
|
void
|
|
-mp_io_pipeline_update_state(const struct mp_io_pipeline_state *state)
|
|
|
|
|
|
+mp_io_pipeline_update_state(const mp_state_io *state)
|
|
{
|
|
{
|
|
mp_pipeline_invoke(pipeline,
|
|
mp_pipeline_invoke(pipeline,
|
|
(MPPipelineCallback)update_state,
|
|
(MPPipelineCallback)update_state,
|
|
state,
|
|
state,
|
|
- sizeof(struct mp_io_pipeline_state));
|
|
|
|
|
|
+ sizeof(mp_state_io));
|
|
}
|
|
}
|