ui: display exposure/gain settings

This commit is contained in:
Pavel Machek
2024-09-06 11:43:41 +02:00
parent 9e4b760b77
commit 13264d6b1c
3 changed files with 17 additions and 7 deletions

View File

@@ -165,6 +165,12 @@ update_io_pipeline()
mp_io_pipeline_update_state(&new_state); mp_io_pipeline_update_state(&new_state);
} }
void
notify_auto_status(gchar *msg)
{
gtk_button_set_label(GTK_BUTTON(status_button), msg);
}
/* /*
* State transfer from Process -> Main * State transfer from Process -> Main
*/ */
@@ -236,7 +242,6 @@ update_state(const mp_state_main *new_state)
// as flash, so always enable this button // as flash, so always enable this button
gtk_widget_set_visible(flash_button, true); gtk_widget_set_visible(flash_button, true);
gtk_widget_set_visible(status_button, true); gtk_widget_set_visible(status_button, true);
gtk_button_set_label(GTK_BUTTON(status_button), "(st)");
return false; return false;
} }

View File

@@ -41,3 +41,4 @@ bool check_window_active();
void notify_movie_progress(void); void notify_movie_progress(void);
void notify_movie_message(gchar *msg); void notify_movie_message(gchar *msg);
void notify_auto_status(gchar *msg);

View File

@@ -496,25 +496,29 @@ static void
summarize() summarize()
{ {
double time, gain; double time, gain;
bool portrait = (state_proc.device_rotation == 0 || state_proc.device_rotation == 180);
char *sep = portrait ? " " : "\n";
char buf[2048];
/* FIXME: may be approximate -- width/height should include blank areas */ /* FIXME: may be approximate -- width/height should include blank areas */
double PCK = state_proc.mode->width * state_proc.mode->height * 30; double PCK = state_proc.mode->width * state_proc.mode->height * 30;
double per_line = state_proc.mode->width / PCK; double per_line = state_proc.mode->width / PCK;
time = state_proc.exposure.value * per_line; time = state_proc.exposure.value * per_line;
//Then the exposure time = (exposure line) * (time per line ).
/* Frame time in seconds */
//time = state_proc.exposure.value * state_proc.mode->height;
/* */ /* */
gain = state_proc.gain.value / ((float) state_proc.gain.min); /* FIXME: .min */ gain = state_proc.gain.value / ((float) state_proc.gain.min);
if (0) /* dgain */ if (0) /* dgain */
gain *= state_proc.dgain.value / ((float) state_proc.dgain.min); gain *= state_proc.dgain.value / ((float) state_proc.dgain.min);
printf("1/%.0f sec, ISO %.0f, t=%f, g=%f %d %d\n", printf("1/%.0f sec, ISO %.0f, t=%f, g=%f %d %d\n",
(float) (1.0/time), (float) (gain*100), (float) (1.0/time), (float) (gain*100),
(float) time, (float) gain, state_proc.gain.value, state_proc.dgain.value); (float) time, (float) gain, state_proc.gain.value, state_proc.dgain.value);
sprintf(buf, "1/%s%.0f%sISO%s%.0f",
sep, (float) (1.0/time), sep,
sep, (float) (gain*100));
notify_auto_status(buf);
} }
static void static void