Add save-dng setting

This commit is contained in:
Martijn Braam
2021-06-14 00:32:55 +02:00
parent 295476c3f6
commit 5ad97d03f6
9 changed files with 66 additions and 3 deletions

View File

@@ -77,6 +77,8 @@ static int preview_height;
static int device_rotation;
static bool save_dng;
struct control_state {
bool gain_is_manual;
int gain;
@@ -275,6 +277,7 @@ update_process_pipeline()
.camera = camera,
.mode = mode,
.burst_length = burst_length,
.save_dng = save_dng,
.preview_width = preview_width,
.preview_height = preview_height,
.device_rotation = device_rotation,
@@ -531,6 +534,7 @@ update_state(MPPipeline *pipeline, const struct mp_io_pipeline_state *state)
preview_width = state->preview_width;
preview_height = state->preview_height;
device_rotation = state->device_rotation;
save_dng = state->save_dng;
if (camera) {
struct control_state previous_desired = desired_controls;

View File

@@ -17,6 +17,8 @@ struct mp_io_pipeline_state {
bool exposure_is_manual;
int exposure;
bool save_dng;
};
void mp_io_pipeline_start();

View File

@@ -71,6 +71,9 @@ GtkWidget *process_spinner;
GtkWidget *scanned_codes;
GtkWidget *preview_top_box;
GtkWidget *preview_bottom_box;
GtkWidget *setting_dng;
GSettings *settings;
int
remap(int value, int input_min, int input_max, int output_min, int output_max)
@@ -102,6 +105,7 @@ update_io_pipeline()
.gain = gain,
.exposure_is_manual = exposure_is_manual,
.exposure = exposure,
.save_dng = gtk_check_button_get_active(GTK_CHECK_BUTTON(setting_dng)),
};
mp_io_pipeline_update_state(&io_state);
}
@@ -453,6 +457,7 @@ run_capture_action(GSimpleAction *action, GVariant *param, gpointer user_data)
{
gtk_spinner_start(GTK_SPINNER(process_spinner));
gtk_stack_set_visible_child(GTK_STACK(open_last_stack), process_spinner);
update_io_pipeline();
mp_io_pipeline_capture();
}
@@ -883,6 +888,8 @@ activate(GtkApplication *app, gpointer data)
preview_top_box = GTK_WIDGET(gtk_builder_get_object(builder, "top-box"));
preview_bottom_box = GTK_WIDGET(gtk_builder_get_object(builder, "bottom-box"));
setting_dng = GTK_WIDGET(gtk_builder_get_object(builder, "setting-raw"));
g_signal_connect(window, "realize", G_CALLBACK(on_realize), NULL);
g_signal_connect(preview, "realize", G_CALLBACK(preview_realize), NULL);
@@ -912,6 +919,10 @@ activate(GtkApplication *app, gpointer data)
const char *quit_accels[] = { "<Ctrl>q", "<Ctrl>w", NULL };
gtk_application_set_accels_for_action(app, "app.quit", quit_accels);
// Setup settings
settings = g_settings_new("org.postmarketos.Megapixels");
g_settings_bind (settings, "save-raw", setting_dng, "active", G_SETTINGS_BIND_DEFAULT);
// Listen for phosh rotation
GDBusConnection *conn = g_application_get_dbus_connection(G_APPLICATION(app));
g_dbus_connection_signal_subscribe(

View File

@@ -51,6 +51,8 @@ static int gain_max;
static bool exposure_is_manual;
static int exposure;
static bool save_dng;
static char capture_fname[255];
static void
@@ -533,9 +535,13 @@ process_capture_burst(GdkTexture *thumb)
timestamp);
}
char save_dng_s[2] = "0";
if (save_dng) {
save_dng_s[0] = '1';
}
// Start post-processing the captured burst
g_print("Post process %s to %s.ext\n", burst_dir, capture_fname);
g_print("Post process %s to %s.ext (save-dng %s)\n", burst_dir, capture_fname, save_dng_s);
GError *error = NULL;
GSubprocess *proc = g_subprocess_new(
G_SUBPROCESS_FLAGS_STDOUT_PIPE,
@@ -543,6 +549,7 @@ process_capture_burst(GdkTexture *thumb)
processing_script,
burst_dir,
capture_fname,
save_dng_s,
NULL);
if (!proc) {
@@ -707,6 +714,7 @@ update_state(MPPipeline *pipeline, const struct mp_process_pipeline_state *state
device_rotation = state->device_rotation;
burst_length = state->burst_length;
save_dng = state->save_dng;
// gain_is_manual = state->gain_is_manual;
gain = state->gain;

View File

@@ -24,6 +24,8 @@ struct mp_process_pipeline_state {
bool has_auto_focus_continuous;
bool has_auto_focus_start;
bool save_dng;
};
void mp_process_pipeline_start();