[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:14 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=15564f4
The following commit has been merged in the master branch:
commit 15564f4cf07b3db71f54c9295a44f4cead83f3e0
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sun Sep 11 09:27:24 2005 +0000
Fixed print function mixup and further cleaned-up the summary printing in the utility
---
src/actions.cpp | 78 +++++++++++++++++++----------------------------
src/actions.hpp | 2 ++
src/tags.cpp | 22 ++++++-------
test/data/exiv2-test.out | 38 +++++++++++------------
test/data/modify-test.out | 6 ++--
5 files changed, 66 insertions(+), 80 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index 1b031eb..a9e30fe 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -196,15 +196,14 @@ namespace Action {
align_ = 16;
// Filename
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Filename" << ": " << path_ << std::endl;
+ printLabel("Filename");
+ std::cout << path_ << std::endl;
// Filesize
struct stat buf;
if (0 == stat(path_.c_str(), &buf)) {
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Filesize" << ": " << buf.st_size << " Bytes"
- << std::endl;
+ printLabel("Filesize");
+ std::cout << buf.st_size << " Bytes" << std::endl;
}
// Camera make
@@ -222,30 +221,20 @@ namespace Action {
// Exposure time
// From ExposureTime, failing that, try ShutterSpeedValue
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Exposure time" << ": ";
- Exiv2::ExifData::const_iterator md;
- if (0 == printTag(exifData, "Exif.Photo.ExposureTime")) {
- md = exifData.findKey(
- Exiv2::ExifKey("Exif.Photo.ShutterSpeedValue"));
- if (md != exifData.end()) {
- double tmp = exp(log(2.0) * md->toFloat());
- if (tmp > 1) {
- std::cout << "1/" << static_cast<long>(tmp + 0.5);
- }
- else {
- std::cout << static_cast<long>(1/tmp + 0.5);
- }
- std::cout << " s";
- }
+ bool done = false;
+ printLabel("Exposure time");
+ if (!done) {
+ done = 0 != printTag(exifData, "Exif.Photo.ExposureTime");
+ }
+ if (!done) {
+ done = 0 != printTag(exifData, "Exif.Photo.ShutterSpeedValue");
}
std::cout << std::endl;
// Aperture
// Get if from FNumber and, failing that, try ApertureValue
- bool done = false;
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Aperture" << ": ";
+ done = false;
+ printLabel("Aperture");
if (!done) {
done = 0 != printTag(exifData, "Exif.Photo.FNumber");
}
@@ -263,8 +252,7 @@ namespace Action {
// Todo: Flash bias, flash energy
// Todo: Implement this for other cameras
done = false;
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Flash bias" << ": ";
+ printLabel("Flash bias");
if (!done) {
done = 0 != printTag(exifData, "Exif.CanonCs2.FlashBias");
}
@@ -278,8 +266,8 @@ namespace Action {
// Actual focal length and 35 mm equivalent
// Todo: Calculate 35 mm equivalent a la jhead
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Focal length" << ": ";
+ Exiv2::ExifData::const_iterator md;
+ printLabel("Focal length");
if (1 == printTag(exifData, "Exif.Photo.FocalLength")) {
md = exifData.findKey(
Exiv2::ExifKey("Exif.Photo.FocalLengthIn35mmFilm"));
@@ -290,8 +278,7 @@ namespace Action {
std::cout << std::endl;
// Subject distance
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Subject distance" << ": ";
+ printLabel("Subject distance");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.Photo.SubjectDistance");
@@ -303,8 +290,7 @@ namespace Action {
// ISO speed
// from ISOSpeedRatings or the Makernote
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "ISO speed" << ": ";
+ printLabel("ISO speed");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.Photo.ISOSpeedRatings");
@@ -325,8 +311,7 @@ namespace Action {
// Exposure mode
// From ExposureProgram or Canon Makernote
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Exposure mode" << ": ";
+ printLabel("Exposure mode");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.Photo.ExposureProgram");
@@ -341,8 +326,7 @@ namespace Action {
// Macro mode
// Todo: Implement this for other cameras
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Macro mode" << ": ";
+ printLabel("Macro mode");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.CanonCs1.Macro");
@@ -360,8 +344,7 @@ namespace Action {
// Image quality setting (compression)
// Todo: Implement this for other cameras
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Image quality" << ": ";
+ printLabel("Image quality");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.CanonCs1.Quality");
@@ -390,8 +373,7 @@ namespace Action {
std::cout << std::endl;
// Exif Resolution
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Exif Resolution" << ": ";
+ printLabel("Exif Resolution");
long xdim = 0;
long ydim = 0;
md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
@@ -405,8 +387,7 @@ namespace Action {
// White balance
// Todo: Implement this for other cameras
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "White balance" << ": ";
+ printLabel("White balance");
done = false;
if (!done) {
done = 0 != printTag(exifData, "Exif.CanonCs2.WhiteBalance");
@@ -435,8 +416,7 @@ namespace Action {
std::cout << std::endl;
// Thumbnail
- std::cout << std::setw(align_) << std::setfill(' ') << std::left
- << "Thumbnail" << ": ";
+ printLabel("Thumbnail");
std::string thumbExt = exifData.thumbnailExtension();
if (thumbExt.empty()) {
std::cout << "None";
@@ -458,15 +438,19 @@ namespace Action {
return 0;
} // Print::printSummary
+ void Print::printLabel(const std::string& label) const
+ {
+ std::cout << std::setw(align_) << std::setfill(' ') << std::left
+ << label << ": ";
+ }
+
int Print::printTag(const Exiv2::ExifData& exifData,
const std::string& key,
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 << ": ";
+ printLabel(label);
}
Exiv2::ExifKey ek(key);
Exiv2::ExifData::const_iterator md = exifData.findKey(ek);
diff --git a/src/actions.hpp b/src/actions.hpp
index 6a93205..9f27596 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -171,6 +171,8 @@ namespace Action {
int printValues();
//! Print Exif information in hexdump format
int printHexdump();
+ //! Print the label for a summary line
+ void printLabel(const std::string& label) const;
/*!
@brief Print one summary line with a label (if provided) and requested
data. A line break is printed only if a label is provided.
diff --git a/src/tags.cpp b/src/tags.cpp
index b1fcc5d..4da78b4 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -192,7 +192,7 @@ namespace Exiv2 {
TagInfo(0x9202, "ApertureValue", "Aperture", "Aperture", exifIfdId, captureCond, unsignedRational, print0x9202),
TagInfo(0x9203, "BrightnessValue", "Brightness", "Brightness", exifIfdId, captureCond, signedRational, printFloat),
TagInfo(0x9204, "ExposureBiasValue", "Exposure Bias", "Exposure bias", exifIfdId, captureCond, signedRational, print0x9204),
- TagInfo(0x9205, "MaxApertureValue", "MaxApertureValue", "Maximum lens aperture", exifIfdId, captureCond, unsignedRational, printFloat),
+ TagInfo(0x9205, "MaxApertureValue", "MaxApertureValue", "Maximum lens aperture", exifIfdId, captureCond, unsignedRational, print0x9202),
TagInfo(0x9206, "SubjectDistance", "Subject Distance", "Subject distance", exifIfdId, captureCond, unsignedRational, print0x9206),
TagInfo(0x9207, "MeteringMode", "Metering Mode", "Metering mode", exifIfdId, captureCond, unsignedShort, print0x9207),
TagInfo(0x9208, "LightSource", "Light Source", "Light source", exifIfdId, captureCond, unsignedShort, print0x9208),
@@ -939,16 +939,6 @@ namespace Exiv2 {
std::ostream& print0x9201(std::ostream& os, const Value& value)
{
- std::ostringstream oss;
- oss.copyfmt(os);
- os << "F" << std::setprecision(2) << fnumber(value.toFloat());
- os.copyfmt(oss);
-
- return os;
- }
-
- std::ostream& print0x9202(std::ostream& os, const Value& value)
- {
URational ur = exposureTime(value.toFloat());
os << ur.first;
if (ur.second > 1) {
@@ -957,6 +947,16 @@ namespace Exiv2 {
return os << " s";
}
+ std::ostream& print0x9202(std::ostream& os, const Value& value)
+ {
+ std::ostringstream oss;
+ oss.copyfmt(os);
+ os << "F" << std::setprecision(2) << fnumber(value.toFloat());
+ os.copyfmt(oss);
+
+ return os;
+ }
+
std::ostream& print0x9204(std::ostream& os, const Value& value)
{
Rational bias = value.toRational();
diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out
index 73df936..cfa5c36 100644
--- a/test/data/exiv2-test.out
+++ b/test/data/exiv2-test.out
@@ -9,7 +9,7 @@ This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Exiv2 help ---------------------------------------------------------------
-Usage: lt-exiv2 [ options ] [ action ] file ...
+Usage: exiv2 [ options ] [ action ] file ...
Manipulate the Exif metadata of images.
@@ -429,10 +429,10 @@ Exif.Photo.DateTimeOriginal Ascii 20 2003:12:14 00:00:43
Exif.Photo.DateTimeDigitized Ascii 20 2003:12:14 00:00:43
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 5
-Exif.Photo.ShutterSpeedValue SRational 1 F22
-Exif.Photo.ApertureValue Rational 1 1/25 s
+Exif.Photo.ShutterSpeedValue SRational 1 1/501 s
+Exif.Photo.ApertureValue Rational 1 F5
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 2.97086
+Exif.Photo.MaxApertureValue Rational 1 F2.8
Exif.Photo.MeteringMode Short 1 Center weighted
Exif.Photo.Flash Short 1 No, auto
Exif.Photo.FocalLength Rational 1 21.3 mm
@@ -557,7 +557,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2000:05:06 02:05:44
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 3
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 3.5
+Exif.Photo.MaxApertureValue Rational 1 F3.4
Exif.Photo.MeteringMode Short 1 Center weighted
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No
@@ -617,7 +617,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2004:03:29 22:42:45
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 4
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 4.3
+Exif.Photo.MaxApertureValue Rational 1 F4.4
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No
@@ -720,7 +720,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2001:04:05 23:50:39
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 4
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 2.6
+Exif.Photo.MaxApertureValue Rational 1 F2.5
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No
@@ -770,10 +770,10 @@ Exif.Photo.DateTimeOriginal Ascii 20 2003:09:25 20:18:50
Exif.Photo.DateTimeDigitized Ascii 20 2003:09:25 20:18:50
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 3
-Exif.Photo.ShutterSpeedValue SRational 1 F8.9
-Exif.Photo.ApertureValue Rational 1 1/31 s
+Exif.Photo.ShutterSpeedValue SRational 1 1/80 s
+Exif.Photo.ApertureValue Rational 1 F5.6
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 3.61472
+Exif.Photo.MaxApertureValue Rational 1 F3.5
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.Flash Short 1 No
Exif.Photo.FocalLength Rational 1 18.0 mm
@@ -918,11 +918,11 @@ Exif.Photo.ExifVersion Undefined 4 48 49 49 48
Exif.Photo.DateTimeOriginal Ascii 20 2000:10:26 04:45:50
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 (0/0)
-Exif.Photo.ShutterSpeedValue SRational 1 F5.7
-Exif.Photo.ApertureValue Rational 1 1/16 s
+Exif.Photo.ShutterSpeedValue SRational 1 1/32 s
+Exif.Photo.ApertureValue Rational 1 F4
Exif.Photo.BrightnessValue SRational 1 1.5
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 4
+Exif.Photo.MaxApertureValue Rational 1 F4
Exif.Photo.SubjectDistance Rational 1 Unknown
Exif.Photo.MeteringMode Short 1 Center weighted
Exif.Photo.LightSource Short 1 Unknown
@@ -962,8 +962,8 @@ Exif.Photo.DateTimeOriginal Ascii 20 2003:09:26 11:15:35
Exif.Photo.DateTimeDigitized Ascii 20 2003:09:26 11:15:35
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 1.5
-Exif.Photo.ShutterSpeedValue SRational 1 F8
-Exif.Photo.ApertureValue Rational 1 1/16 s
+Exif.Photo.ShutterSpeedValue SRational 1 1/64 s
+Exif.Photo.ApertureValue Rational 1 F4
Exif.Photo.BrightnessValue SRational 1 -1.83
Exif.Photo.ExposureBiasValue SRational 1 +1/2
Exif.Photo.MeteringMode Short 1 Center weighted
@@ -1036,7 +1036,7 @@ Exif.Photo.DateTimeOriginal Ascii 20 2004:03:16 07:51:37
Exif.Photo.DateTimeDigitized Ascii 20 2004:03:18 11:39:25
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.ExposureBiasValue SRational 1 +1
-Exif.Photo.MaxApertureValue Rational 1 2.7
+Exif.Photo.MaxApertureValue Rational 1 F2.5
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.Flash Short 1 No
Exif.Photo.FocalLength Rational 1 14.0 mm
@@ -1105,7 +1105,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2004:02:08 09:37:44
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 4
Exif.Photo.ExposureBiasValue SRational 1 +7/10
-Exif.Photo.MaxApertureValue Rational 1 3.2
+Exif.Photo.MaxApertureValue Rational 1 F3
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No, compulsory
@@ -1173,7 +1173,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2005:02:18 21:20:16
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 4
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 3
+Exif.Photo.MaxApertureValue Rational 1 F2.8
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No, compulsory
@@ -1255,7 +1255,7 @@ Exif.Photo.DateTimeDigitized Ascii 20 2005:05:27 05:18:33
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
Exif.Photo.CompressedBitsPerPixel Rational 1 8
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 3
+Exif.Photo.MaxApertureValue Rational 1 F2.8
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 Yes, auto, return light detected
diff --git a/test/data/modify-test.out b/test/data/modify-test.out
index 67f7882..0ea5f82 100644
--- a/test/data/modify-test.out
+++ b/test/data/modify-test.out
@@ -39,10 +39,10 @@ Exif.Photo.ExifVersion Undefined 4 48 50 49 48
Exif.Photo.DateTimeOriginal Ascii 20 2004:06:08 16:04:50
Exif.Photo.DateTimeDigitized Ascii 20 2004:06:08 16:04:50
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
-Exif.Photo.ShutterSpeedValue SRational 1 F9.8
-Exif.Photo.ApertureValue Rational 1 1/84 s
+Exif.Photo.ShutterSpeedValue SRational 1 1/97 s
+Exif.Photo.ApertureValue Rational 1 F9.2
Exif.Photo.ExposureBiasValue SRational 1 0
-Exif.Photo.MaxApertureValue Rational 1 3.1
+Exif.Photo.MaxApertureValue Rational 1 F2.9
Exif.Photo.MeteringMode Short 1 Matrix
Exif.Photo.LightSource Short 1 Unknown
Exif.Photo.Flash Short 1 No
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list