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


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

The following commit has been merged in the master branch:
commit 4ed27573aa3a4d94c0b55d09bdb6ad8f34474a57
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat May 13 12:29:47 2006 +0000

    Added support for Minolta camera settings to the new TIFF parser
---
 src/makernote2.hpp    |  4 ++++
 src/tiffcomposite.cpp | 52 +++++++++++++++++++++------------------------
 src/tiffcomposite.hpp | 59 +++++++++++++++++++++++++--------------------------
 src/tiffparser.cpp    | 48 ++++++++++++++++++++++++-----------------
 src/tiffvisitor.cpp   | 30 ++++++++------------------
 5 files changed, 95 insertions(+), 98 deletions(-)

diff --git a/src/makernote2.hpp b/src/makernote2.hpp
index 0ae2989..b1f3e4b 100644
--- a/src/makernote2.hpp
+++ b/src/makernote2.hpp
@@ -59,6 +59,10 @@ namespace Exiv2 {
         const uint16_t sony1mn   = 270; //!< Sony1 makernote
         const uint16_t sony2mn   = 271; //!< Sony2 makernote
         const uint16_t minoltamn = 272; //!< Minolta makernote
+        const uint16_t minocso   = 273; //!< Minolta camera settings (old)
+        const uint16_t minocsn   = 274; //!< Minolta camera settings (new)
+        const uint16_t minocs5   = 275; //!< Minolta camera settings (D5)
+        const uint16_t minocs7   = 276; //!< Minolta camera settings (D7)
     }
 
 // *****************************************************************************
diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp
index 54f4467..877fc7d 100644
--- a/src/tiffcomposite.cpp
+++ b/src/tiffcomposite.cpp
@@ -94,28 +94,32 @@ namespace Exiv2 {
         //       Possibly the whole function shouldn't be in this class...
         std::string group;
         switch (group_) {
-        case   1: group = "Image";     break;
-        case   2: group = "Thumbnail"; break;
-        case   3: group = "Photo";     break;
-        case   4: group = "GPSInfo";   break;
-        case   5: group = "Iop";       break;
-        case 257: group = "Olympus";   break;
-        case 258: group = "Fujifilm";  break;
-        case 259: group = "Canon";     break;
-        case 260: group = "CanonCs1";  break;
-        case 261: group = "CanonCs2";  break;
-        case 262: group = "CanonCf";   break;
+        case   1: group = "Image";        break;
+        case   2: group = "Thumbnail";    break;
+        case   3: group = "Photo";        break;
+        case   4: group = "GPSInfo";      break;
+        case   5: group = "Iop";          break;
+        case 257: group = "Olympus";      break;
+        case 258: group = "Fujifilm";     break;
+        case 259: group = "Canon";        break;
+        case 260: group = "CanonCs1";     break;
+        case 261: group = "CanonCs2";     break;
+        case 262: group = "CanonCf";      break;
         // 263 not needed (nikonmn)
-        case 264: group = "Nikon1";    break;
-        case 265: group = "Nikon2";    break;
-        case 266: group = "Nikon3";    break;
-        case 267: group = "Panasonic"; break;
-        case 268: group = "Sigma";     break;
+        case 264: group = "Nikon1";       break;
+        case 265: group = "Nikon2";       break;
+        case 266: group = "Nikon3";       break;
+        case 267: group = "Panasonic";    break;
+        case 268: group = "Sigma";        break;
         // 269 not needed (sonymn)
-        case 270: group = "Sony";      break;
-        case 271: group = "Sony";      break;
-        case 272: group = "Minolta";   break;
-        default:  group = "Unknown";   break;
+        case 270: group = "Sony";         break;
+        case 271: group = "Sony";         break;
+        case 272: group = "Minolta";      break;
+        case 273: group = "MinoltaCsOld"; break;
+        case 274: group = "MinoltaCsNew"; break;
+        case 275: group = "MinoltaCs5D";  break;
+        case 276: group = "MinoltaCs7D";  break;
+        default:  group = "Unknown";      break;
         }
         return group;
     }
@@ -259,14 +263,6 @@ namespace Exiv2 {
                                                       ts->newGroup_));
     }
 
-    TiffComponent::AutoPtr newTiffArrayElement(uint16_t tag,
-                                               const TiffStructure* ts)
-    {
-        assert(ts);
-        return TiffComponent::AutoPtr(new TiffArrayElement(tag,
-                                                           ts->group_));
-    }
-
     TiffComponent::AutoPtr newTiffThumbData(uint16_t tag,
                                             const TiffStructure* ts)
     {
diff --git a/src/tiffcomposite.hpp b/src/tiffcomposite.hpp
index 840d0e6..f319185 100644
--- a/src/tiffcomposite.hpp
+++ b/src/tiffcomposite.hpp
@@ -473,18 +473,19 @@ namespace Exiv2 {
       @brief Composite to model an array of tags, each consisting of one 
              unsigned short value. Canon and Minolta makernotes use such tags. 
              The elements of this component are usually of type
-             TiffArrayElement.  If the type of the entry is not unsigned short,
-             it degenerates to a standard TIFF entry.
+             TiffArrayElement.
      */
     class TiffArrayEntry : public TiffEntryBase {
     public:
         //! @name Creators
         //@{
         //! Default constructor
-        TiffArrayEntry(TypeId typeId, ByteOrder byteOrder, 
-                       uint16_t tag, uint16_t group, uint16_t elGroup)
+        TiffArrayEntry(uint16_t tag, 
+                       uint16_t group, 
+                       uint16_t elGroup,
+                       uint16_t elSize)
             : TiffEntryBase(tag, group), 
-              elTypeId_(typeId), elByteOrder_(byteOrder),
+              elSize_(elSize), 
               elGroup_(elGroup) {}
         //! Virtual destructor
         virtual ~TiffArrayEntry();
@@ -493,11 +494,9 @@ namespace Exiv2 {
         //! @name Accessors
         //@{
         //! Return the type for the array elements
-        TypeId    elTypeId()    const { return elTypeId_; }
-        //! Return the byte order for reading and writing array elements
-        ByteOrder elByteOrder() const { return elByteOrder_; }
+        uint16_t  elSize()  const { return elSize_; }
         //! Return the group for the array elements
-        uint16_t  elGroup()     const { return elGroup_; }
+        uint16_t  elGroup() const { return elGroup_; }
         //@}
 
     private:
@@ -509,8 +508,7 @@ namespace Exiv2 {
 
     private:
         // DATA
-        TypeId     elTypeId_;    //!< Type of the array elements
-        ByteOrder  elByteOrder_; //!< Byte order for reading/writing array elements
+        uint16_t   elSize_;      //!< Size of the array elements (in bytes)
         uint16_t   elGroup_;     //!< Group for the elements
         Components elements_;    //!< List of elements in this composite
     }; // class TiffArrayEntry
@@ -525,10 +523,13 @@ namespace Exiv2 {
         //! @name Creators
         //@{
         //! Constructor
-        TiffArrayElement(uint16_t tag, uint16_t group) 
+        TiffArrayElement(uint16_t  tag, 
+                         uint16_t  group,
+                         TypeId    elTypeId, 
+                         ByteOrder elByteOrder) 
             : TiffEntryBase(tag, group),
-              elTypeId_(undefined), 
-              elByteOrder_(invalidByteOrder) {}
+              elTypeId_(elTypeId), 
+              elByteOrder_(elByteOrder) {}
         //! Virtual destructor.
         virtual ~TiffArrayElement() {}
         //@}
@@ -539,12 +540,6 @@ namespace Exiv2 {
         ByteOrder elByteOrder() const { return elByteOrder_; }
         //@}
 
-        //! @name Manipulators
-        //@{
-        void setTypeId(TypeId typeId)          { elTypeId_ = typeId; }
-        void setByteOrder(ByteOrder byteOrder) { elByteOrder_ = byteOrder; }
-        //@}
-
     private:
         //! @name Manipulators
         //@{
@@ -574,27 +569,31 @@ namespace Exiv2 {
                                           const TiffStructure* ts);
 
     //! Function to create and initialize a new array entry
-    template<TypeId typeId, ByteOrder byteOrder>
+    template<uint16_t elSize>
     TiffComponent::AutoPtr newTiffArrayEntry(uint16_t tag,
                                              const TiffStructure* ts)
     {
         assert(ts);
         return TiffComponent::AutoPtr(
-            new TiffArrayEntry(typeId, byteOrder,
-                               tag, ts->group_, ts->newGroup_));
+            new TiffArrayEntry(tag, ts->group_, ts->newGroup_, elSize));
     }
 
-    //! Function to create and initialize a new array entry
-    template<TypeId typeId>
-    TiffComponent::AutoPtr newTiffArrayEntry(uint16_t tag,
-                                             const TiffStructure* ts)
+    //! Function to create and initialize a new array element
+    template<TypeId typeId, ByteOrder byteOrder>
+    TiffComponent::AutoPtr newTiffArrayElement(uint16_t tag,
+                                               const TiffStructure* ts)
     {
-        return newTiffArrayEntry<typeId, invalidByteOrder>(tag, ts);
+        assert(ts);
+        return TiffComponent::AutoPtr(
+            new TiffArrayElement(tag, ts->group_, typeId, byteOrder));
     }
 
-    //! Function to create and initialize a new array element
+    template<TypeId typeId>
     TiffComponent::AutoPtr newTiffArrayElement(uint16_t tag,
-                                               const TiffStructure* ts);
+                                               const TiffStructure* ts)
+    {
+        return newTiffArrayElement<typeId, invalidByteOrder>(tag, ts);
+    }
 
     //! Function to create and initialize a new TIFF entry for a Jpeg thumbnail (data)
     TiffComponent::AutoPtr newTiffThumbData(uint16_t tag,
diff --git a/src/tiffparser.cpp b/src/tiffparser.cpp
index 74f964f..54fdc2f 100644
--- a/src/tiffparser.cpp
+++ b/src/tiffparser.cpp
@@ -92,26 +92,36 @@ namespace Exiv2 {
       new component is.
      */
     const TiffStructure TiffCreator::tiffStructure_[] = {
-        // ext. tag  group           create function      new group
-        //---------  --------------  -------------------  --------------
-        { Tag::root, Group::none,    newTiffDirectory,    Group::ifd0    },
-        {    0x8769, Group::ifd0,    newTiffSubIfd,       Group::exif    },
-        {    0x8825, Group::ifd0,    newTiffSubIfd,       Group::gps     },
-        {    0x014a, Group::ifd0,    newTiffSubIfd,       Group::ignr    }, // todo: better support
-        {    0xa005, Group::exif,    newTiffSubIfd,       Group::iop     },
-        {    0x927c, Group::exif,    newTiffMnEntry,      Group::mn      },
-        {    0x0201, Group::ifd1,    newTiffThumbData,    Group::ifd1    },
-        {    0x0202, Group::ifd1,    newTiffThumbSize,    Group::ifd1    },
-        { Tag::next, Group::ifd0,    newTiffDirectory,    Group::ifd1    },
-        { Tag::next, Group::ifd1,    newTiffDirectory,    Group::ignr    },
-        { Tag::next, Group::ignr,    newTiffDirectory,    Group::ignr    },
+        // ext. tag  group             create function       new group
+        //---------  --------------    -------------------   --------------
+        { Tag::root, Group::none,      newTiffDirectory,     Group::ifd0    },
+        {    0x8769, Group::ifd0,      newTiffSubIfd,        Group::exif    },
+        {    0x8825, Group::ifd0,      newTiffSubIfd,        Group::gps     },
+        {    0x014a, Group::ifd0,      newTiffSubIfd,        Group::ignr    }, // todo: better support
+        {    0xa005, Group::exif,      newTiffSubIfd,        Group::iop     },
+        {    0x927c, Group::exif,      newTiffMnEntry,       Group::mn      },
+        {    0x0201, Group::ifd1,      newTiffThumbData,     Group::ifd1    },
+        {    0x0202, Group::ifd1,      newTiffThumbSize,     Group::ifd1    },
+        { Tag::next, Group::ifd0,      newTiffDirectory,     Group::ifd1    },
+        { Tag::next, Group::ifd1,      newTiffDirectory,     Group::ignr    },
+        { Tag::next, Group::ignr,      newTiffDirectory,     Group::ignr    },
         // Canon makernote structure
-        {    0x0001, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canoncs },
-        {    0x0004, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canonsi },
-        {    0x000f, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canoncf },
-        {  Tag::all, Group::canoncs, newTiffArrayElement, Group::canoncs },
-        {  Tag::all, Group::canonsi, newTiffArrayElement, Group::canonsi },
-        {  Tag::all, Group::canoncf, newTiffArrayElement, Group::canoncf }
+        {    0x0001, Group::canonmn,   newTiffArrayEntry<2>, Group::canoncs },
+        {    0x0004, Group::canonmn,   newTiffArrayEntry<2>, Group::canonsi },
+        {    0x000f, Group::canonmn,   newTiffArrayEntry<2>, Group::canoncf },
+        {  Tag::all, Group::canoncs,   newTiffArrayElement<unsignedShort>, Group::canoncs },
+        {  Tag::all, Group::canonsi,   newTiffArrayElement<unsignedShort>, Group::canonsi },
+        {  Tag::all, Group::canoncf,   newTiffArrayElement<unsignedShort>, Group::canoncf },
+        // Minolta makernote structure
+        {    0x0001, Group::minoltamn, newTiffArrayEntry<4>, Group::minocso },
+        {    0x0003, Group::minoltamn, newTiffArrayEntry<4>, Group::minocsn },
+        {    0x0004, Group::minoltamn, newTiffArrayEntry<2>, Group::minocs7 },
+        {    0x0114, Group::minoltamn, newTiffArrayEntry<2>, Group::minocs5 },
+        {  Tag::all, Group::minocso,   newTiffArrayElement<unsignedLong,  bigEndian>, Group::minocso },
+        {  Tag::all, Group::minocsn,   newTiffArrayElement<unsignedLong,  bigEndian>, Group::minocsn },
+        {  Tag::all, Group::minocs7,   newTiffArrayElement<unsignedShort, bigEndian>, Group::minocs7 },
+        {  Tag::all, Group::minocs5,   newTiffArrayElement<unsignedShort, bigEndian>, Group::minocs5 }
+
     };
 
     TiffComponent::AutoPtr TiffCreator::create(uint32_t extendedTag,
diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index f97d1eb..8962400 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -196,12 +196,7 @@ namespace Exiv2 {
 
     void TiffMetadataDecoder::visitArrayEntry(TiffArrayEntry* object)
     {
-        assert(object != 0);
-
-        // Array entry degenerates to a normal entry if type is not unsignedShort
-        if (object->typeId() != unsignedShort) {
-            decodeTiffEntry(object);
-        }
+        // Nothing to do
     }
 
     void TiffMetadataDecoder::visitArrayElement(TiffArrayElement* object)
@@ -315,9 +310,7 @@ namespace Exiv2 {
             printTiffEntry(object, prefix());
         }
         else {
-            os_ << prefix() << "Array Entry ("
-                << TypeInfo::typeName(object->elTypeId()) << ")"
-                << object->groupName()
+            os_ << prefix() << "Array Entry " << object->groupName()
                 << " tag 0x" << std::setw(4) << std::setfill('0')
                 << std::hex << std::right << object->tag() << "
";
         }
@@ -684,18 +677,13 @@ namespace Exiv2 {
         assert(object != 0);
 
         readTiffEntry(object);
-        if (object->typeId() == object->elTypeId()) {
-            for (uint16_t i = 0; i < static_cast<uint16_t>(object->count()); ++i) {
-                uint16_t tag = i;
-                TiffComponent::AutoPtr tc = create(tag, object->elGroup());
-                TiffArrayElement* p = dynamic_cast<TiffArrayElement*>(tc.get());
-                assert(p); // Fix TIFF structure table if this fails
-                p->setStart(  object->pData() 
-                            + i * TypeInfo::typeSize(object->elTypeId()));
-                p->setTypeId(object->elTypeId());
-                p->setByteOrder(object->elByteOrder());
-                object->addChild(tc);
-            }
+        uint16_t s = static_cast<uint16_t>(object->size() / object->elSize());
+        for (uint16_t i = 0; i < s; ++i) {
+            uint16_t tag = i;
+            TiffComponent::AutoPtr tc = create(tag, object->elGroup());
+            assert(tc.get());
+            tc->setStart(object->pData() + i * object->elSize());
+            object->addChild(tc);
         }
 
     } // TiffReader::visitArrayEntry

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list