|
@@ -100,37 +100,70 @@ check_window_active()
|
|
|
static void
|
|
|
update_io_pipeline()
|
|
|
{
|
|
|
- struct mp_io_pipeline_state io_state = {
|
|
|
+ mp_state_io new_state = {
|
|
|
.camera = state.camera,
|
|
|
.configuration = state.configuration,
|
|
|
.burst_length = state.burst_length,
|
|
|
.preview_width = state.preview_width,
|
|
|
.preview_height = state.preview_height,
|
|
|
.device_rotation = state.device_rotation,
|
|
|
- .gain_is_manual = state.gain_is_manual,
|
|
|
- .gain = state.gain,
|
|
|
- .exposure_is_manual = state.exposure_is_manual,
|
|
|
- .exposure = state.exposure,
|
|
|
- .flash_enabled = state.flash_enabled,
|
|
|
+
|
|
|
+ .gain.control = state.gain.control,
|
|
|
+ .gain.auto_control = state.gain.auto_control,
|
|
|
+ .gain.value = state.gain.value,
|
|
|
+ .gain.value_req = state.gain.value_req,
|
|
|
+ .gain.max = state.gain.max,
|
|
|
+ .gain.manual = state.gain.manual,
|
|
|
+ .gain.manual_req = state.gain.manual_req,
|
|
|
+
|
|
|
+ .exposure.control = state.exposure.control,
|
|
|
+ .exposure.auto_control = state.exposure.auto_control,
|
|
|
+ .exposure.value = state.exposure.value,
|
|
|
+ .exposure.value_req = state.exposure.value_req,
|
|
|
+ .exposure.max = state.exposure.max,
|
|
|
+ .exposure.manual = state.exposure.manual,
|
|
|
+ .exposure.manual_req = state.exposure.manual_req,
|
|
|
+
|
|
|
+ .focus.control = state.focus.control,
|
|
|
+ .focus.auto_control = state.focus.auto_control,
|
|
|
+ .focus.value = state.focus.value,
|
|
|
+ .focus.value_req = state.focus.value_req,
|
|
|
+ .focus.max = state.focus.max,
|
|
|
+ .focus.manual = state.focus.manual,
|
|
|
+ .focus.manual_req = state.focus.manual_req,
|
|
|
};
|
|
|
- mp_io_pipeline_update_state(&io_state);
|
|
|
+ mp_io_pipeline_update_state(&new_state);
|
|
|
|
|
|
// Make the right settings available for the camera
|
|
|
gtk_widget_set_visible(flash_button, state.control_flash);
|
|
|
- gtk_widget_set_visible(iso_button, state.control_gain);
|
|
|
- gtk_widget_set_visible(shutter_button, state.control_exposure);
|
|
|
+ gtk_widget_set_visible(iso_button, state.gain.control != 0);
|
|
|
+ gtk_widget_set_visible(shutter_button, state.exposure.control != 0);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * State transfer from Process -> Main
|
|
|
+ */
|
|
|
static bool
|
|
|
update_state(const mp_state_main *new_state)
|
|
|
{
|
|
|
if (state.camera == new_state->camera) {
|
|
|
- state.gain_is_manual = new_state->gain_is_manual;
|
|
|
- state.gain = new_state->gain;
|
|
|
- state.gain_max = new_state->gain_max;
|
|
|
-
|
|
|
- state.exposure_is_manual = new_state->exposure_is_manual;
|
|
|
- state.exposure = new_state->exposure;
|
|
|
+ state.gain.control = new_state->gain.control;
|
|
|
+ state.gain.auto_control = new_state->gain.auto_control;
|
|
|
+ state.gain.value = new_state->gain.value;
|
|
|
+ state.gain.max = new_state->gain.max;
|
|
|
+ state.gain.manual = new_state->gain.manual;
|
|
|
+
|
|
|
+ state.exposure.control = new_state->exposure.control;
|
|
|
+ state.exposure.auto_control = new_state->exposure.auto_control;
|
|
|
+ state.exposure.value = new_state->exposure.value;
|
|
|
+ state.exposure.max = new_state->exposure.max;
|
|
|
+ state.exposure.manual = new_state->exposure.manual;
|
|
|
+
|
|
|
+ state.focus.control = new_state->focus.control;
|
|
|
+ state.focus.auto_control = new_state->focus.auto_control;
|
|
|
+ state.focus.value = new_state->focus.value;
|
|
|
+ state.focus.max = new_state->focus.max;
|
|
|
+ state.focus.manual = new_state->focus.manual;
|
|
|
|
|
|
state.has_auto_focus_continuous =
|
|
|
new_state->has_auto_focus_continuous;
|
|
@@ -140,10 +173,6 @@ update_state(const mp_state_main *new_state)
|
|
|
state.preview_buffer_width = new_state->preview_buffer_width;
|
|
|
state.preview_buffer_height = new_state->preview_buffer_height;
|
|
|
|
|
|
- state.control_gain = new_state->control_gain;
|
|
|
- state.control_exposure = new_state->control_exposure;
|
|
|
- state.control_focus = new_state->control_focus;
|
|
|
- state.control_flash = new_state->control_flash;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -785,8 +814,8 @@ open_controls(GtkWidget *parent,
|
|
|
static void
|
|
|
set_gain(double value)
|
|
|
{
|
|
|
- if (state.gain != (int)value) {
|
|
|
- state.gain = (int)value;
|
|
|
+ if (state.gain.value != (int)value) {
|
|
|
+ state.gain.value_req = (int)value;
|
|
|
update_io_pipeline();
|
|
|
}
|
|
|
}
|
|
@@ -794,8 +823,8 @@ set_gain(double value)
|
|
|
static void
|
|
|
set_gain_auto(bool is_auto)
|
|
|
{
|
|
|
- if (state.gain_is_manual != !is_auto) {
|
|
|
- state.gain_is_manual = !is_auto;
|
|
|
+ if (state.gain.manual != !is_auto) {
|
|
|
+ state.gain.manual_req = !is_auto;
|
|
|
update_io_pipeline();
|
|
|
}
|
|
|
}
|
|
@@ -806,9 +835,9 @@ open_iso_controls(GtkWidget *button, gpointer user_data)
|
|
|
open_controls(button,
|
|
|
"ISO",
|
|
|
0,
|
|
|
- state.gain_max,
|
|
|
- state.gain,
|
|
|
- !state.gain_is_manual,
|
|
|
+ state.gain.max,
|
|
|
+ state.gain.value,
|
|
|
+ !state.gain.manual,
|
|
|
set_gain,
|
|
|
set_gain_auto);
|
|
|
}
|
|
@@ -816,21 +845,18 @@ open_iso_controls(GtkWidget *button, gpointer user_data)
|
|
|
static void
|
|
|
set_shutter(double value)
|
|
|
{
|
|
|
- // TODO: Implement shutter in libmegapixels
|
|
|
- /*
|
|
|
- int new_exposure = (int)(value / 360.0 * camera->capture_mode.height);
|
|
|
- if (new_exposure != exposure) {
|
|
|
- exposure = new_exposure;
|
|
|
+ int new_exposure = (int)(value / 360.0 * state.camera->current_mode->height);
|
|
|
+ if (new_exposure != state.exposure.value) {
|
|
|
+ state.exposure.value_req = new_exposure;
|
|
|
update_io_pipeline();
|
|
|
}
|
|
|
- */
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
set_shutter_auto(bool is_auto)
|
|
|
{
|
|
|
- if (state.exposure_is_manual != !is_auto) {
|
|
|
- state.exposure_is_manual = !is_auto;
|
|
|
+ if (state.exposure.manual != !is_auto) {
|
|
|
+ state.exposure.manual_req = !is_auto;
|
|
|
update_io_pipeline();
|
|
|
}
|
|
|
}
|
|
@@ -838,12 +864,14 @@ set_shutter_auto(bool is_auto)
|
|
|
static void
|
|
|
open_shutter_controls(GtkWidget *button, gpointer user_data)
|
|
|
{
|
|
|
+ float value =
|
|
|
+ ((float)state.exposure.value / (float)state.exposure.max) * 360.0f;
|
|
|
open_controls(button,
|
|
|
"Shutter",
|
|
|
1.0,
|
|
|
360.0,
|
|
|
- state.exposure,
|
|
|
- !state.exposure_is_manual,
|
|
|
+ value,
|
|
|
+ !state.exposure.manual,
|
|
|
set_shutter,
|
|
|
set_shutter_auto);
|
|
|
}
|