[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:04 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=47e4331
The following commit has been merged in the master branch:
commit 47e43318a632d45f803a53c35d3181a63aa15efc
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sun Feb 15 10:17:39 2004 +0000
Implemented print modes, part 1
---
src/actions.cpp | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
src/actions.hpp | 15 +++++++-
2 files changed, 117 insertions(+), 11 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index 71c952a..26c852d 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,13 +20,13 @@
*/
/*
File: actions.cpp
- Version: $Name: $ $Revision: 1.4 $
+ Version: $Name: $ $Revision: 1.5 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 08-Dec-03, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.5 $ $RCSfile: actions.cpp,v $")
// *****************************************************************************
// included header files
@@ -114,13 +114,68 @@ namespace Action {
} // TaskFactory::create
int Print::run(const std::string& path)
- try {
+ try {
Exif::ExifData exifData;
int rc = exifData.read(path);
if (rc) {
std::cerr << exifReadError(rc, path) << "
";
return rc;
}
+ switch (Params::instance().printMode_) {
+ case Params::summary: printSummary(exifData); break;
+ case Params::interpreted: printInterpreted(exifData); break;
+ case Params::values: printValues(exifData); break;
+ case Params::hexdump: printHexdump(exifData); break;
+ }
+ return 0;
+ }
+ catch(const Exif::Error& e)
+ {
+ std::cerr << "Exif exception in print action for file "
+ << path << ":
" << e << "
";
+ return 1;
+ } // Print::run
+
+ void Print::printSummary(const Exif::ExifData& exifData)
+ {
+ printTag(exifData, "Image.OtherTags.Make", "Camera make");
+ printTag(exifData, "Image.OtherTags.Model", "Camera model");
+ printTag(exifData, "Image.DateTime.DateTimeOriginal", "Image Timestamp");
+ printTag(exifData, "Image.CaptureConditions.ExposureTime", "Exposure time");
+ printTag(exifData, "Image.CaptureConditions.FNumber", "Aperture");
+ printTag(exifData, "Image.CaptureConditions.Flash", "Flash");
+ printTag(exifData, "Image.CaptureConditions.FocalLength", "Focal length");
+ printTag(exifData, "Image.CaptureConditions.MeteringMode", "Metering mode");
+
+ // Todo: Add size of IFD1 to thumbnail data size
+ std::cout << std::setw(15) << std::setfill(' ') << std::left
+ << "Thumbnail" << ": ";
+ switch (exifData.thumbnailType()) {
+ case Exif::Thumbnail::none: std::cout << "None
"; break;
+ case Exif::Thumbnail::jpeg:
+ std::cout << "JPEG, " << exifData.thumbnailSize() << " Bytes
";
+ break;
+ case Exif::Thumbnail::tiff:
+ std::cout << "TIFF, " << exifData.thumbnailSize() << " Bytes
";
+ break;
+ }
+
+ } // Print::printSummary
+
+ void Print::printTag(const Exif::ExifData& exifData,
+ const std::string& key,
+ const std::string& label)
+ {
+ Exif::ExifData::const_iterator md = exifData.findKey(key);
+ if (md != exifData.end()) {
+ std::cout << std::setw(15) << std::setfill(' ') << std::left
+ << label << ": " << *md << "
";
+ }
+ } // Print::printTag
+
+
+ void Print::printInterpreted(const Exif::ExifData& exifData)
+ {
Exif::ExifData::const_iterator md;
for (md = exifData.begin(); md != exifData.end(); ++md) {
std::cout << "0x" << std::setw(4) << std::setfill('0') << std::right
@@ -131,14 +186,52 @@ namespace Action {
<< md->tagName() << " "
<< std::dec << *md << "
";
}
- return 0;
- }
- catch(const Exif::Error& e)
+ } // Print::printInterpreted
+
+ void Print::printValues(const Exif::ExifData& exifData)
{
- std::cerr << "Exif exception in print action for file "
- << path << ":
" << e << "
";
- return 1;
- } // Print::run
+ Exif::ExifData::const_iterator md;
+ for (md = exifData.begin(); md != exifData.end(); ++md) {
+ std::cout << "0x" << std::setw(4) << std::setfill('0') << std::right
+ << std::hex << md->tag() << " "
+ << std::setw(4) << std::setfill(' ') << std::left
+ << md->ifdName() << " "
+ << std::setw(9) << std::setfill(' ') << std::left
+ << md->typeName() << " "
+ << std::dec << std::setw(3)
+ << std::setfill(' ') << std::right
+ << md->count() << " "
+ << std::setw(27) << std::setfill(' ') << std::left
+ << md->tagName() << " "
+ << std::dec << md->value()
+ << "
";
+ }
+ } // Print::printValues
+
+ void Print::printHexdump(const Exif::ExifData& exifData)
+ {
+ Exif::ExifData::const_iterator md;
+ for (md = exifData.begin(); md != exifData.end(); ++md) {
+ char *buf = new char[md->size()];
+ md->copy(buf, exifData.byteOrder());
+ std::cout << std::setw(4) << std::setfill(' ') << std::left
+ << md->ifdName() << " "
+ << "0x" << std::setw(4) << std::setfill('0') << std::right
+ << std::hex << md->tag() << " "
+ << std::setw(9) << std::setfill(' ') << std::left
+ << md->typeName() << " "
+ << std::dec << std::setw(3)
+ << std::setfill(' ') << std::right
+ << md->count() << " "
+ << std::dec << std::setw(3)
+ << std::setfill(' ') << std::right
+ << md->size() << " "
+ << std::setw(27) << std::setfill(' ') << std::left
+ << md->tagName() << "
";
+ Exif::hexdump(std::cout, buf, md->size());
+ delete[] buf;
+ }
+ } // Print::printHexdump
Print::AutoPtr Print::clone() const
{
diff --git a/src/actions.hpp b/src/actions.hpp
index 146b2ae..8674c8e 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.1 $
+ @version $Name: $ $Revision: 1.2 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
@date 11-Dec-03, ahu: created
@@ -148,6 +148,19 @@ namespace Action {
typedef std::auto_ptr<Print> AutoPtr;
AutoPtr clone() const;
+ //! Print %Exif summary information
+ void printSummary(const Exif::ExifData& exifData);
+ //! Print the interpreted value for each %Exif tag
+ void printInterpreted(const Exif::ExifData& exifData);
+ //! Print uninterpreted %Exif information
+ void printValues(const Exif::ExifData& exifData);
+ //! Print %Exif information in hexdump format
+ void printHexdump(const Exif::ExifData& exifData);
+ //! Print one summary line with a label and requested data
+ void Print::printTag(const Exif::ExifData& exifData,
+ const std::string& key,
+ const std::string& label);
+
private:
virtual Task* clone_() const;
};
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list