Add save-dng setting
This commit is contained in:
parent
295476c3f6
commit
5ad97d03f6
|
@ -238,6 +238,11 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="setting-raw">
|
||||||
|
<property name="label">Save raw files</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -13,3 +13,9 @@ install_data('org.postmarketos.Megapixels.svg',
|
||||||
install_data(['postprocess.sh'],
|
install_data(['postprocess.sh'],
|
||||||
install_dir: get_option('datadir') / 'megapixels/',
|
install_dir: get_option('datadir') / 'megapixels/',
|
||||||
install_mode: 'rwxr-xr-x')
|
install_mode: 'rwxr-xr-x')
|
||||||
|
|
||||||
|
settings_schemas = ['org.postmarketos.Megapixels.gschema.xml']
|
||||||
|
schemas_dir = get_option('prefix') / get_option('datadir') / 'glib-2.0' / 'schemas'
|
||||||
|
install_data(settings_schemas, install_dir: schemas_dir)
|
||||||
|
gnome.compile_schemas(depend_files: files(settings_schemas))
|
||||||
|
meson.add_install_script('glib-compile-schemas', schemas_dir)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<schemalist>
|
||||||
|
<schema path="/org/postmarketos/megapixels/" id="org.postmarketos.Megapixels">
|
||||||
|
<key name="save-raw" type='b'>
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Don't throw away the .dng file after post processing</summary>
|
||||||
|
<description>
|
||||||
|
Megapixels will write a .dng file that's passed to the post processing script
|
||||||
|
if this setting is disabled the post-process script will be told to clean it
|
||||||
|
up after processing.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
|
@ -8,16 +8,22 @@
|
||||||
# The second argument is the filename for the final photo without
|
# The second argument is the filename for the final photo without
|
||||||
# the extension, like "/home/user/Pictures/IMG202104031234"
|
# the extension, like "/home/user/Pictures/IMG202104031234"
|
||||||
#
|
#
|
||||||
|
# The third argument is 1 or 0 for the cleanup user config. If this
|
||||||
|
# is 0 the .dng file should not be moved to the output directory
|
||||||
|
#
|
||||||
# The post-processing script is responsible for cleaning up
|
# The post-processing script is responsible for cleaning up
|
||||||
# temporary directory for the burst.
|
# temporary directory for the burst.
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
set -e
|
||||||
echo "Usage: $0 [burst-dir] [target-name]"
|
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo "Usage: $0 [burst-dir] [target-name] [save-dng]"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BURST_DIR="$1"
|
BURST_DIR="$1"
|
||||||
TARGET_NAME="$2"
|
TARGET_NAME="$2"
|
||||||
|
SAVE_DNG="$3"
|
||||||
|
|
||||||
MAIN_PICTURE="$BURST_DIR"/1
|
MAIN_PICTURE="$BURST_DIR"/1
|
||||||
|
|
||||||
|
@ -92,3 +98,7 @@ fi
|
||||||
# Clean up the temp dir containing the burst
|
# Clean up the temp dir containing the burst
|
||||||
rm -rf "$BURST_DIR"
|
rm -rf "$BURST_DIR"
|
||||||
|
|
||||||
|
# Clean up the .dng if the user didn't want it
|
||||||
|
if [ "$SAVE_DNG" -eq "0" ]; then
|
||||||
|
rm "$TARGET_NAME.dng"
|
||||||
|
fi
|
||||||
|
|
|
@ -77,6 +77,8 @@ static int preview_height;
|
||||||
|
|
||||||
static int device_rotation;
|
static int device_rotation;
|
||||||
|
|
||||||
|
static bool save_dng;
|
||||||
|
|
||||||
struct control_state {
|
struct control_state {
|
||||||
bool gain_is_manual;
|
bool gain_is_manual;
|
||||||
int gain;
|
int gain;
|
||||||
|
@ -275,6 +277,7 @@ update_process_pipeline()
|
||||||
.camera = camera,
|
.camera = camera,
|
||||||
.mode = mode,
|
.mode = mode,
|
||||||
.burst_length = burst_length,
|
.burst_length = burst_length,
|
||||||
|
.save_dng = save_dng,
|
||||||
.preview_width = preview_width,
|
.preview_width = preview_width,
|
||||||
.preview_height = preview_height,
|
.preview_height = preview_height,
|
||||||
.device_rotation = device_rotation,
|
.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_width = state->preview_width;
|
||||||
preview_height = state->preview_height;
|
preview_height = state->preview_height;
|
||||||
device_rotation = state->device_rotation;
|
device_rotation = state->device_rotation;
|
||||||
|
save_dng = state->save_dng;
|
||||||
|
|
||||||
if (camera) {
|
if (camera) {
|
||||||
struct control_state previous_desired = desired_controls;
|
struct control_state previous_desired = desired_controls;
|
||||||
|
|
|
@ -17,6 +17,8 @@ struct mp_io_pipeline_state {
|
||||||
|
|
||||||
bool exposure_is_manual;
|
bool exposure_is_manual;
|
||||||
int exposure;
|
int exposure;
|
||||||
|
|
||||||
|
bool save_dng;
|
||||||
};
|
};
|
||||||
|
|
||||||
void mp_io_pipeline_start();
|
void mp_io_pipeline_start();
|
||||||
|
|
11
src/main.c
11
src/main.c
|
@ -71,6 +71,9 @@ GtkWidget *process_spinner;
|
||||||
GtkWidget *scanned_codes;
|
GtkWidget *scanned_codes;
|
||||||
GtkWidget *preview_top_box;
|
GtkWidget *preview_top_box;
|
||||||
GtkWidget *preview_bottom_box;
|
GtkWidget *preview_bottom_box;
|
||||||
|
GtkWidget *setting_dng;
|
||||||
|
|
||||||
|
GSettings *settings;
|
||||||
|
|
||||||
int
|
int
|
||||||
remap(int value, int input_min, int input_max, int output_min, int output_max)
|
remap(int value, int input_min, int input_max, int output_min, int output_max)
|
||||||
|
@ -102,6 +105,7 @@ update_io_pipeline()
|
||||||
.gain = gain,
|
.gain = gain,
|
||||||
.exposure_is_manual = exposure_is_manual,
|
.exposure_is_manual = exposure_is_manual,
|
||||||
.exposure = exposure,
|
.exposure = exposure,
|
||||||
|
.save_dng = gtk_check_button_get_active(GTK_CHECK_BUTTON(setting_dng)),
|
||||||
};
|
};
|
||||||
mp_io_pipeline_update_state(&io_state);
|
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_spinner_start(GTK_SPINNER(process_spinner));
|
||||||
gtk_stack_set_visible_child(GTK_STACK(open_last_stack), process_spinner);
|
gtk_stack_set_visible_child(GTK_STACK(open_last_stack), process_spinner);
|
||||||
|
update_io_pipeline();
|
||||||
mp_io_pipeline_capture();
|
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_top_box = GTK_WIDGET(gtk_builder_get_object(builder, "top-box"));
|
||||||
preview_bottom_box = GTK_WIDGET(gtk_builder_get_object(builder, "bottom-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(window, "realize", G_CALLBACK(on_realize), NULL);
|
||||||
|
|
||||||
g_signal_connect(preview, "realize", G_CALLBACK(preview_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 };
|
const char *quit_accels[] = { "<Ctrl>q", "<Ctrl>w", NULL };
|
||||||
gtk_application_set_accels_for_action(app, "app.quit", quit_accels);
|
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
|
// Listen for phosh rotation
|
||||||
GDBusConnection *conn = g_application_get_dbus_connection(G_APPLICATION(app));
|
GDBusConnection *conn = g_application_get_dbus_connection(G_APPLICATION(app));
|
||||||
g_dbus_connection_signal_subscribe(
|
g_dbus_connection_signal_subscribe(
|
||||||
|
|
|
@ -51,6 +51,8 @@ static int gain_max;
|
||||||
static bool exposure_is_manual;
|
static bool exposure_is_manual;
|
||||||
static int exposure;
|
static int exposure;
|
||||||
|
|
||||||
|
static bool save_dng;
|
||||||
|
|
||||||
static char capture_fname[255];
|
static char capture_fname[255];
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -533,9 +535,13 @@ process_capture_burst(GdkTexture *thumb)
|
||||||
timestamp);
|
timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char save_dng_s[2] = "0";
|
||||||
|
if (save_dng) {
|
||||||
|
save_dng_s[0] = '1';
|
||||||
|
}
|
||||||
|
|
||||||
// Start post-processing the captured burst
|
// 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;
|
GError *error = NULL;
|
||||||
GSubprocess *proc = g_subprocess_new(
|
GSubprocess *proc = g_subprocess_new(
|
||||||
G_SUBPROCESS_FLAGS_STDOUT_PIPE,
|
G_SUBPROCESS_FLAGS_STDOUT_PIPE,
|
||||||
|
@ -543,6 +549,7 @@ process_capture_burst(GdkTexture *thumb)
|
||||||
processing_script,
|
processing_script,
|
||||||
burst_dir,
|
burst_dir,
|
||||||
capture_fname,
|
capture_fname,
|
||||||
|
save_dng_s,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!proc) {
|
if (!proc) {
|
||||||
|
@ -707,6 +714,7 @@ update_state(MPPipeline *pipeline, const struct mp_process_pipeline_state *state
|
||||||
device_rotation = state->device_rotation;
|
device_rotation = state->device_rotation;
|
||||||
|
|
||||||
burst_length = state->burst_length;
|
burst_length = state->burst_length;
|
||||||
|
save_dng = state->save_dng;
|
||||||
|
|
||||||
// gain_is_manual = state->gain_is_manual;
|
// gain_is_manual = state->gain_is_manual;
|
||||||
gain = state->gain;
|
gain = state->gain;
|
||||||
|
|
|
@ -24,6 +24,8 @@ struct mp_process_pipeline_state {
|
||||||
|
|
||||||
bool has_auto_focus_continuous;
|
bool has_auto_focus_continuous;
|
||||||
bool has_auto_focus_start;
|
bool has_auto_focus_start;
|
||||||
|
|
||||||
|
bool save_dng;
|
||||||
};
|
};
|
||||||
|
|
||||||
void mp_process_pipeline_start();
|
void mp_process_pipeline_start();
|
||||||
|
|
Loading…
Reference in New Issue