Fix gain and exposure being switched in io pipeline
This commit is contained in:
parent
d03d4b99e3
commit
36b7b2b38d
|
@ -497,15 +497,15 @@ update_state(MPPipeline *pipeline, const struct mp_io_pipeline_state *state)
|
||||||
pipeline, info->camera, on_frame, NULL);
|
pipeline, info->camera, on_frame, NULL);
|
||||||
|
|
||||||
current_controls.gain_is_manual =
|
current_controls.gain_is_manual =
|
||||||
mp_camera_control_get_int32(
|
mp_camera_control_get_bool(info->camera,
|
||||||
info->camera, V4L2_CID_EXPOSURE_AUTO) ==
|
V4L2_CID_AUTOGAIN) == 0;
|
||||||
V4L2_EXPOSURE_MANUAL;
|
|
||||||
current_controls.gain = mp_camera_control_get_int32(
|
current_controls.gain = mp_camera_control_get_int32(
|
||||||
info->camera, info->gain_ctrl);
|
info->camera, info->gain_ctrl);
|
||||||
|
|
||||||
current_controls.exposure_is_manual =
|
current_controls.exposure_is_manual =
|
||||||
mp_camera_control_get_bool(info->camera,
|
mp_camera_control_get_int32(
|
||||||
V4L2_CID_AUTOGAIN) == 0;
|
info->camera, V4L2_CID_EXPOSURE_AUTO) ==
|
||||||
|
V4L2_EXPOSURE_MANUAL;
|
||||||
current_controls.exposure = mp_camera_control_get_int32(
|
current_controls.exposure = mp_camera_control_get_int32(
|
||||||
info->camera, V4L2_CID_EXPOSURE);
|
info->camera, V4L2_CID_EXPOSURE);
|
||||||
}
|
}
|
||||||
|
|
80
src/main.c
80
src/main.c
|
@ -712,86 +712,6 @@ open_shutter_controls(GtkWidget *button, gpointer user_data)
|
||||||
open_controls(button, "Shutter", 1.0, 360.0, exposure, !exposure_is_manual, set_shutter, set_shutter_auto);
|
open_controls(button, "Shutter", 1.0, 360.0, exposure, !exposure_is_manual, set_shutter, set_shutter_auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static void
|
|
||||||
on_control_auto_toggled(GtkToggleButton *widget, gpointer user_data)
|
|
||||||
{
|
|
||||||
bool is_manual = gtk_toggle_button_get_active(widget) ? false : true;
|
|
||||||
bool has_changed;
|
|
||||||
|
|
||||||
switch (current_control) {
|
|
||||||
case USER_CONTROL_ISO:
|
|
||||||
if (gain_is_manual != is_manual) {
|
|
||||||
gain_is_manual = is_manual;
|
|
||||||
has_changed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case USER_CONTROL_SHUTTER:
|
|
||||||
if (exposure_is_manual != is_manual) {
|
|
||||||
exposure_is_manual = is_manual;
|
|
||||||
has_changed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_changed) {
|
|
||||||
// The slider might have been moved while Auto mode is active. When entering
|
|
||||||
// Manual mode, first read the slider value to sync with those changes.
|
|
||||||
double value = gtk_adjustment_get_value(control_slider);
|
|
||||||
switch (current_control) {
|
|
||||||
case USER_CONTROL_ISO:
|
|
||||||
if (value != gain) {
|
|
||||||
gain = (int)value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case USER_CONTROL_SHUTTER: {
|
|
||||||
// So far all sensors use exposure time in number of sensor rows
|
|
||||||
int new_exposure =
|
|
||||||
(int)(value / 360.0 * camera->capture_mode.height);
|
|
||||||
if (new_exposure != exposure) {
|
|
||||||
exposure = new_exposure;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update_io_pipeline();
|
|
||||||
draw_controls();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
on_control_slider_changed(GtkAdjustment *widget, gpointer user_data)
|
|
||||||
{
|
|
||||||
double value = gtk_adjustment_get_value(widget);
|
|
||||||
|
|
||||||
bool has_changed = false;
|
|
||||||
switch (current_control) {
|
|
||||||
case USER_CONTROL_ISO:
|
|
||||||
if (value != gain) {
|
|
||||||
gain = (int)value;
|
|
||||||
has_changed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case USER_CONTROL_SHUTTER: {
|
|
||||||
// So far all sensors use exposure time in number of sensor rows
|
|
||||||
int new_exposure =
|
|
||||||
(int)(value / 360.0 * camera->capture_mode.height);
|
|
||||||
if (new_exposure != exposure) {
|
|
||||||
exposure = new_exposure;
|
|
||||||
has_changed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_changed) {
|
|
||||||
update_io_pipeline();
|
|
||||||
draw_controls();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_realize(GtkWidget *window, gpointer *data)
|
on_realize(GtkWidget *window, gpointer *data)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue