[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:37:48 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=5c79d7c

The following commit has been merged in the master branch:
commit 5c79d7c3fb69dfcc315ffb1c9c9f3785da98a7ca
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Wed Aug 9 16:08:20 2006 +0000

    Added TagDetailBitmask type and print function, changed Canon tags to use it (David)
---
 src/canonmn.cpp | 73 +++++++++++++++++----------------------------------------
 src/tags.hpp    | 37 +++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 51 deletions(-)

diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 2bcbd87..e4c54bb 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -241,6 +241,19 @@ namespace Exiv2 {
         { 1, "Continuous" }
     };
 
+    //! FlashDetails, tag 0x001d
+    extern const TagDetailsBitmask canonCs1FlashDetails[] = {
+        { 0x4000, "External flash"        },
+        { 0x2000, "Internal flash"        },
+        { 0x0001, "Manual"                },
+        { 0x0002, "TTL"                   },
+        { 0x0004, "A-TTL"                 },
+        { 0x0008, "E-TTL"                 },
+        { 0x0010, "FP sync enabled"       },
+        { 0x0080, "2nd-curtain sync used" },
+        { 0x0800, "FP sync used"          }
+    };
+
     // Canon Camera Settings 1 Tag Info
     const TagInfo CanonMakerNote::tagInfoCs1_[] = {
         TagInfo(0x0001, "Macro", "Macro", "Macro mode", canonCs1IfdId, makerTags, unsignedShort, EXV_PRINT_TAG(canonCs1Macro)),
@@ -271,7 +284,7 @@ namespace Exiv2 {
         TagInfo(0x001a, "0x001a", "0x001a", "Unknown", canonCs1IfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x001b, "0x001b", "0x001b", "Unknown", canonCs1IfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x001c, "FlashActivity", "FlashActivity", "Flash activity", canonCs1IfdId, makerTags, unsignedShort, EXV_PRINT_TAG(canonCs1FlashActivity)),
-        TagInfo(0x001d, "FlashDetails", "FlashDetails", "Flash details", canonCs1IfdId, makerTags, unsignedShort, printCs10x001d),
+        TagInfo(0x001d, "FlashDetails", "FlashDetails", "Flash details", canonCs1IfdId, makerTags, unsignedShort, EXV_PRINT_TAG_BITMASK(canonCs1FlashDetails)),
         TagInfo(0x001e, "0x001e", "0x001e", "Unknown", canonCs1IfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x001f, "0x001f", "0x001f", "Unknown", canonCs1IfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x0020, "FocusContinuous", "Focus Continuous", "Focus continuous setting", canonCs1IfdId, makerTags, unsignedShort, EXV_PRINT_TAG(canonCs1FocusContinuous)),
@@ -297,6 +310,13 @@ namespace Exiv2 {
         { 6, "Custom"      }
     };
 
+    //! AFPointUsed, tag 0x000e
+    extern const TagDetailsBitmask canonCs2AFPointUsed[] = {
+        { 0x0004, "left"   },
+        { 0x0002, "center" },
+        { 0x0001, "right"  }
+    };
+
     //! FlashBias, tag 0x000f
     extern const TagDetails canonCs2FlashBias[] = {
         { 0xffc0, "-2 EV"    },
@@ -643,40 +663,6 @@ namespace Exiv2 {
         return os;
     }
 
-    std::ostream& CanonMakerNote::printCs10x001d(std::ostream& os,
-                                                 const Value& value)
-    {
-        if (value.typeId() != unsignedShort) return os << value;
-        long l = value.toLong();
-        bool coma = false;
-        if (l & 0x4000) {
-            if (coma) os << ", ";
-            os << "External TTL";
-            coma = true;
-        }
-        if (l & 0x2000) {
-            if (coma) os << ", ";
-            os << "Internal flash";
-            coma = true;
-        }
-        if (l & 0x0800) {
-            if (coma) os << ", ";
-            os << "FP sync used";
-            coma = true;
-        }
-        if (l & 0x0080) {
-            if (coma) os << ", ";
-            os << "Rear curtain sync used";
-            coma = true;
-        }
-        if (l & 0x0010) {
-            if (coma) os << ", ";
-            os << "FP sync enabled";
-            coma = true;
-        }
-        return os;
-    }
-
     std::ostream& CanonMakerNote::printCs1Lens(std::ostream& os,
                                                 const Value& value)
     {
@@ -724,22 +710,7 @@ namespace Exiv2 {
             os << "none";
         }
         else {
-            bool coma = false;
-            if (l & 0x0004) {
-                if (coma) os << ", ";
-                os << "left";
-                coma = true;
-            }
-            if (l & 0x0002) {
-                if (coma) os << ", ";
-                os << "center";
-                coma = true;
-            }
-            if (l & 0x0001) {
-                if (coma) os << ", ";
-                os << "right";
-                coma = true;
-            }
+            EXV_PRINT_TAG_BITMASK(canonCs2AFPointUsed)(os, value);
         }
         os << " used";
         return os;
diff --git a/src/tags.hpp b/src/tags.hpp
index d5b6b1f..6877774 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -125,6 +125,15 @@ namespace Exiv2 {
     }; // struct TagDetails
 
     /*!
+      @brief Helper structure for lookup tables for translations of bitmask
+             values to human readable labels.
+     */
+    struct TagDetailsBitmask {
+        uint32_t mask_;                         //!< Bitmask value
+        char* label_;                           //!< Description of the tag value
+    }; // struct TagDetailsBitmask
+
+    /*!
       @brief Generic print function to translate a long value to a description
              by looking up a reference table.
      */
@@ -144,6 +153,34 @@ namespace Exiv2 {
 //! Shortcut for the printTag template which requires typing the array name only once.
 #define EXV_PRINT_TAG(array) printTag<EXV_COUNTOF(array), array>
 
+    /*!
+      @brief Generic print function to translate a long value to a description
+             by looking up bitmasks in a reference table.
+     */
+    template <int N, const TagDetailsBitmask (&array)[N]>
+    std::ostream& printTagBitmask(std::ostream& os, const Value& value)
+    {
+        const uint32_t val = value.toLong();
+        bool sep = false;
+        for (int i = 0; i < N; i++) {
+            const TagDetailsBitmask* td = &array[i];
+
+            if (val & td->mask_) {
+                if (sep) {
+                    os << ", " << td->label_;
+                }
+                else {
+                    os << td->label_;
+                    sep = true;
+                }
+            }
+        }
+        return os;
+    }
+
+//! Shortcut for the printTagBitmask template which requires typing the array name only once.
+#define EXV_PRINT_TAG_BITMASK(array) printTagBitmask<EXV_COUNTOF(array), array>
+
     //! Container for Exif tag information. Implemented as a static class.
     class ExifTags {
         //! Prevent construction: not implemented.

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list