[tracker-miners] libtracker-extract: Use enumerated constants for Exif flash values



commit 08ca2ac031559749d2e97040ccdd02218c3106af
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 3 11:08:08 2018 +0100

    libtracker-extract: Use enumerated constants for Exif flash values
    
    Based on page 35 of version 2.2 of the Exif standard [1] published by
    JEITA. Note that some combinations, like 0x0008 and 0x0058, are not
    mentioned in the standard but they are still included to avoid
    functional changes and to be defensive against odd files.
    
    [1] http://www.exiv2.org/Exif2-2.PDF
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792178

 src/libtracker-extract/tracker-exif.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index 3e70169..316d03f 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -48,6 +48,15 @@
  * using these standards.
  **/
 
+enum {
+       EXIF_FLASH_NONE = 0x0000,
+       EXIF_FLASH_FIRED_MISSING_STROBE = 0x0005,
+       EXIF_FLASH_DID_NOT_FIRE_COMPULSORY_ON = 0x0008,
+       EXIF_FLASH_DID_NOT_FIRE_COMPULSORY_OFF = 0x0010,
+       EXIF_FLASH_DID_NOT_FIRE_AUTO = 0x0018,
+       EXIF_FLASH_DID_NOT_FIRE_AUTO_RED_EYE_REDUCTION = 0x0058,
+};
+
 static gchar *
 get_date (ExifData *exif,
           ExifTag   tag)
@@ -101,12 +110,12 @@ get_flash (ExifData *exif,
                flash = exif_get_short (entry->data, order);
 
                switch (flash) {
-               case 0x0000: /* No flash */
-               case 0x0005: /* Without strobe */
-               case 0x0008: /* Flash did not fire */
-               case 0x0010: /* Flash in compulsory mode, did not fire */
-               case 0x0018: /* Flash in auto mode, did not fire */
-               case 0x0058: /* Only red-eye reduction mode */
+               case EXIF_FLASH_NONE:
+               case EXIF_FLASH_FIRED_MISSING_STROBE:
+               case EXIF_FLASH_DID_NOT_FIRE_COMPULSORY_ON:
+               case EXIF_FLASH_DID_NOT_FIRE_COMPULSORY_OFF:
+               case EXIF_FLASH_DID_NOT_FIRE_AUTO:
+               case EXIF_FLASH_DID_NOT_FIRE_AUTO_RED_EYE_REDUCTION:
                        return g_strdup ("nmm:flash-off");
                default:
                        return g_strdup ("nmm:flash-on");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]