[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:32 UTC 2017


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

The following commit has been merged in the master branch:
commit 7d578fefef5330bfbd69e858af48ac37197180f1
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun Apr 30 03:31:36 2006 +0000

    Improved Exif.Nikon[13].AFFocusPos print functions (Roger Larsson)
---
 src/nikonmn.cpp          | 118 +++++++++++++++++++++++++++--------------------
 test/data/exiv2-test.out |   4 +-
 2 files changed, 70 insertions(+), 52 deletions(-)

diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp
index a7e7da4..61e1574 100644
--- a/src/nikonmn.cpp
+++ b/src/nikonmn.cpp
@@ -55,6 +55,24 @@ EXIV2_RCSID("@(#) $Id$");
 // class member definitions
 namespace Exiv2 {
 
+    // Roger Larsson: My guess is that focuspoints will follow autofocus sensor
+    // module. Note that relative size and position will vary depending on if
+    // "wide" or not
+    //! Focus points for Nikon cameras, used for Nikon 1 and Nikon 3 makernotes.
+    static const char *nikonFocuspoints[] = {
+        "Center",
+        "Top",
+        "Bottom",
+        "Left",
+        "Right",
+        "Upper left",
+        "Upper right",
+        "Lower left",
+        "Lower right",
+        "Leftmost",
+        "Rightmost"
+    };
+
     //! @cond IGNORE
     Nikon1MakerNote::RegisterMn::RegisterMn()
     {
@@ -186,17 +204,27 @@ namespace Exiv2 {
                                                const Value& value)
     {
         if (value.count() > 1) {
-            switch (value.toLong(1)) {
-            case 0: os << "Center"; break;
-            case 1: os << "Top"; break;
-            case 2: os << "Bottom"; break;
-            case 3: os << "Left"; break;
-            case 4: os << "Right"; break;
-            default: os << "(" << value << ")"; break;
+            unsigned long focusPoint = value.toLong(1);
+
+            os << value.toLong(0) << "; ";
+            switch (focusPoint) {
+            // Could use array nikonFokuspoints
+            case 0:
+            case 1: 
+            case 2: 
+            case 3: 
+            case 4: 
+                os << nikonFocuspoints[focusPoint];
+                break;
+            default:
+                os << value;
+                if (focusPoint < sizeof(nikonFocuspoints)/sizeof(nikonFocuspoints[0]))
+                    os << " guess " << nikonFocuspoints[focusPoint];
+                break;
             }
         }
         else {
-            os << "(" << value << ")";
+            os << value;
         }
         return os;
     }
@@ -610,39 +638,11 @@ namespace Exiv2 {
         return os;
     }
 
-    // Roger Larsson: My guess is that focuspoints will follow autofocus sensor
-    // module Note that relative size and position will vary depending on if
-    // "wide" or not
-    //! Focus points for Nikon cameras
-    const char *nikonFocuspoints[] = {
-        "Center",
-        "Top",
-        "Bottom",
-        "Left",
-        "Right",
-        "Upper left",
-        "Upper right",
-        "Lower left",
-        "Lower right",
-        "Leftmost",
-        "Rightmost"
-    };
-
     std::ostream& Nikon3MakerNote::print0x0088(std::ostream& os,
                                                const Value& value)
     {
-        if (value.size() != 4) {
-            // Mappings taken from Exiftool
-            // TODO: are they really correct?
-            unsigned long afpos = value.toLong(); // BUG?: takes first value
-            switch (afpos) {
-            case 0x0000: os << "Center"; break;
-            case 0x0100: os << "Top"; break;
-            case 0x0200: os << "Bottom"; break;
-            case 0x0300: os << "Left"; break;
-            case 0x0400: os << "Right"; break;
-            default: os << "(" << value << ")"; break;
-            }
+        if (value.size() != 4) { // Size is 4 even for those who map this way...
+            os << "(" << value << ")";
         }
         else {
             // Mapping by Roger Larsson
@@ -650,7 +650,18 @@ namespace Exiv2 {
             unsigned focuspoint = value.toLong(1);
             unsigned focusused = (value.toLong(2) << 8) + value.toLong(3);
             enum {standard, wide} combination = standard;
-            const unsigned focuspoints = sizeof(nikonFocuspoints) / sizeof(nikonFocuspoints[0]);
+            const unsigned focuspoints =   sizeof(nikonFocuspoints) 
+                                         / sizeof(nikonFocuspoints[0]);
+
+            if (focusmetering == 0 && focuspoint == 0 && focusused == 0) {
+                // Special case, in Manual focus and with Nikon compacts
+                // this indicates that the field has no meaning.
+                // But when acually in "Single area, Center" this can mean
+                // that focus was not found (try this in AF-C mode)
+                // TODO: handle the meaningful case (interacts with other fields)
+                os << "N/A";
+                return os;
+            }
 
             switch (focusmetering) {
             case 0x00: os << "Single area"; break; // D70, D200
@@ -661,28 +672,35 @@ namespace Exiv2 {
             case 0x05: os << "Dynamic area (wide)"; combination = wide; break; // D200
             default: os << "(" << focusmetering << ")"; break;
             }
-            os << ", ";
 
-            // What fokuspoint did the user select?
-            if (focuspoint < focuspoints) {
-                os << nikonFocuspoints[focuspoint];
-                // TODO: os << position[fokuspoint][combination]
+            char sep = ';';
+            if (focusmetering != 0x02) { //  No user selected point for Closest subject
+                os << sep << ' ';
+
+                // What focuspoint did the user select?
+                if (focuspoint < focuspoints) {
+                    os << nikonFocuspoints[focuspoint];
+                    // TODO: os << position[fokuspoint][combination]
+                }
+                else
+                    os << "(" << focuspoint << ")";
+
+                sep = ',';
             }
-            else
-                os << "(" << focuspoint << ")";
 
             // What fokuspoints(!) did the camera use? add if differs
             if (focusused == 0)
-                os << " (failed)";
+                os << sep << " none";
             else if (focusused != 1U<<focuspoint) {
                 // selected point was not the actually used one 
                 // (Roger Larsson: my interpretation, verify)
-                os << " ( ";
+                os << sep;
                 for (unsigned fpid=0; fpid<focuspoints; fpid++)
                     if (focusused & 1<<fpid)
-                        os << nikonFocuspoints[fpid] << " ";
-                os << ")";
+                        os << ' ' << nikonFocuspoints[fpid];
             }
+
+            os << " used";
         }
 
         return os;
diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out
index 4780707..f2b961c 100644
--- a/test/data/exiv2-test.out
+++ b/test/data/exiv2-test.out
@@ -608,7 +608,7 @@ Exif.Nikon1.ImageAdjustment                  Ascii      14  AUTO
 Exif.Nikon1.Adapter                          Ascii      13  OFF         
 Exif.Nikon1.FocusDistance                    Rational    1  Unknown
 Exif.Nikon1.DigitalZoom                      Rational    1  1.0x
-Exif.Nikon1.AFFocusPos                       Undefined   4  Left
+Exif.Nikon1.AFFocusPos                       Undefined   4  0; Left
 Exif.Nikon1.DataDump                         Undefined 174  1 45 0 128 1 76 0 0 0 0 255 1 0 0 0 0 2 74 42 160 0 0 0 0 2 183 0 0 31 8 0 0 21 202 0 0 33 124 0 0 33 124 0 0 31 6 13 132 0 74 0 0 0 0 9 181 9 74 8 109 7 54 208 1 11 122 0 0 0 0 45 33 21 0 0 0 32 0 0 0 0 0 0 0 0 0 68 27 0 0 74 3 23 207 9 30 59 31 0 71 0 0 19 21 18 18 21 24 0 0 100 0 25 76 0 0 0 1 255 240 101 68 0 0 0 2 0 0 0 0 15 3 194 141 1 13 18 34 0 0 81 90 0 246 1 43 48 32 18 7 40 16 78 72 11 122 0 0 117 252 235 98 11 16 6 6 0 100 0 216 18 52 67 33 
 Exif.Iop.InteroperabilityIndex               Ascii       4  R98
 Exif.Iop.InteroperabilityVersion             Undefined   4  48 49 48 48 
@@ -693,7 +693,7 @@ Exif.Nikon3.ToneComp                         Ascii       9  AUTO
 Exif.Nikon3.LensType                         Byte        1  6 
 Exif.Nikon3.Lens                             Rational    4  18-70mm F3.5-4.5
 Exif.Nikon3.FlashType                        Byte        1  Not used
-Exif.Nikon3.AFFocusPos                       Undefined   4  Single area, Center
+Exif.Nikon3.AFFocusPos                       Undefined   4  Single area; Center used
 Exif.Nikon3.Bracketing                       Short       1  Single
 Exif.Nikon3.0x008a                           Short       1  0
 Exif.Nikon3.LensFStops                       Undefined   4  5.33333

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list