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


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

The following commit has been merged in the master branch:
commit 4a47a19ed5a123d2ebaaafef53ef299b9f7b7927
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun Mar 27 08:47:44 2005 +0000

    Added experimental Olympus datadump taglist and decoding functions. Only reading is supported and this breaks Olympus Makernote write-support.
---
 src/olympusmn.cpp | 105 +++++++++++++++++++++++++++++++++++++-----------------
 src/olympusmn.hpp |  28 +++++++++++++++
 src/tags.cpp      |   1 +
 src/types.hpp     |   2 +-
 4 files changed, 102 insertions(+), 34 deletions(-)

diff --git a/src/olympusmn.cpp b/src/olympusmn.cpp
index cbed20d..8c0c3ae 100644
--- a/src/olympusmn.cpp
+++ b/src/olympusmn.cpp
@@ -72,7 +72,7 @@ namespace Exiv2 {
         TagInfo(0x0302, "0x0302", "Unknown", olympusIfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x0303, "0x0303", "Unknown", olympusIfdId, makerTags, unsignedShort, printValue),
         TagInfo(0x0304, "0x0304", "Unknown", olympusIfdId, makerTags, unsignedShort, printValue),
-        TagInfo(0x0f00, "DataDump", "Various camera settings", olympusIfdId, makerTags, undefined, print0x0f00),
+        TagInfo(0x0f00, "DataDump", "Various camera settings", olympusIfdId, makerTags, undefined, printValue),
         TagInfo(0x1000, "0x1000", "Unknown", olympusIfdId, makerTags, signedRational, printValue),
         TagInfo(0x1001, "0x1001", "Unknown", olympusIfdId, makerTags, signedRational, printValue),
         TagInfo(0x1002, "0x1002", "Unknown", olympusIfdId, makerTags, signedRational, printValue),
@@ -194,37 +194,12 @@ namespace Exiv2 {
         return new OlympusMakerNote(*this); 
     }
 
-    std::ostream& OlympusMakerNote::print0x0f00(std::ostream& os, 
-                                                const Value& value)
-    {
-        if (value.typeId() != undefined) return os << value;
-
-        long count = value.count();
-        long lA, lB;
-        
-        if (count < 11) return os;
-        lA = value.toLong(11);
-        os << std::setw(23) << "
   Function ";
-        print0x0f00_011(os, lA);
-        
-        if (count < 138) return os;
-        lA = value.toLong(138);
-        os << std::setw(23) << "
   White balance mode ";
-        print0x0f00_138(os, lA);
+// -------------------------- Experimental code ------------------------>
 
-        if (count < 150) return os;
-        lA = value.toLong(150);
-        lB = value.toLong(151);
-        os << std::setw(23) << "
   Sharpness ";
-        print0x0f00_150_151(os, lA, lB);
-      
-        // Meaning of any further ushorts is unknown - ignore them
-        return os;
-
-    } // OlympusMakerNote::print0x0f00
-    
-    std::ostream& OlympusMakerNote::print0x0f00_011(std::ostream& os, long l)
+    std::ostream& OlympusMakerNote::printDd0x000b(std::ostream& os,
+                                                  const Value& value)
     {
+        long l = value.toLong();
         switch (l) {
         case  0: os << "Off";             break;
         case  1: os << "Black and White"; break;
@@ -236,8 +211,10 @@ namespace Exiv2 {
         return os;
     }
 
-    std::ostream& OlympusMakerNote::print0x0f00_138(std::ostream& os, long l)
+    std::ostream& OlympusMakerNote::printDd0x008a(std::ostream& os,
+                                                  const Value& value)
     {
+        long l = value.toLong();
         switch (l) {
         case 0:  os << "Auto";        break;
         case 16: os << "Daylight";    break;
@@ -249,9 +226,11 @@ namespace Exiv2 {
         return os;
     }
     
-    std::ostream& OlympusMakerNote::print0x0f00_150_151(std::ostream& os, 
-                                                        long l150, long l151)
+    std::ostream& OlympusMakerNote::printDd0x0097(std::ostream& os, 
+                                                  const Value& value)
     {
+        long l150 = value.toLong(0);
+        long l151 = value.toLong(1);
         if( l150 == 24 && l151 == 6 ) {
             os << "Soft"; 
         }
@@ -271,6 +250,66 @@ namespace Exiv2 {
         return os;
     }
 
+    // Olympus Datadump Tag Info
+    const TagInfo OlympusMakerNote::tagInfoDd_[] = {
+        TagInfo(0x000b, "Function", "Function", olympusDdIfdId, makerTags, undefined, printDd0x000b),
+        TagInfo(0x008a, "WhiteBalance", "White balance mode", olympusDdIfdId, makerTags, undefined, printDd0x008a),
+        TagInfo(0x0097, "Sharpness", "Sharpness", olympusDdIfdId, makerTags, undefined, printDd0x0097),
+        // End of list marker
+        TagInfo(0xffff, "(UnknownOlympusDdTag)", "Unknown Olympus Datadump tag", olympusDdIfdId, makerTags, invalidTypeId, printValue)
+    };
+
+    void OlympusMakerNote::add(const Entry& entry)
+    {
+        assert(alloc_ == entry.alloc());
+        assert(entry.ifdId() == olympusIfdId || entry.ifdId() == olympusDdIfdId);
+        // allow duplicates
+        entries_.push_back(entry);
+    }
+
+    int OlympusMakerNote::read(const byte* buf,
+                               long len, 
+                               ByteOrder byteOrder, 
+                               long offset)
+    {
+        int rc = IfdMakerNote::read(buf, len, byteOrder, offset);
+        if (rc) return rc;
+        entries_.assign(ifd_.begin(), ifd_.end());
+        // Decode datadump and add known settings as additional entries
+        Entries::const_iterator datadump = ifd_.findTag(0x0f00);
+        if (datadump != ifd_.end()) {
+            Entry fc(false);
+            fc.setIfdId(olympusDdIfdId);
+            fc.setTag(0x000b);
+            fc.setIdx(1);
+            fc.setOffset(datadump->offset() + 11);
+            fc.setValue(undefined, 1, datadump->data() + 11, 1);
+            add(fc);
+            
+            Entry wb(false);
+            wb.setIfdId(olympusDdIfdId);
+            wb.setTag(0x008a);
+            wb.setIdx(2);
+            wb.setOffset(datadump->offset() + 138);
+            wb.setValue(undefined, 1, datadump->data() + 138, 1);
+            add(wb);
+            
+            Entry sh(false);
+            sh.setIfdId(olympusDdIfdId);
+            sh.setTag(0x0097);
+            sh.setIdx(3);
+            sh.setOffset(datadump->offset() + 151);
+            sh.setValue(undefined, 2, datadump->data() + 151, 2);
+            add(sh);
+            // The original datadump could be discarded here but since we
+            // only know three 3 entries of it I leave it here for now
+        }
+        return rc;
+    }
+
+// <------------------------- Experimental code -------------------------
+
+
 // *****************************************************************************
 // free functions
 
diff --git a/src/olympusmn.hpp b/src/olympusmn.hpp
index 8c8834e..fa16c9b 100644
--- a/src/olympusmn.hpp
+++ b/src/olympusmn.hpp
@@ -140,6 +140,7 @@ namespace Exiv2 {
 
         //! Tag information
         static const TagInfo tagInfo_[];
+        static const TagInfo tagInfoDd_[]; // Experimental code
 
         //! Structure used to auto-register the MakerNote.
         struct RegisterMakerNote {
@@ -151,6 +152,11 @@ namespace Exiv2 {
                 mnf.registerMakerNote(olympusIfdId,
                                       MakerNote::AutoPtr(new OlympusMakerNote));
                 ExifTags::registerMakerTagInfo(olympusIfdId, tagInfo_);
+                // Experimental code --->
+                mnf.registerMakerNote(olympusDdIfdId,
+                                      MakerNote::AutoPtr(new OlympusMakerNote));
+                ExifTags::registerMakerTagInfo(olympusDdIfdId, tagInfoDd_);
+                // <--- Experimental code
             }
         };
         // DATA
@@ -168,6 +174,28 @@ namespace Exiv2 {
          */
         static const RegisterMakerNote register_;
 
+// -------------------------- Experimental code ------------------------>
+
+    public: 
+        int read(const byte* buf,
+                 long len, 
+                 ByteOrder byteOrder, 
+                 long offset);
+        void add(const Entry& entry);
+        Entries::iterator begin() { return entries_.begin(); }
+        Entries::iterator end() { return entries_.end(); }
+        Entries::const_iterator begin() const { return entries_.begin(); }
+        Entries::const_iterator end() const { return entries_.end(); }
+
+        static std::ostream& printDd0x000b(std::ostream& os, const Value& value);
+        static std::ostream& printDd0x008a(std::ostream& os, const Value& value);
+        static std::ostream& printDd0x0097(std::ostream& os, const Value& value);
+
+    private:
+        Entries entries_;
+
+// <------------------------- Experimental code -------------------------
+
     }; // class OlympusMakerNote
 
 }                                       // namespace Exiv2
diff --git a/src/tags.cpp b/src/tags.cpp
index 128f8a3..9a7b267 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -70,6 +70,7 @@ namespace Exiv2 {
         IfdInfo(nikon3IfdId, "Makernote", "Nikon3"),
         IfdInfo(nikon3ThumbIfdId, "Makernote", "Nikon3Thumb"),
         IfdInfo(olympusIfdId, "Makernote", "Olympus"),
+        IfdInfo(olympusDdIfdId, "Makernote", "OlympusDd"),
         IfdInfo(sigmaIfdId, "Makernote", "Sigma"),
         IfdInfo(lastIfdId, "(Last IFD info)", "(Last IFD item)")
     };
diff --git a/src/types.hpp b/src/types.hpp
index eedeecf..3d299c7 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -89,7 +89,7 @@ namespace Exiv2 {
     enum IfdId { ifdIdNotSet, 
                  ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id, 
                  canonIfdId, fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId, 
-                 nikon3ThumbIfdId, olympusIfdId, sigmaIfdId,
+                 nikon3ThumbIfdId, olympusIfdId, olympusDdIfdId, sigmaIfdId,
                  lastIfdId };
 
 // *****************************************************************************

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list