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


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

The following commit has been merged in the master branch:
commit cdae02333f795a544e30c62f4739099feff887b8
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Mon Mar 8 16:37:25 2004 +0000

    Makernote write support, part 2
---
 src/exif.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++----------
 src/exif.hpp | 21 ++++++++++++++++++++-
 src/ifd.cpp  | 12 ++++++++++--
 src/ifd.hpp  |  8 +++++++-
 4 files changed, 84 insertions(+), 14 deletions(-)

diff --git a/src/exif.cpp b/src/exif.cpp
index fb2cc56..f44bd4f 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -20,14 +20,14 @@
  */
 /*
   File:      exif.cpp
-  Version:   $Name:  $ $Revision: 1.25 $
+  Version:   $Name:  $ $Revision: 1.26 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.25 $ $RCSfile: exif.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.26 $ $RCSfile: exif.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -618,13 +618,18 @@ std::cout << "->>>>>> writing from metadata <<<<<<-
";
         long exifIfdOffset = ifd0Offset + ifd0.size() + ifd0.dataSize();
         Ifd exifIfd(exifIfd, exifIfdOffset);
         addToIfd(exifIfd, begin(), end(), byteOrder());
+        MakerNote* makerNote = 0;
         if (makerNote_) {
+            // Build MakerNote from metadata
+            makerNote = makerNote_->clone();
+            makerNote->clear();
+            addToMakerNote(makerNote, begin(), end(), byteOrder());
             // Create a placeholder MakerNote entry of the correct size and
-            // add it to the Exif IFD
+            // add it to the Exif IFD (because we don't know the offset yet)
             Entry e;
-            e.setIfdId(makerIfd);
+            e.setIfdId(exifIfd.ifdId());
             e.setTag(0x927c);
-            long size = makerNote_->size();
+            long size = makerNote->size();
             char* buf = new char[size];
             memset(buf, 0x0, size);
             e.setValue(undefined, size, buf, size); 
@@ -678,12 +683,15 @@ std::cout << "->>>>>> writing from metadata <<<<<<-
";
         ifd0.copy(buf + ifd0Offset, byteOrder(), ifd0Offset);
         exifIfd.sortByTag();
         exifIfd.copy(buf + exifIfdOffset, byteOrder(), exifIfdOffset);
-        if (makerNote_) {
+        if (makerNote) {
             // Copy the MakerNote over the placeholder data
             Entries::iterator mn = exifIfd.findTag(0x927c);
-            makerNote_->copy(buf + exifIfdOffset + mn->offset(),
-                             byteOrder(), 
-                             exifIfdOffset + mn->offset());
+            makerNote->sortByTag();
+            makerNote->copy(buf + exifIfdOffset + mn->offset(),
+                            byteOrder(),
+                            exifIfdOffset + mn->offset());
+            delete makerNote;
+            makerNote = 0;
         }
         iopIfd.sortByTag();
         iopIfd.copy(buf + iopIfdOffset, byteOrder(), iopIfdOffset);
@@ -925,7 +933,7 @@ std::cout << "->>>>>> writing from metadata <<<<<<-
";
         // Todo: Implement Assert (Stroustup 24.3.7.2)
         if (!ifd.alloc()) throw Error("Invariant violated in addToIfd");
 
-        Entry e(ifd.alloc());
+        Entry e;
         e.setIfdId(metadatum.ifdId());
         e.setIdx(metadatum.idx());
         e.setTag(metadatum.tag());
@@ -937,6 +945,35 @@ std::cout << "->>>>>> writing from metadata <<<<<<-
";
         delete[] buf;
     } // addToIfd
 
+    void addToMakerNote(MakerNote* makerNote,
+                        Metadata::const_iterator begin,
+                        Metadata::const_iterator end, 
+                        ByteOrder byteOrder)
+    {
+        for (Metadata::const_iterator i = begin; i != end; ++i) {
+            // add only metadata with IFD id 'makerIfd'
+            if (i->ifdId() == makerIfd) {
+                addToMakerNote(makerNote, *i, byteOrder);
+            }
+        }
+    } // addToMakerNote
+
+    void addToMakerNote(MakerNote* makerNote,
+                        const Metadatum& metadatum,
+                        ByteOrder byteOrder)
+    {
+        Entry e;
+        e.setIfdId(metadatum.ifdId());
+        e.setIdx(metadatum.idx());
+        e.setTag(metadatum.tag());
+        e.setOffset(0);  // will be calculated when the makernote is written
+        char* buf = new char[metadatum.size()];
+        metadatum.copy(buf, byteOrder);
+        e.setValue(metadatum.typeId(), metadatum.count(), buf, metadatum.size()); 
+        makerNote->add(e);
+        delete[] buf;
+    } // addToMakerNote
+
     bool cmpMetadataByTag(const Metadatum& lhs, const Metadatum& rhs)
     {
         return lhs.tag() < rhs.tag();
diff --git a/src/exif.hpp b/src/exif.hpp
index 824ed85..7ee5836 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    exif.hpp
   @brief   Encoding and decoding of %Exif data
-  @version $Name:  $ $Revision: 1.26 $
+  @version $Name:  $ $Revision: 1.27 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    09-Jan-04, ahu: created
@@ -677,6 +677,25 @@ namespace Exif {
      */
     void addToIfd(Ifd& ifd, const Metadatum& metadatum, ByteOrder byteOrder);
     /*!
+      @brief Add all metadata in the range from iterator position begin to
+             iterator position end with IFD id 'makerIfd' to the list of
+             makernote entries of the object pointed to be makerNote.  No
+             duplicate checks are performed, i.e., it is possible to add
+             multiple metadata with the same key to a makernote.
+     */
+    void addToMakerNote(MakerNote* makerNote,
+                        Metadata::const_iterator begin,
+                        Metadata::const_iterator end, 
+                        ByteOrder byteOrder);
+    /*!
+      @brief Add the metadatum to makerNote, encoded in byte order byteOrder.
+             No duplicate checks are performed, i.e., it is possible to add
+             multiple metadata with the same key to a makernote.
+     */
+    void addToMakerNote(MakerNote* makerNote,
+                        const Metadatum& metadatum,
+                        ByteOrder byteOrder);
+    /*!
       @brief Compare two metadata by tag. Return true if the tag of metadatum
              lhs is less than that of rhs.
      */
diff --git a/src/ifd.cpp b/src/ifd.cpp
index c4b7a6e..0f2dadd 100644
--- a/src/ifd.cpp
+++ b/src/ifd.cpp
@@ -20,20 +20,21 @@
  */
 /*
   File:      ifd.cpp
-  Version:   $Name:  $ $Revision: 1.5 $
+  Version:   $Name:  $ $Revision: 1.6 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.5 $ $RCSfile: ifd.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.6 $ $RCSfile: ifd.cpp,v $")
 
 // *****************************************************************************
 // included header files
 #include "ifd.hpp"
 #include "types.hpp"
 #include "error.hpp"
+#include "tags.hpp"                             // for ExifTags::ifdName
 
 // + standard includes
 #include <iostream>
@@ -304,6 +305,13 @@ namespace Exif {
         return o;
     } // Ifd::copy
 
+    void Ifd::clear()
+    {
+        offset_ = 0;
+        next_ = 0;
+        entries_.clear();
+    } // Ifd::clear
+
     void Ifd::add(const Entry& entry)
     {
         // Todo: Implement Assert (Stroustup 24.3.7.2)
diff --git a/src/ifd.hpp b/src/ifd.hpp
index dc9c2f6..9ccc3dd 100644
--- a/src/ifd.hpp
+++ b/src/ifd.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    ifd.hpp
   @brief   Encoding and decoding of IFD (Image File Directory) data
-  @version $Name:  $ $Revision: 1.7 $
+  @version $Name:  $ $Revision: 1.8 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    09-Jan-04, ahu: created
@@ -325,6 +325,12 @@ namespace Exif {
           @return Returns the number of characters written.
          */
         long copy(char* buf, ByteOrder byteOrder, long offset =0);
+        /*!
+          @brief Reset the IFD. Delete all IFD entries from the class and put
+                 the object in a state where it can accept completely new
+                 entries.
+         */
+        void clear();
         //! Set the offset of the next IFD
         void setNext(uint32 next) { next_ = next; }
         /*!

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list