Commit 53ecc390 authored by Michael J. Chudobiak's avatar Michael J. Chudobiak Committed by Michael J. Chudobiak

Adapt to exiv2 0.18, which has API changes. Metadata writing is partly

2008-12-19  Michael J. Chudobiak  <mjc@svn.gnome.org>

        * NEWS:
        * README:
        * configure.in:
        * libgthumb/gth-exiv2-utils.cpp:
        Adapt to exiv2 0.18, which has API changes. Metadata writing is
        partly broken, so don't use trunk for editing until that is fixed.
        Working on it!


svn path=/trunk/; revision=2459
parent 418b4dc9
2008-12-19 Michael J. Chudobiak <mjc@svn.gnome.org>
* NEWS:
* README:
* configure.in:
* libgthumb/gth-exiv2-utils.cpp:
Adapt to exiv2 0.18, which has API changes. Metadata writing is
partly broken, so don't use trunk for editing until that is fixed.
Working on it!
2008-12-18 Michael J. Chudobiak <mjc@svn.gnome.org>
* libgthumb/comments.c: (load_comment_from_xml), (save_comment):
......
......@@ -61,7 +61,7 @@ trunk, since last 2.10.x
* Added page_rows and page_cols web album tags. Bug #543966.
Library changes:
* exiv2 0.15 or higher is now required.
* exiv2 0.18 or higher is now required.
* libiptcdata is no longer used.
* libexif is no longer used.
......
......@@ -93,7 +93,7 @@ Compiling
* gnome-vfs version >= 2.6.0
* libglade version >= 2.4.0
* intltool version >= 0.35.0
* exiv2 version >= 0.15
* exiv2 version >= 0.18
* libjpeg
* gtkunique version >= 0.9.1 (optional)
......
......@@ -34,7 +34,7 @@ LIBGLADE_REQUIRED=2.4.0
LIBGPHOTO_REQUIRED=2.1.3
BONOBO_REQUIRED=2.6.0
LIBOPENRAW_REQUIRED=0.0.2
EXIV2_REQUIRED=0.15
EXIV2_REQUIRED=0.18
GSTREAMER_REQUIRED=0.10.15
AC_SUBST(GLIB_REQUIRED)
......@@ -174,13 +174,6 @@ PKG_CHECK_MODULES(GDKX, gdk-x11-2.0,
HAVE_GDKX=yes],
[AC_MSG_WARN(Disabling GDK/X11-dependent features and Xrender.)])
#
# check for exiv2 xmp functionality
#
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([exiv2/xmp.hpp],[HAVE_XMP=yes],[HAVE_XMP=no])
AC_LANG_POP([C++])
#
# check for gstreamer
......@@ -357,7 +350,6 @@ Configuration:
Have libtiff: ${HAVE_TIFF}
Have libgphoto: ${HAVE_GPHOTO2}
Have libopenraw: ${HAVE_LIBOPENRAW}
Have exiv2 xmp support: ${HAVE_XMP}
Have gstreamer: ${HAVE_GSTREAMER}
Use Mac OS X menu: ${HAVE_MACOSMENU}
......
......@@ -32,9 +32,7 @@
#include <sstream>
#include <vector>
#ifdef HAVE_EXIV2_XMP_HPP
#include <exiv2/xmp.hpp>
#endif
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
......@@ -463,7 +461,6 @@ read_exiv2_file (const char *uri, GList *metadata)
}
}
#ifdef HAVE_EXIV2_XMP_HPP
Exiv2::XmpData &xmpData = image->xmpData();
if (!xmpData.empty()) {
......@@ -491,7 +488,6 @@ read_exiv2_file (const char *uri, GList *metadata)
0);
}
}
#endif
return metadata;
}
......@@ -507,7 +503,6 @@ GList *
read_exiv2_sidecar (const char *uri, GList *metadata)
{
try {
#ifdef HAVE_EXIV2_XMP_HPP
Exiv2::DataBuf buf = Exiv2::readFile(uri);
std::string xmpPacket;
xmpPacket.assign(reinterpret_cast<char*>(buf.pData_), buf.size_);
......@@ -543,7 +538,6 @@ read_exiv2_sidecar (const char *uri, GList *metadata)
}
}
Exiv2::XmpParser::terminate();
#endif
return metadata;
}
catch (Exiv2::AnyError& e) {
......@@ -580,6 +574,8 @@ write_metadata (const char *from_file,
const char *to_file,
GList *metadata_in)
{
printf ("\ndebugging: metadata writes are partly broken. Beware!\n");
printf ("Copy from %s to %s:\n",from_file,to_file);
try {
GList *scan;
......@@ -592,33 +588,32 @@ write_metadata (const char *from_file,
Exiv2::ExifData &ed = image1->exifData();
Exiv2::IptcData &id = image1->iptcData();
#ifdef HAVE_EXIV2_XMP_HPP
Exiv2::XmpData &xd = image1->xmpData();
#endif
for (scan = metadata_in; scan; scan = scan->next) {
// Update the requested tag
GthMetadata *metadatum = (GthMetadata *) scan->data;
if (metadatum->full_name != NULL) {
printf ("Copy tag %s = %s\n",metadatum->full_name, metadatum->raw_value);
if (g_str_has_prefix (metadatum->full_name, "Exif")) {
ed[metadatum->full_name] = metadatum->raw_value;
}
else if (g_str_has_prefix (metadatum->full_name, "Iptc")) {
id[metadatum->full_name] = metadatum->raw_value;
}
#ifdef HAVE_EXIV2_XMP_HPP
else if (g_str_has_prefix (metadatum->full_name, "Xmp")) {
xd[metadatum->full_name] = metadatum->raw_value;
}
#endif
}
}
// Delete thumbnail and IFD1 tags, because the main image may
// have changed, and gThumb doesn't use the embedded thumbnails
// anyways.
image1->exifData().eraseThumbnail();
Exiv2::ExifThumb exifThumb(image1->exifData());
exifThumb.erase();
// Mandatory tags - add if not already present
mandatory_int (ed, "Exif.Image.XResolution", 72);
mandatory_int (ed, "Exif.Image.YResolution", 72);
......@@ -666,11 +661,10 @@ write_metadata (const char *from_file,
image2->setExifData (image1->exifData());
image2->setIptcData (image1->iptcData());
#ifdef HAVE_EXIV2_XMP_HPP
image2->setXmpData (image1->xmpData());
#endif
// overwrite existing metadata with new metadata
printf ("Did this write work?\n");
image2->writeMetadata();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment