From f247db9dcdd4d7b60f7716945c2ef532c3961c12 Mon Sep 17 00:00:00 2001 From: Martijn Braam Date: Tue, 15 Feb 2022 14:43:20 +0100 Subject: [PATCH] save flash state in the exif data --- src/io_pipeline.c | 1 + src/process_pipeline.c | 13 ++++++++++++- src/process_pipeline.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/io_pipeline.c b/src/io_pipeline.c index e40b9b7..f9d428c 100644 --- a/src/io_pipeline.c +++ b/src/io_pipeline.c @@ -322,6 +322,7 @@ update_process_pipeline() .exposure = current_controls.exposure, .has_auto_focus_continuous = info->has_auto_focus_continuous, .has_auto_focus_start = info->has_auto_focus_start, + .flash_enabled = flash_enabled, }; mp_process_pipeline_update_state(&pipeline_state); } diff --git a/src/process_pipeline.c b/src/process_pipeline.c index 3f23378..32b62c0 100644 --- a/src/process_pipeline.c +++ b/src/process_pipeline.c @@ -51,6 +51,8 @@ static int gain_max; static bool exposure_is_manual; static int exposure; +static bool flash_enabled; + static bool save_dng; static char capture_fname[255]; @@ -556,7 +558,16 @@ process_image_for_capture(const uint8_t *image, int count) gain - 1, 0, gain_max, camera->iso_min, camera->iso_max); TIFFSetField(tif, EXIFTAG_ISOSPEEDRATINGS, 1, &isospeed); } - TIFFSetField(tif, EXIFTAG_FLASH, 0); + if(!camera->has_flash){ + // No flash function + TIFFSetField(tif, EXIFTAG_FLASH, 0x20); + } else if (flash_enabled) { + // Flash present and fired + TIFFSetField(tif, EXIFTAG_FLASH, 0x1); + } else { + // Flash present but not fired + TIFFSetField(tif, EXIFTAG_FLASH, 0x0); + } TIFFSetField(tif, EXIFTAG_DATETIMEORIGINAL, datetime); TIFFSetField(tif, EXIFTAG_DATETIMEDIGITIZED, datetime); diff --git a/src/process_pipeline.h b/src/process_pipeline.h index 55caad5..10b4442 100644 --- a/src/process_pipeline.h +++ b/src/process_pipeline.h @@ -25,6 +25,8 @@ struct mp_process_pipeline_state { bool has_auto_focus_continuous; bool has_auto_focus_start; + bool flash_enabled; + bool save_dng; };