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


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

The following commit has been merged in the master branch:
commit 1211167329969f6a552e70b644278fe69a6e0a65
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat Apr 3 07:30:56 2004 +0000

    Added Summary output, improved print functions
---
 src/actions.cpp | 213 ++++++++++++++++++++++++++++++++++++++++----------------
 src/actions.hpp |   9 +--
 src/tags.cpp    |  20 +++++-
 src/tags.hpp    |   4 +-
 4 files changed, 179 insertions(+), 67 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index 77df3c4..7c47464 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,13 +20,13 @@
  */
 /*
   File:      actions.cpp
-  Version:   $Name:  $ $Revision: 1.14 $
+  Version:   $Name:  $ $Revision: 1.15 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   08-Dec-03, ahu: created
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.14 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.15 $ $RCSfile: actions.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -145,97 +145,163 @@ namespace Action {
 
     void Print::printSummary(const Exif::ExifData& exifData)
     {
-        align_ = 15;
+        align_ = 16;
 
+        // Filename
         std::cout << std::setw(align_) << std::setfill(' ') << std::left
                   << "Filename" << ": " << path_ << "
";
 
+        // Todo: Filesize
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Filesize" << ": " << "
";
+
+        // Camera make
         printTag(exifData, "Image.OtherTags.Make", "Camera make");
+
+        // Camera model
         printTag(exifData, "Image.OtherTags.Model", "Camera model");
-        printTag(exifData, "Image.DateTime.DateTimeOriginal", "Image Timestamp");
 
-        // Exposure time: Try ExposureTime, failing that, try ShutterSpeedValue
+        // Image Timestamp
+        printTag(exifData, "Image.DateTime.DateTimeOriginal", "Image timestamp");
+
+        // Image number
+        // Todo: Image number for cameras other than Canon
+        printTag(exifData, "Makernote.Canon.ImageNumber", "Image number");
+
+        // Exposure time
+        // From ExposureTime, failing that, try ShutterSpeedValue
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Exposure time" << ": ";
         Exif::ExifData::const_iterator md;
-        std::ostringstream exposure;
-        md = exifData.findKey("Image.CaptureConditions.ExposureTime");
-        if (md != exifData.end()) {
-            exposure << *md;
-        }
-        else {
+        if (0 == printTag(exifData, "Image.CaptureConditions.ExposureTime")) {
             md = exifData.findKey("Image.CaptureConditions.ShutterSpeedValue");
             if (md != exifData.end()) {
                 float f = exp2f(md->toFloat()) + 0.5;
                 if (f > 1) {
-                    exposure << "1/" << static_cast<long>(f) << " s";
+                    std::cout << "1/" << static_cast<long>(f) << " s";
                 }
                 else {
-                    exposure << static_cast<long>(1/f) << " s";
+                    std::cout << static_cast<long>(1/f) << " s";
                 }
             }
         }
-        if (md != exifData.end()) {
-            std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                      << "Exposure time" << ": " << exposure.str() << "
";
-        }
-        // Aperture, get if from FNumber and, failing that, try ApertureValue
-        std::ostringstream aperture;
-        md = exifData.findKey("Image.CaptureConditions.FNumber");
-        if (md != exifData.end()) {
-            aperture << *md;
-        }
-        else {
+        std::cout << "
";
+
+        // Aperture
+        // Get if from FNumber and, failing that, try ApertureValue
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Aperture" << ": ";
+        if (0 == printTag(exifData, "Image.CaptureConditions.FNumber")) {
             md = exifData.findKey("Image.CaptureConditions.ApertureValue");
             if (md != exifData.end()) {
-                aperture << std::fixed << std::setprecision(1)
-                         << "F" << exp2f(md->toFloat()/2);
+                std::cout << std::fixed << std::setprecision(1)
+                          << "F" << exp2f(md->toFloat()/2);
             }
         }
-        if (md != exifData.end()) {
-            std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                      << "Aperture" << ": " << aperture.str() << "
";
-        }
+        std::cout << "
";
+
+        // Exposure bias
+        printTag(exifData, "Image.CaptureConditions.ExposureBiasValue", "Exposure bias");
+
+        // Flash
         printTag(exifData, "Image.CaptureConditions.Flash", "Flash");
-        // Focal length and 35 mm equivalent
+
+        // Todo: Flash bias, flash energy
+        // Todo: Implement this for other cameras
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Flash bias" << ": ";
+        md = exifData.findKey("Makernote.Canon.CameraSettings2");
+        if (md != exifData.end() && md->count() >= 15) {
+            Exif::CanonMakerNote::print0x0004_15(std::cout, md->toLong(15));
+        }
+        std::cout << "
";
+
+        // Actual focal length and 35 mm equivalent
         // Todo: Calculate 35 mm equivalent a la jhead
-        md = exifData.findKey("Image.CaptureConditions.FocalLength");
-        if (md != exifData.end()) {
-            std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                      << "Focal length" << ": " << *md;
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Focal length" << ": ";
+        if (1 == printTag(exifData, "Image.CaptureConditions.FocalLength")) {
             md = exifData.findKey("Image.CaptureConditions.FocalLengthIn35mmFilm");
             if (md != exifData.end()) {
                 std::cout << " (35 mm equivalent: " << *md << ")";
             }
-            std::cout << "
";
         }
-        // ISO speed, from ISOSpeedRatings or Canon Makernote
-        int rc = printTag(exifData, "Image.CaptureConditions.ISOSpeedRatings", "ISO speed");
-        if (rc == 0) {
+        std::cout << "
";
+
+        // Subject distance
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Subject distance" << ": ";
+	if (0 == printTag(exifData, "Image.CaptureConditions.SubjectDistance")) {
+            md = exifData.findKey("Makernote.Canon.CameraSettings2");
+            if (md != exifData.end() && md->count() >= 19) {
+                Exif::CanonMakerNote::print0x0004_19(std::cout, md->toLong(19));
+            }
+        }
+        std::cout << "
";
+
+        // ISO speed
+        // from ISOSpeedRatings or Canon Makernote
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "ISO speed" << ": ";
+        if (0 == printTag(exifData, "Image.CaptureConditions.ISOSpeedRatings")) {
             md = exifData.findKey("Makernote.Canon.CameraSettings1");
             if (md != exifData.end() && md->count() >= 16) {
-                long iso = md->toLong(16);
-                std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                          << "ISO" << ": ";
-                Exif::CanonMakerNote::print0x0001_16(std::cout, iso);
-                std::cout << "
";
+                Exif::CanonMakerNote::print0x0001_16(std::cout, md->toLong(16));
             }
         }
+        std::cout << "
";
 
-        // Exposure mode from ExposureProgram or Canon Makernote
-        rc = printTag(exifData, "Image.CaptureConditions.ExposureProgram", "Exposure mode");
-        if (rc == 0) {
+        // Exposure mode 
+        // From ExposureProgram or Canon Makernote
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Exposure mode" << ": ";
+        if (0 == printTag(exifData, "Image.CaptureConditions.ExposureProgram")) {
             md = exifData.findKey("Makernote.Canon.CameraSettings1");
             if (md != exifData.end() && md->count() >= 20) {
-                long prg = md->toLong(20);
-                std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                          << "Exposure mode" << ": ";
-                Exif::CanonMakerNote::print0x0001_20(std::cout, prg);
-                std::cout << "
";
+                Exif::CanonMakerNote::print0x0001_20(std::cout, md->toLong(20));
             }
         }
+        std::cout << "
";
 
+        // Metering mode
         printTag(exifData, "Image.CaptureConditions.MeteringMode", "Metering mode");
 
+        // Macro mode
+        // Todo: Implement this for other cameras
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Macro mode" << ": ";
+        bool done = false;
+        md = exifData.findKey("Makernote.Canon.CameraSettings1");
+        if (md != exifData.end() && md->count() >= 1) {
+            Exif::CanonMakerNote::print0x0001_01(std::cout, md->toLong(1));
+            done = true;
+        }
+        if (!done) {
+            done = printTag(exifData, "Makernote.Fujifilm.Macro");
+        }            
+        std::cout << "
";
+
+        // Image quality setting (compression)
+        // Todo: Implement this for other cameras
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Image quality" << ": ";
+        done = false;
+        md = exifData.findKey("Makernote.Canon.CameraSettings1");
+        if (md != exifData.end() && md->count() >= 3) {
+            Exif::CanonMakerNote::print0x0001_03(std::cout, md->toLong(3));
+            done = true;
+        }
+        if (!done) {
+            done = printTag(exifData, "Makernote.Fujifilm.Quality");
+        }            
+        if (!done) {
+            done = printTag(exifData, "Makernote.Sigma.Quality");
+        }            
+        std::cout << "
";
+
         // Exif Resolution
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "Exif Resolution" << ": ";
         long xdim = 0;
         long ydim = 0;
         md = exifData.findKey("Image.ImageConfig.PixelXDimension");
@@ -243,24 +309,48 @@ namespace Action {
         md = exifData.findKey("Image.ImageConfig.PixelYDimension");
         if (md != exifData.end()) ydim = md->toLong();
         if (xdim != 0 && ydim != 0) {
-            std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                      << "Exif Resolution" << ": " 
-                      << xdim << " x " << ydim << "
";
+            std::cout << xdim << " x " << ydim;
         }
+        std::cout << "
";
+
+        // White balance
+        // Todo: Implement this for other cameras
+        std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                  << "White balance" << ": ";
+        done = false;
+        md = exifData.findKey("Makernote.Canon.CameraSettings2");
+        if (md != exifData.end() && md->count() >= 7) {
+            Exif::CanonMakerNote::print0x0004_07(std::cout, md->toLong(7));
+            done = true;
+        }
+        if (!done) {
+            done = printTag(exifData, "Makernote.Fujifilm.WhiteBalance");
+        }            
+        if (!done) {
+            done = printTag(exifData, "Makernote.Sigma.WhiteBalance");
+        }            
+        std::cout << "
";
 
         // Thumbnail
         std::cout << std::setw(align_) << std::setfill(' ') << std::left
                   << "Thumbnail" << ": ";
         std::string thumbExt = exifData.thumbnailExtension();
         if (thumbExt.empty()) {
-            std::cout << "None
";
+            std::cout << "None";
         } 
         else {
             std::cout << exifData.thumbnailFormat() << ", " 
-                      << exifData.thumbnailSize() << " Bytes
";
+                      << exifData.thumbnailSize() << " Bytes";
         }
         std::cout << "
";
 
+        // Copyright
+        printTag(exifData, "Image.OtherTags.Copyright", "Copyright");
+
+        // Exif Comment
+        printTag(exifData, "Image.UserInfo.UserComment", "Exif comment");
+        std::cout << std::endl;
+
     } // Print::printSummary
 
     int Print::printTag(const Exif::ExifData& exifData,
@@ -268,12 +358,17 @@ namespace Action {
                         const std::string& label) const
     {
         int rc = 0;
+        if (!label.empty()) {
+            // Print the label in any case for the moment (to see what's missing)
+            std::cout << std::setw(align_) << std::setfill(' ') << std::left
+                      << label << ": ";
+        }
         Exif::ExifData::const_iterator md = exifData.findKey(key);
         if (md != exifData.end()) {
-            std::cout << std::setw(align_) << std::setfill(' ') << std::left
-                      << label << ": " << *md << "
";
+            std::cout << *md;
             rc = 1;
         }
+        if (!label.empty()) std::cout << "
";
         return rc;
     } // Print::printTag
 
diff --git a/src/actions.hpp b/src/actions.hpp
index 042521a..7ad624d 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -22,7 +22,7 @@
   @file    actions.hpp
   @brief   Implements base class Task, TaskFactory and the various supported
            actions (derived from Task).
-  @version $Name:  $ $Revision: 1.6 $
+  @version $Name:  $ $Revision: 1.7 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    11-Dec-03, ahu: created
@@ -158,12 +158,13 @@ namespace Action {
         //! Print %Exif information in hexdump format
         void printHexdump(const Exif::ExifData& exifData);
         /*!
-          @brief Print one summary line with a label and requested data.
-                 Return 1 if a line was written, 0 if the key was not found.
+          @brief Print one summary line with a label (if provided) and requested
+                 data. A line break is printed only if a label is provided.
+          @return 1 if a line was written, 0 if the key was not found.
          */
         int printTag(const Exif::ExifData& exifData,
                      const std::string& key, 
-                     const std::string& label) const;
+                     const std::string& label ="") const;
 
     private:
         virtual Task* clone_() const;
diff --git a/src/tags.cpp b/src/tags.cpp
index b799b25..830ef82 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -20,13 +20,13 @@
  */
 /*
   File:      tags.cpp
-  Version:   $Name:  $ $Revision: 1.22 $
+  Version:   $Name:  $ $Revision: 1.23 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   15-Jan-04, ahu: created
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.22 $ $RCSfile: tags.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.23 $ $RCSfile: tags.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -39,6 +39,7 @@ EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.22 $ $RCSfile: tags.cpp,v $")
 #include <iomanip>
 #include <sstream>
 #include <utility>
+#include <cstdlib>
 
 // *****************************************************************************
 // class member definitions
@@ -154,7 +155,7 @@ namespace Exif {
         TagInfo(0x9201, "ShutterSpeedValue", "Shutter speed", exifIfd, captureCond, printFloat),
         TagInfo(0x9202, "ApertureValue", "Aperture", exifIfd, captureCond, printFloat),
         TagInfo(0x9203, "BrightnessValue", "Brightness", exifIfd, captureCond, printFloat),
-        TagInfo(0x9204, "ExposureBiasValue", "Exposure bias", exifIfd, captureCond, printFloat),
+        TagInfo(0x9204, "ExposureBiasValue", "Exposure bias", exifIfd, captureCond, print0x9204),
         TagInfo(0x9205, "MaxApertureValue", "Maximum lens aperture", exifIfd, captureCond, printFloat),
         TagInfo(0x9206, "SubjectDistance", "Subject distance", exifIfd, captureCond, print0x9206),
         TagInfo(0x9207, "MeteringMode", "Metering mode", exifIfd, captureCond, print0x9207),
@@ -633,6 +634,19 @@ namespace Exif {
         return os;
     }
 
+    std::ostream& print0x9204(std::ostream& os, const Value& value)
+    {
+        Rational bias = value.toRational();
+        if (bias.first == 0) {
+            os << "+/- 0";
+        }
+        else {
+            os << (bias.first < 0 ? "- " : "+ ");
+            os << labs(bias.first) << "/" << bias.second;
+        }
+        return os;
+    }
+
     std::ostream& print0x9206(std::ostream& os, const Value& value)
     {
         Rational distance = value.toRational();
diff --git a/src/tags.hpp b/src/tags.hpp
index 11157dc..ce27fc3 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    tags.hpp
   @brief   %Exif tag and type information
-  @version $Name:  $ $Revision: 1.19 $
+  @version $Name:  $ $Revision: 1.20 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    15-Jan-04, ahu: created
@@ -233,6 +233,8 @@ namespace Exif {
     std::ostream& print0x8827(std::ostream& os, const Value& value);
     //! Print components configuration specific to compressed data
     std::ostream& print0x9101(std::ostream& os, const Value& value);
+    //! Print the exposure bias value
+    std::ostream& print0x9204(std::ostream& os, const Value& value);
     //! Print the subject distance
     std::ostream& print0x9206(std::ostream& os, const Value& value);
     //! Print the metering mode

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list