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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:36:23 UTC 2017


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

The following commit has been merged in the master branch:
commit 878f6e5a033e933de6ad90b6b7bd6f3fc6a7c4b0
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Tue May 25 05:56:50 2004 +0000

    Added Nikon MakerNote (3 formats)
---
 src/Makefile                      |   5 +-
 src/nikon1mn.cpp                  | 193 ++++++++++++++++++++++++++++++++
 src/{sigmamn.hpp => nikon1mn.hpp} |  64 +++++------
 src/nikon2mn.cpp                  | 226 ++++++++++++++++++++++++++++++++++++++
 src/{fujimn.hpp => nikon2mn.hpp}  |  68 ++++++------
 src/nikon3mn.cpp                  | 219 ++++++++++++++++++++++++++++++++++++
 src/{sigmamn.hpp => nikon3mn.hpp} |  57 +++++-----
 7 files changed, 734 insertions(+), 98 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index c87a54a..baf155d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,7 +20,7 @@
 # 02111-1307, USA.
 #
 # File:      Makefile
-# Version:   $Name:  $ $Revision: 1.22 $
+# Version:   $Name:  $ $Revision: 1.23 $
 # Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
 # History:   10-Dec-03, ahu: created
 #
@@ -52,7 +52,8 @@ CCHDR = rcsid.hpp error.hpp
 
 # Add library C++ source files to this list
 CCSRC = canonmn.cpp exif.cpp fujimn.cpp ifd.cpp image.cpp makernote.cpp \
-        sigmamn.cpp tags.cpp types.cpp value.cpp
+        nikon1mn.cpp nikon2mn.cpp nikon3mn.cpp sigmamn.cpp tags.cpp types.cpp \
+        value.cpp
 
 # Add source files of simple applications to this list
 BINSRC = addmoddel.cpp exifcomment.cpp exifprint.cpp makernote-test.cpp \
diff --git a/src/nikon1mn.cpp b/src/nikon1mn.cpp
new file mode 100644
index 0000000..128dcfe
--- /dev/null
+++ b/src/nikon1mn.cpp
@@ -0,0 +1,193 @@
+// ***************************************************************** -*- C++ -*-
+/*
+ * Copyright (C) 2004 Andreas Huggel <ahuggel at gmx.net>
+ * 
+ * This program is part of the Exiv2 distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+/*
+  File:      nikon1mn.cpp
+  Version:   $Name:  $ $Revision: 1.1 $
+  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
+  History:   17-May-04, ahu: created
+ */
+// *****************************************************************************
+#include "rcsid.hpp"
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.1 $ $RCSfile: nikon1mn.cpp,v $")
+
+// *****************************************************************************
+// included header files
+#include "types.hpp"
+#include "nikon1mn.hpp"
+#include "makernote.hpp"
+#include "value.hpp"
+#include "image.hpp"
+
+// + standard includes
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <cassert>
+
+// Define DEBUG_MAKERNOTE to output debug information to std::cerr
+#undef DEBUG_MAKERNOTE
+
+// *****************************************************************************
+// class member definitions
+namespace Exiv2 {
+
+    const Nikon1MakerNote::RegisterMakerNote Nikon1MakerNote::register_;
+
+    // Nikon1 MakerNote Tag Info
+    static const MakerNote::MnTagInfo nikon1MnTagInfo[] = {
+        MakerNote::MnTagInfo(0x0001, "Version", "Nikon Makernote version"),
+        MakerNote::MnTagInfo(0x0002, "ISOSpeed", "ISO speed setting"),
+        MakerNote::MnTagInfo(0x0003, "ColorMode", "Color mode"),
+        MakerNote::MnTagInfo(0x0004, "Quality", "Image quality setting"),
+        MakerNote::MnTagInfo(0x0005, "WhiteBalance", "White balance"),
+        MakerNote::MnTagInfo(0x0006, "Sharpening", "Image sharpening setting"),
+        MakerNote::MnTagInfo(0x0007, "Focus", "Focus mode"),
+        MakerNote::MnTagInfo(0x0008, "Flash", "Flash mode"),
+        MakerNote::MnTagInfo(0x000f, "ISOSelection", "ISO selection"),
+        MakerNote::MnTagInfo(0x0080, "ImageAdjustment", "Image adjustment setting"),
+        MakerNote::MnTagInfo(0x0082, "Adapter", "Adapter used"),
+        MakerNote::MnTagInfo(0x0085, "FocusDistance", "Manual focus distance"),
+        MakerNote::MnTagInfo(0x0086, "DigitalZoom", "Digital zoom setting"),
+        MakerNote::MnTagInfo(0x0088, "AFFocusPos", "AF focus position"),
+        // End of list marker
+        MakerNote::MnTagInfo(0xffff, "(UnknownNikon1MnTag)", "Unknown Nikon1MakerNote tag")
+    };
+
+    Nikon1MakerNote::Nikon1MakerNote(bool alloc)
+        : IfdMakerNote(nikon1MnTagInfo, alloc), sectionName_("Nikon1")
+    {
+    }
+
+    Nikon1MakerNote* Nikon1MakerNote::clone(bool alloc) const 
+    {
+        return new Nikon1MakerNote(alloc);
+    }
+
+    std::ostream& Nikon1MakerNote::printTag(std::ostream& os, 
+                                            uint16 tag, 
+                                            const Value& value) const
+    {
+        switch (tag) {
+        case 0x0002: print0x0002(os, value); break;
+        case 0x0007: print0x0007(os, value); break;
+        case 0x0085: print0x0085(os, value); break;
+        case 0x0086: print0x0086(os, value); break;
+        case 0x0088: print0x0088(os, value); break;
+        default:
+            // All other tags (known or unknown) go here
+            os << value;
+            break;
+        }
+        return os;
+    }
+
+    std::ostream& Nikon1MakerNote::print0x0002(std::ostream& os,
+                                               const Value& value)
+    {
+        if (value.count() > 1) {
+            os << value.toLong(1);
+        }
+        else {
+            os << "(" << value << ")"; 
+        }
+        return os;
+    }
+
+    std::ostream& Nikon1MakerNote::print0x0007(std::ostream& os,
+                                               const Value& value)
+    {
+        std::string focus = value.toString(); 
+        if      (focus == "AF-C  ") os << "Continuous autofocus";
+        else if (focus == "AF-S  ") os << "Single autofocus";
+        else                      os << "(" << value << ")";
+        return os;
+    }
+
+    std::ostream& Nikon1MakerNote::print0x0085(std::ostream& os,
+                                               const Value& value)
+    {
+        Rational distance = value.toRational();
+        if (distance.first == 0) {
+            os << "Unknown";
+        }
+        else if (distance.second != 0) {
+            std::ostringstream oss;
+            oss.copyfmt(os);
+            os << std::fixed << std::setprecision(2)
+               << (float)distance.first / distance.second
+               << " m";
+            os.copyfmt(oss);
+        }
+        else {
+            os << "(" << value << ")";
+        }
+        return os;
+    }
+
+    std::ostream& Nikon1MakerNote::print0x0086(std::ostream& os,
+                                               const Value& value)
+    {
+        Rational zoom = value.toRational();
+        if (zoom.first == 0) {
+            os << "Not used";
+        }
+        else if (zoom.second != 0) {
+            std::ostringstream oss;
+            oss.copyfmt(os);
+            os << std::fixed << std::setprecision(1)
+               << (float)zoom.first / zoom.second
+               << "x";
+            os.copyfmt(oss);
+        }
+        else {
+            os << "(" << value << ")";
+        }
+        return os;
+    }
+
+    std::ostream& Nikon1MakerNote::print0x0088(std::ostream& os,
+                                               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;
+            }
+        }
+        else {
+            os << "(" << value << ")"; 
+        }
+        return os;
+    }
+
+// *****************************************************************************
+// free functions
+
+    MakerNote* createNikon1MakerNote(bool alloc)
+    {
+        return new Nikon1MakerNote(alloc);
+    }
+
+}                                       // namespace Exiv2
diff --git a/src/sigmamn.hpp b/src/nikon1mn.hpp
similarity index 71%
copy from src/sigmamn.hpp
copy to src/nikon1mn.hpp
index bc10c1d..7459c41 100644
--- a/src/sigmamn.hpp
+++ b/src/nikon1mn.hpp
@@ -19,17 +19,17 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*!
-  @file    sigmamn.hpp
-  @brief   Sigma and Foveon MakerNote implemented according to the specification
-           <a href="http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html">
-           SIGMA and FOVEON EXIF MakerNote Documentation</a> by Foveon.           
-  @version $Name:  $ $Revision: 1.4 $
+  @file    nikon1mn.hpp
+  @brief   Nikon MakerNote implemented according to the specification
+           <a href="http://www.tawbaware.com/990exif.htm">MakerNote 
+           EXIF Tag of the Nikon 990</a> by Max Lyons.
+  @version $Name:  $ $Revision: 1.1 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    02-Apr-04, ahu: created
+  @date    17-May-04, ahu: created
  */
-#ifndef SIGMAMN_HPP_
-#define SIGMAMN_HPP_
+#ifndef NIKON1MN_HPP_
+#define NIKON1MN_HPP_
 
 // *****************************************************************************
 // included header files
@@ -62,13 +62,13 @@ namespace Exiv2 {
              provided to read() will be kept. See Ifd for more background on
              this concept.
      */
-    MakerNote* createSigmaMakerNote(bool alloc =true);
+    MakerNote* createNikon1MakerNote(bool alloc =true);
 
 // *****************************************************************************
 // class definitions
 
-    //! MakerNote for Sigma (Foveon) cameras
-    class SigmaMakerNote : public IfdMakerNote {
+    //! A MakerNote format used by Nikon cameras, such as the E990 and D1.
+    class Nikon1MakerNote : public IfdMakerNote {
     public:
         //! @name Creators
         //@{
@@ -76,37 +76,33 @@ namespace Exiv2 {
           @brief Constructor. Allows to choose whether or not memory management
                  is required for the makernote entries.
          */
-        SigmaMakerNote(bool alloc =true);
+        Nikon1MakerNote(bool alloc =true);
         //! Virtual destructor
-        virtual ~SigmaMakerNote() {}
-        //@}
-
-        //! @name Manipulators
-        //@{        
-        int readHeader(const char* buf, 
-                       long len,
-                       ByteOrder byteOrder);
+        virtual ~Nikon1MakerNote() {}
         //@}
 
         //! @name Accessors
         //@{
-        int checkHeader() const;
-        SigmaMakerNote* clone(bool alloc =true) const;
-        //! Return the name of the makernote section ("Sigma")
+        Nikon1MakerNote* clone(bool alloc =true) const;
+        //! Return the name of the makernote section ("Nikon1")
         std::string sectionName(uint16 tag) const { return sectionName_; }
         std::ostream& printTag(std::ostream& os,
                                uint16 tag, 
                                const Value& value) const;
         //@}
 
-        //! @name Print functions for Sigma (Foveon) %MakerNote tags 
+        //! @name Print functions for Nikon1 %MakerNote tags 
         //@{
-        //! Strip the label from the value and print the remainder
-        static std::ostream& printStripLabel(std::ostream& os, const Value& value);
-        //! Print exposure mode
-        static std::ostream& print0x0008(std::ostream& os, const Value& value);
-        //! Print metering mode
-        static std::ostream& print0x0009(std::ostream& os, const Value& value);
+        //! Print ISO setting
+        static std::ostream& print0x0002(std::ostream& os, const Value& value);
+        //! Print autofocus mode
+        static std::ostream& print0x0007(std::ostream& os, const Value& value);
+        //! Print manual focus distance
+        static std::ostream& print0x0085(std::ostream& os, const Value& value);
+        //! Print digital zoom setting
+        static std::ostream& print0x0086(std::ostream& os, const Value& value);
+        //! Print AF focus position
+        static std::ostream& print0x0088(std::ostream& os, const Value& value);
         //@}
 
     private:
@@ -116,11 +112,9 @@ namespace Exiv2 {
             RegisterMakerNote() 
             {
                 MakerNoteFactory& mnf = MakerNoteFactory::instance();
-                mnf.registerMakerNote("SIGMA", "*", createSigmaMakerNote); 
-                mnf.registerMakerNote("FOVEON", "*", createSigmaMakerNote); 
+                mnf.registerMakerNote("NIKON", "E990", createNikon1MakerNote);
             }
         };
-        // DATA
         /*!
           The static member variable is initialized before main (see note) and
           will in the process register the MakerNote class. (Remember the
@@ -138,8 +132,8 @@ namespace Exiv2 {
         //! The section name (second part of the key) used for makernote tags
         std::string sectionName_;
 
-    }; // class SigmaMakerNote
+    }; // class Nikon1MakerNote
 
 }                                       // namespace Exiv2
 
-#endif                                  // #ifndef SIGMAMN_HPP_
+#endif                                  // #ifndef NIKON1MN_HPP_
diff --git a/src/nikon2mn.cpp b/src/nikon2mn.cpp
new file mode 100644
index 0000000..1752c56
--- /dev/null
+++ b/src/nikon2mn.cpp
@@ -0,0 +1,226 @@
+// ***************************************************************** -*- C++ -*-
+/*
+ * Copyright (C) 2004 Andreas Huggel <ahuggel at gmx.net>
+ * 
+ * This program is part of the Exiv2 distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+/*
+  File:      nikon2mn.cpp
+  Version:   $Name:  $ $Revision: 1.1 $
+  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
+  History:   17-May-04, ahu: created
+ */
+// *****************************************************************************
+#include "rcsid.hpp"
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.1 $ $RCSfile: nikon2mn.cpp,v $")
+
+// *****************************************************************************
+// included header files
+#include "types.hpp"
+#include "nikon2mn.hpp"
+#include "makernote.hpp"
+#include "value.hpp"
+#include "image.hpp"
+
+// + standard includes
+#include <string>
+#include <sstream>
+#include <iomanip>
+#include <cassert>
+
+// Define DEBUG_MAKERNOTE to output debug information to std::cerr
+#undef DEBUG_MAKERNOTE
+
+// *****************************************************************************
+// class member definitions
+namespace Exiv2 {
+
+    const Nikon2MakerNote::RegisterMakerNote Nikon2MakerNote::register_;
+
+    // Nikon2 MakerNote Tag Info
+    static const MakerNote::MnTagInfo nikon2MnTagInfo[] = {
+        MakerNote::MnTagInfo(0x0003, "Quality", "Image quality setting"),
+        MakerNote::MnTagInfo(0x0004, "ColorMode", "Color mode"),
+        MakerNote::MnTagInfo(0x0005, "ImageAdjustment", "Image adjustment setting"),
+        MakerNote::MnTagInfo(0x0006, "ISOSpeed", "ISO speed setting"),
+        MakerNote::MnTagInfo(0x0007, "WhiteBalance", "White balance"),
+        MakerNote::MnTagInfo(0x0008, "Focus", "Focus mode"),
+        MakerNote::MnTagInfo(0x000a, "DigitalZoom", "Digital zoom setting"),
+        MakerNote::MnTagInfo(0x000b, "Adapter", "Adapter used"),
+        // End of list marker
+        MakerNote::MnTagInfo(0xffff, "(UnknownNikon2MnTag)", "Unknown Nikon2MakerNote tag")
+    };
+
+    Nikon2MakerNote::Nikon2MakerNote(bool alloc)
+        : IfdMakerNote(nikon2MnTagInfo, alloc), sectionName_("Nikon2")
+    {
+    }
+
+    int Nikon2MakerNote::readHeader(const char* buf,
+                                  long len, 
+                                  ByteOrder byteOrder)
+    {
+        if (len < 8) return 1;
+
+        header_.alloc(8);
+        memcpy(header_.pData_, buf, header_.size_);
+        adjOffset_ = 8;
+        return 0;
+    }
+
+    int Nikon2MakerNote::checkHeader() const
+    {
+        int rc = 0;
+        // Check the Nikon prefix
+        if (   header_.size_ < 8
+            || std::string(header_.pData_, 6) != std::string("Nikon

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list