Revision: 1166
http://geeqie.svn.sourceforge.net/geeqie/?rev=1166&view=rev
Author: nadvornik
Date: 2008-10-18 20:17:55 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
create xmp sidecar when needed
Modified Paths:
--------------
trunk/src/exiv2.cc
Modified: trunk/src/exiv2.cc
===================================================================
--- trunk/src/exiv2.cc 2008-10-18 19:20:27 UTC (rev 1165)
+++ trunk/src/exiv2.cc 2008-10-18 20:17:55 UTC (rev 1166)
@@ -50,6 +50,7 @@
#if EXIV2_TEST_VERSION(0,17,0)
#include <exiv2/convert.hpp>
+#include <exiv2/xmpsidecar.hpp>
#endif
@@ -111,6 +112,12 @@
guint cp_length_;
public:
+ _ExifDataOriginal(Exiv2::Image::AutoPtr image)
+ {
+ cp_data_ = NULL;
+ cp_length_ = 0;
+ image_ = image;
+ }
_ExifDataOriginal(gchar *path)
{
@@ -252,10 +259,29 @@
}
else
{
- imageData_->image()->setExifData(exifData_);
- imageData_->image()->setIptcData(iptcData_);
- imageData_->image()->setXmpData(xmpData_);
- imageData_->image()->writeMetadata();
+ try {
+ imageData_->image()->setExifData(exifData_);
+ imageData_->image()->setIptcData(iptcData_);
+ imageData_->image()->setXmpData(xmpData_);
+ imageData_->image()->writeMetadata();
+ }
+ catch (Exiv2::AnyError& e)
+ {
+ // can't write into the image, create sidecar
+#if EXIV2_TEST_VERSION(0,17,0)
+ gchar *base =
remove_extension_from_path(imageData_->image()->io().path().c_str());
+ gchar *pathl = g_strconcat(base, ".xmp", NULL);
+
+ Exiv2::Image::AutoPtr sidecar =
Exiv2::ImageFactory::create(Exiv2::ImageType::xmp, pathl);
+
+ g_free(base);
+ g_free(pathl);
+
+ sidecarData_ = new _ExifDataOriginal(sidecar);
+ sidecarData_->image()->setXmpData(xmpData_);
+ sidecarData_->image()->writeMetadata();
+#endif
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn