[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:39:31 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=1f1b486
The following commit has been merged in the master branch:
commit 1f1b486046ddcbc194182d5cfd5b54e48bbed880
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Wed Jun 4 04:46:51 2008 +0000
Improved conversion of text and comment values. There is still no charset conversion yet, though.
---
src/convert.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 65 insertions(+), 2 deletions(-)
diff --git a/src/convert.cpp b/src/convert.cpp
index d767b11..7c639e3 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -111,6 +111,12 @@ namespace Exiv2 {
*/
void cnvExifValue(const char* from, const char* to);
/*!
+ @brief Convert the tag Exif.Photo.UserComment to XMP.
+
+ Todo: Convert the Exif comment to UTF-8 if necessary.
+ */
+ void cnvExifComment(const char* from, const char* to);
+ /*!
@brief Converts Exif tag with multiple components to XMP array.
Converts Exif tag with multiple components to XMP array. This function is
@@ -154,9 +160,16 @@ namespace Exiv2 {
@brief Simple XMP to Exif conversion function.
Sets the Exif tag according to the XMP property.
+ For LangAlt values, only the x-default entry is used.
+
+ Todo: Escape non-ASCII characters in XMP text values
*/
void cnvXmpValue(const char* from, const char* to);
/*!
+ @brief Convert the tag Xmp.exif.UserComment to Exif.
+ */
+ void cnvXmpComment(const char* from, const char* to);
+ /*!
@brief Converts XMP array to Exif tag with multiple components.
Converts XMP array to Exif tag with multiple components. This function is
@@ -283,7 +296,7 @@ namespace Exiv2 {
{ mdExif, "Exif.Photo.CompressedBitsPerPixel", "Xmp.exif.CompressedBitsPerPixel", &Converter::cnvExifValue, &Converter::cnvXmpValue },
{ mdExif, "Exif.Photo.PixelXDimension", "Xmp.exif.PixelXDimension", &Converter::cnvExifValue, &Converter::cnvXmpValue },
{ mdExif, "Exif.Photo.PixelYDimension", "Xmp.exif.PixelYDimension", &Converter::cnvExifValue, &Converter::cnvXmpValue },
- { mdExif, "Exif.Photo.UserComment", "Xmp.exif.UserComment", &Converter::cnvExifValue, &Converter::cnvXmpValue },
+ { mdExif, "Exif.Photo.UserComment", "Xmp.exif.UserComment", &Converter::cnvExifComment, &Converter::cnvXmpComment },
{ mdExif, "Exif.Photo.RelatedSoundFile", "Xmp.exif.RelatedSoundFile", &Converter::cnvExifValue, &Converter::cnvXmpValue },
{ mdExif, "Exif.Photo.DateTimeOriginal", "Xmp.exif.DateTimeOriginal", &Converter::cnvExifDate, &Converter::cnvXmpDate },
{ mdExif, "Exif.Photo.DateTimeDigitized", "Xmp.exif.DateTimeDigitized", &Converter::cnvExifDate, &Converter::cnvXmpDate },
@@ -456,6 +469,23 @@ namespace Exiv2 {
if (erase_) exifData_->erase(pos);
}
+ void Converter::cnvExifComment(const char* from, const char* to)
+ {
+ Exiv2::ExifData::iterator pos = exifData_->findKey(ExifKey(from));
+ if (pos == exifData_->end()) return;
+ if (!prepareXmpTarget(to)) return;
+ const CommentValue* cv = dynamic_cast<const CommentValue*>(&pos->value());
+ if (cv == 0) {
+#ifndef SUPPRESS_WARNINGS
+ std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
+#endif
+ return;
+ }
+ // Todo: Convert to UTF-8 if necessary
+ (*xmpData_)[to] = cv->comment();
+ if (erase_) exifData_->erase(pos);
+ }
+
void Converter::cnvExifArray(const char* from, const char* to)
{
Exiv2::ExifData::iterator pos = exifData_->findKey(ExifKey(from));
@@ -672,17 +702,50 @@ namespace Exiv2 {
Exiv2::XmpData::iterator pos = xmpData_->findKey(XmpKey(from));
if (pos == xmpData_->end()) return;
if (!prepareExifTarget(to)) return;
- std::string value = pos->value().toString();
+ std::string value;
+ if (pos->typeId() == langAlt) {
+ // get the default language entry without x-default qualifier
+ value = pos->value().toString(0);
+ }
+ else {
+ value = pos->value().toString();
+ }
if (!pos->value().ok()) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
#endif
return;
}
+ // Todo: Escape non-ASCII characters in XMP text values
(*exifData_)[to] = value;
if (erase_) xmpData_->erase(pos);
}
+ void Converter::cnvXmpComment(const char* from, const char* to)
+ {
+ if (!prepareExifTarget(to)) return;
+ Exiv2::XmpData::iterator pos = xmpData_->findKey(XmpKey(from));
+ if (pos == xmpData_->end()) return;
+
+ std::string value;
+ if (pos->typeId() == langAlt) {
+ // get the default language entry without x-default qualifier
+ value = pos->value().toString(0);
+ }
+ else {
+ value = pos->value().toString();
+ }
+ if (!pos->value().ok()) {
+#ifndef SUPPRESS_WARNINGS
+ std::cerr << "Warning: Failed to convert " << from << " to " << to << "
";
+#endif
+ return;
+ }
+ // Assumes the XMP value is encoded in UTF-8, as it should be
+ (*exifData_)[to] = "charset=Unicode " + value;
+ if (erase_) xmpData_->erase(pos);
+ }
+
void Converter::cnvXmpArray(const char* from, const char* to)
{
if (!prepareExifTarget(to)) return;
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list