Improve gain/exposure controls
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="iso-controls-button">
|
||||
<property name="valign">start</property>
|
||||
<property name="icon-name">iso-man-symbolic</property>
|
||||
<property name="icon-name">iso-auto-symbolic</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
<class name="control"/>
|
||||
|
@@ -232,6 +232,7 @@ start_focus()
|
||||
static void
|
||||
update_controls()
|
||||
{
|
||||
bool state_changed = false;
|
||||
// Don't update controls while capturing
|
||||
if (state_io.captures_remaining > 0) {
|
||||
return;
|
||||
@@ -247,6 +248,7 @@ update_controls()
|
||||
V4L2_CID_AUTOGAIN,
|
||||
!state_io.gain.manual_req);
|
||||
state_io.gain.manual = state_io.gain.manual_req;
|
||||
state_changed = true;
|
||||
}
|
||||
|
||||
if ((state_io.gain.manual ||
|
||||
@@ -256,6 +258,7 @@ update_controls()
|
||||
state_io.gain.control,
|
||||
state_io.gain.value_req);
|
||||
state_io.gain.value = state_io.gain.value_req;
|
||||
state_changed = true;
|
||||
}
|
||||
|
||||
if (state_io.exposure.manual != state_io.exposure.manual_req) {
|
||||
@@ -265,6 +268,7 @@ update_controls()
|
||||
V4L2_EXPOSURE_MANUAL :
|
||||
V4L2_EXPOSURE_AUTO);
|
||||
state_io.exposure.manual = state_io.exposure.manual_req;
|
||||
state_changed = true;
|
||||
}
|
||||
|
||||
if (state_io.exposure.manual &&
|
||||
@@ -273,6 +277,12 @@ update_controls()
|
||||
state_io.exposure.control,
|
||||
state_io.exposure.value_req);
|
||||
state_io.exposure.value = state_io.exposure.value_req;
|
||||
state_changed = true;
|
||||
}
|
||||
|
||||
if (state_changed) {
|
||||
pipeline_changed = true;
|
||||
update_process_pipeline();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,6 +501,9 @@ init_controls()
|
||||
} else {
|
||||
state_io.blue.control = 0;
|
||||
}
|
||||
|
||||
pipeline_changed = true;
|
||||
update_process_pipeline();
|
||||
}
|
||||
|
||||
/*
|
||||
|
14
src/main.c
14
src/main.c
@@ -157,6 +157,16 @@ update_io_pipeline()
|
||||
static bool
|
||||
update_state(const mp_state_main *new_state)
|
||||
{
|
||||
if (state.exposure.manual != new_state->exposure.manual) {
|
||||
const char *icon_name = new_state->exposure.manual ? "shutter-man-symbolic" : "shutter-auto-symbolic";
|
||||
gtk_button_set_icon_name(GTK_BUTTON(shutter_button), icon_name);
|
||||
}
|
||||
|
||||
if (state.gain.manual != new_state->gain.manual) {
|
||||
const char *icon_name = new_state->gain.manual ? "iso-man-symbolic" : "iso-auto-symbolic";
|
||||
gtk_button_set_icon_name(GTK_BUTTON(iso_button), icon_name);
|
||||
}
|
||||
|
||||
state.gain.control = new_state->gain.control;
|
||||
state.gain.auto_control = new_state->gain.auto_control;
|
||||
state.gain.value = new_state->gain.value;
|
||||
@@ -191,8 +201,6 @@ update_state(const mp_state_main *new_state)
|
||||
gtk_widget_set_visible(iso_button, state.gain.control != 0);
|
||||
gtk_widget_set_visible(shutter_button, state.exposure.control != 0);
|
||||
|
||||
update_io_pipeline();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -885,7 +893,7 @@ static void
|
||||
open_shutter_controls(GtkWidget *button, gpointer user_data)
|
||||
{
|
||||
float value =
|
||||
((float)state.exposure.value / (float)state.exposure.max) * 360.0f;
|
||||
(float)state.exposure.value * 360.0f / (float)state.camera->current_mode->height;
|
||||
open_controls(button,
|
||||
"Shutter",
|
||||
1.0,
|
||||
|
Reference in New Issue
Block a user