[gexiv2] Additions to get_comment based on MWG guidelines and common requests



commit bdc9be384d969eca5279eb1e6dd00d219b0b35f4
Author: Alan Pater <alan pater gmail com>
Date:   Fri Mar 20 00:16:04 2015 -0500

    Additions to get_comment based on MWG guidelines and common requests
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746424

 THANKS                     |    1 +
 gexiv2/gexiv2-metadata.cpp |   16 ++++++++++++++++
 gexiv2/gexiv2-metadata.h   |   17 ++++++++++++-----
 3 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/THANKS b/THANKS
index 8a7e87e..7820c2b 100644
--- a/THANKS
+++ b/THANKS
@@ -8,6 +8,7 @@ Petr Morávek <petr pada cz>
 Michael Natterer <mitch gimp org>
 Jehan Pagès <jehan girinstud io>
 Robert Park <r robru ca>
+Alan Pater <alan pater gmail com>
 Michael Pratt <michael prattmic com>
 John Ralls <jralls ceridwen us>
 Akhil Ravidas <deepblue ar gmail com>
diff --git a/gexiv2/gexiv2-metadata.cpp b/gexiv2/gexiv2-metadata.cpp
index 07d76e9..f376dac 100644
--- a/gexiv2/gexiv2-metadata.cpp
+++ b/gexiv2/gexiv2-metadata.cpp
@@ -585,6 +585,18 @@ gchar* gexiv2_metadata_get_comment (GExiv2Metadata *self) {
     else
         g_free (str);
     
+    str = gexiv2_metadata_get_xmp_tag_interpreted_string (self, "Xmp.dc.description");
+    if (str != NULL && *str != '\0')
+        return str;
+    else
+        g_free (str);
+    
+    str = gexiv2_metadata_get_xmp_tag_interpreted_string (self, "Xmp.acdsee.notes");
+    if (str != NULL && *str != '\0')
+        return str;
+    else
+        g_free (str);
+    
     return NULL;
 }
 
@@ -594,12 +606,16 @@ void gexiv2_metadata_set_comment (GExiv2Metadata *self, const gchar* comment) {
     
     Exiv2::ExifData& exif_data = self->priv->image->exifData();
     Exiv2::IptcData& iptc_data = self->priv->image->iptcData();
+    Exiv2::XmpData& xmp_data = self->priv->image->xmpData();
     
     gexiv2_metadata_set_comment_internal (self, (comment != NULL) ? comment : "");
     exif_data ["Exif.Image.ImageDescription"] = comment;
     exif_data ["Exif.Photo.UserComment"] = comment;
     exif_data ["Exif.Image.XPComment"] = comment;
     iptc_data ["Iptc.Application2.Caption"] = comment;
+    xmp_data ["Xmp.dc.description"] = comment;
+    /* Do not need to write to acdsee properties, just read from them */ 
+    // xmp_data ["Xmp.acdsee.notes"] = comment;
 }
 
 void gexiv2_metadata_clear_comment (GExiv2Metadata *self) {
diff --git a/gexiv2/gexiv2-metadata.h b/gexiv2/gexiv2-metadata.h
index 3a28a2b..1e0bfb1 100644
--- a/gexiv2/gexiv2-metadata.h
+++ b/gexiv2/gexiv2-metadata.h
@@ -625,16 +625,23 @@ void                      gexiv2_metadata_set_orientation         (GExiv2Metadata 
*self, GExiv2Orientation
  * gexiv2_metadata_get_comment:
  *
  * A composite accessor that uses the first available metadata field from a list of well-known
- * locations to find the photo's comment (or description).  These fields are:
+ * locations to find the photo's comment (or description).  
  *
- * Exif.Image.ImageDescription
+ * MWG guidelines refer to these as <em>Description</em>: a textual description of a resource's content.
+ * 
+ * These fields are:
+ *
+ * Exif.Image.ImageDescription  (MWG Guidelines)
  * Exif.Photo.UserComment
  * Exif.Image.XPComment
- * Iptc.Application2.Caption
+ * Iptc.Application2.Caption    (MWG Guidelines)
+ * Xmp.dc.description           (MWG Guidelines)
+ * Xmp.acdsee.notes             (Commonly requested, read only)
  *
- * Note that Exif.Image.ImageDescription is <em>not</em> technically a description field and is
- * described in the EXIF specification as "the title of the image".  Also, it does not support
+ * Note that in the EXIF specification Exif.Image.ImageDescription is 
+ * described  as "the title of the image".  Also, it does not support
  * two-byte character codes for encoding.  However, it's still used here for legacy reasons.
+ * 
  *
  * For fine-grained control, it's recommened to use Exiv2 tags directly rather than this method,
  * which is more useful for quick or casual use.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]