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


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

The following commit has been merged in the master branch:
commit fe512e1470df4dd42d3502fc6418c8a89380ac57
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Jun 23 12:08:27 2006 +0000

    TiffParser can now be parametrized with a decoder. Added Cr2Image which uses this to filter not applicable IFD0 tags.
---
 src/Makefile                        |   1 +
 src/{tiffimage.cpp => cr2image.cpp} | 117 +++++++++++++++++++++++-------------
 src/{tiffimage.hpp => cr2image.hpp} | 104 ++++++++++++++++++++------------
 src/imgreg.cpp                      |   4 +-
 src/mrwimage.cpp                    |   3 +-
 src/pngchunk.cpp                    |   3 +-
 src/tiffcomposite.hpp               |  14 +++++
 src/tiffimage.cpp                   |   4 +-
 src/tiffparser.cpp                  |  44 ++++++++++++--
 src/tiffparser.hpp                  |  65 +++++++++++++++++++-
 src/tiffvisitor.cpp                 |  44 ++++++--------
 src/tiffvisitor.hpp                 |  43 ++-----------
 12 files changed, 291 insertions(+), 155 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index e9f10a7..7b03d9f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -56,6 +56,7 @@ CCHDR =  exiv2_version.h      \
 # Add library C++ source files to this list
 CCSRC =  basicio.cpp          \
 	 canonmn.cpp          \
+	 cr2image.cpp         \
 	 crwimage.cpp         \
 	 datasets.cpp         \
 	 error.cpp            \
diff --git a/src/tiffimage.cpp b/src/cr2image.cpp
similarity index 57%
copy from src/tiffimage.cpp
copy to src/cr2image.cpp
index 2ba5156..727867c 100644
--- a/src/tiffimage.cpp
+++ b/src/cr2image.cpp
@@ -19,10 +19,10 @@
  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
  */
 /*
-  File:      tiffimage.cpp
+  File:      cr2image.cpp
   Version:   $Rev$
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   15-Mar-06, ahu: created
+  History:   22-Apr-06, ahu: created
 
  */
 // *****************************************************************************
@@ -37,84 +37,115 @@ EXIV2_RCSID("@(#) $Id$")
 # include "exv_conf.h"
 #endif
 
-#include "tiffimage.hpp"
+#include "cr2image.hpp"
 #include "tiffparser.hpp"
+#include "tiffvisitor.hpp"
 #include "image.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 
 // + standard includes
-#include <string>
 #include <iostream>
 #include <iomanip>
 #include <cassert>
+#include <cstring>
 
 // *****************************************************************************
 // class member definitions
 namespace Exiv2 {
 
-    TiffImage::TiffImage(BasicIo::AutoPtr io, bool create)
-        : Image(mdExif | mdIptc | mdComment), io_(io)
+    // CR2 decoder table for special CR2 decoding requirements
+    const TiffDecoderInfo Cr2DecoderItems::cr2DecoderInfo_[] = {
+        { "*",       Tag::all, Group::ignr,    0 }, // Do not decode tags with group == Group::ignr
+        { "*",         0x014a, Group::ifd0,    0 }, // Todo: Controversial, causes problems with Exiftool
+        { "*",         0x0100, Group::ifd0,    0 }, // CR2 IFD0 refers to a preview image, ignore these tags
+        { "*",         0x0101, Group::ifd0,    0 },
+        { "*",         0x0102, Group::ifd0,    0 },
+        { "*",         0x0103, Group::ifd0,    0 },
+        { "*",         0x0111, Group::ifd0,    0 },
+        { "*",         0x0117, Group::ifd0,    0 },
+        { "*",         0x011a, Group::ifd0,    0 },
+        { "*",         0x011b, Group::ifd0,    0 },
+        { "*",         0x0128, Group::ifd0,    0 },
+        { "*",         0x8649, Group::ifd0,    &TiffMetadataDecoder::decodeIrbIptc    }
+    };
+
+    const DecoderFct Cr2DecoderItems::findDecoder(const std::string& make, 
+                                                        uint32_t     extendedTag,
+                                                        uint16_t     group)
+    {
+        DecoderFct decoderFct = &TiffMetadataDecoder::decodeStdTiffEntry;
+        const TiffDecoderInfo* td = find(cr2DecoderInfo_, 
+                                         TiffDecoderInfo::Key(make, extendedTag, group));
+        if (td) {
+            // This may set decoderFct to 0, meaning that the tag should not be decoded
+            decoderFct = td->decoderFct_;
+        }
+        return decoderFct;
+    }
+
+    Cr2Image::Cr2Image(BasicIo::AutoPtr io, bool create)
+        : Image(mdExif | mdIptc), io_(io)
     {
         if (create) {
             IoCloser closer(*io_);
             io_->open();
         }
-    } // TiffImage::TiffImage
+    } // Cr2Image::Cr2Image
 
-    bool TiffImage::good() const
+    bool Cr2Image::good() const
     {
         if (io_->open() != 0) return false;
         IoCloser closer(*io_);
         return isThisType(*io_, false);
     }
 
-    void TiffImage::clearMetadata()
+    void Cr2Image::clearMetadata()
     {
         clearExifData();
         clearComment();
     }
 
-    void TiffImage::setMetadata(const Image& image)
+    void Cr2Image::setMetadata(const Image& image)
     {
         setExifData(image.exifData());
         setComment(image.comment());
     }
 
-    void TiffImage::clearExifData()
+    void Cr2Image::clearExifData()
     {
         exifData_.clear();
     }
 
-    void TiffImage::setExifData(const ExifData& exifData)
+    void Cr2Image::setExifData(const ExifData& exifData)
     {
         exifData_ = exifData;
     }
 
-    void TiffImage::clearIptcData()
+    void Cr2Image::clearIptcData()
     {
         iptcData_.clear();
     }
 
-    void TiffImage::setIptcData(const IptcData& iptcData)
+    void Cr2Image::setIptcData(const IptcData& iptcData)
     {
         iptcData_ = iptcData;
     }
 
-    void TiffImage::clearComment()
+    void Cr2Image::clearComment()
     {
         comment_.erase();
     }
 
-    void TiffImage::setComment(const std::string& comment)
+    void Cr2Image::setComment(const std::string& comment)
     {
         comment_ = comment;
     }
 
-    void TiffImage::readMetadata()
+    void Cr2Image::readMetadata()
     {
 #ifdef DEBUG
-        std::cerr << "Reading TIFF file " << io_->path() << "
";
+        std::cerr << "Reading CR2 file " << io_->path() << "
";
 #endif
         if (io_->open() != 0) {
             throw Error(9, io_->path(), strError());
@@ -123,7 +154,7 @@ namespace Exiv2 {
         // Ensure that this is the correct image type
         if (!isThisType(*io_, false)) {
             if (io_->error() || io_->eof()) throw Error(14);
-            throw Error(33);
+            throw Error(3, "CR2");
         }
         clearMetadata();
 
@@ -133,17 +164,18 @@ namespace Exiv2 {
         io_->read(buf.pData_, len);
         if (io_->error() || io_->eof()) throw Error(14);
 
-        TiffParser::decode(this, buf.pData_, buf.size_, TiffCreator::create);
-    } // TiffImage::readMetadata
+        TiffParser::decode(this, buf.pData_, buf.size_, 
+                           TiffCreator::create, Cr2DecoderItems::findDecoder);
+    } // Cr2Image::readMetadata
 
-    void TiffImage::writeMetadata()
+    void Cr2Image::writeMetadata()
     {
 /*
 
        Todo: implement me!
 
 #ifdef DEBUG
-        std::cerr << "Writing TIFF file " << io_->path() << "
";
+        std::cerr << "Writing CR2 file " << io_->path() << "
";
 #endif
         // Read existing image
         DataBuf buf;
@@ -160,14 +192,14 @@ namespace Exiv2 {
             }
         }
 
-        // Parse image, starting with a TIFF header component
-        TiffHeade2::AutoPtr head(new TiffHeade2);
+        // Parse image, starting with a CR2 header component
+        Cr2Header::AutoPtr head(new Cr2Header);
         if (buf.size_ != 0) {
             head->read(buf.pData_, buf.size_);
         }
 
         Blob blob;
-        TiffParser::encode(blob, head.get(), this);
+        Cr2Parser::encode(blob, head.get(), this);
 
         // Write new buffer to file
         BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
@@ -176,18 +208,19 @@ namespace Exiv2 {
         io_->close();
         io_->transfer(*tempIo); // may throw
 */
-    } // TiffImage::writeMetadata
+    } // Cr2Image::writeMetadata
 
-    bool TiffImage::isThisType(BasicIo& iIo, bool advance) const
+    bool Cr2Image::isThisType(BasicIo& iIo, bool advance) const
     {
-        return isTiffType(iIo, advance);
+        return isCr2Type(iIo, advance);
     }
 
-    const uint16_t TiffHeade2::tag_ = 42;
+    const uint16_t Cr2Header::tag_ = 42;
+    const char* Cr2Header::cr2sig_ = "CR

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list