diff -Nru gexiv2-0.10.2/configure gexiv2-0.10.3/configure --- gexiv2-0.10.2/configure 2014-09-16 22:15:53.000000000 +0000 +++ gexiv2-0.10.3/configure 2015-03-23 23:14:23.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gexiv2 0.10.2. +# Generated by GNU Autoconf 2.69 for gexiv2 0.10.3. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='gexiv2' PACKAGE_TARNAME='gexiv2' -PACKAGE_VERSION='0.10.2' -PACKAGE_STRING='gexiv2 0.10.2' +PACKAGE_VERSION='0.10.3' +PACKAGE_STRING='gexiv2 0.10.3' PACKAGE_BUGREPORT='gexiv2-list@gnome.org' PACKAGE_URL='https://wiki.gnome.org/Projects/gexiv2' @@ -1362,7 +1362,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gexiv2 0.10.2 to adapt to many kinds of systems. +\`configure' configures gexiv2 0.10.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1432,7 +1432,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gexiv2 0.10.2:";; + short | recursive ) echo "Configuration of gexiv2 0.10.3:";; esac cat <<\_ACEOF @@ -1554,7 +1554,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gexiv2 configure 0.10.2 +gexiv2 configure 0.10.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2136,7 +2136,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gexiv2 $as_me 0.10.2, which was +It was created by gexiv2 $as_me 0.10.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3004,7 +3004,7 @@ # Define the identity of the package. PACKAGE='gexiv2' - VERSION='0.10.2' + VERSION='0.10.3' # Some tools Automake needs. @@ -16040,8 +16040,8 @@ GEXIV2_MAJOR_VERSION=0 GEXIV2_MINOR_VERSION=10 -GEXIV2_MICRO_VERSION=2 -GEXIV2_VERSION=0.10.2 +GEXIV2_MICRO_VERSION=3 +GEXIV2_VERSION=0.10.3 @@ -17155,7 +17155,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gexiv2 $as_me 0.10.2, which was +This file was extended by gexiv2 $as_me 0.10.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17213,7 +17213,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gexiv2 config.status 0.10.2 +gexiv2 config.status 0.10.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru gexiv2-0.10.2/configure.ac gexiv2-0.10.3/configure.ac --- gexiv2-0.10.2/configure.ac 2014-09-16 22:09:05.000000000 +0000 +++ gexiv2-0.10.3/configure.ac 2015-03-23 23:13:08.000000000 +0000 @@ -1,4 +1,4 @@ -AC_INIT([gexiv2], [0.10.2], [gexiv2-list@gnome.org], [gexiv2], [https://wiki.gnome.org/Projects/gexiv2]) +AC_INIT([gexiv2], [0.10.3], [gexiv2-list@gnome.org], [gexiv2], [https://wiki.gnome.org/Projects/gexiv2]) AC_PREREQ(2.54) AC_CONFIG_MACRO_DIR([m4]) @@ -20,7 +20,7 @@ m4_define([gexiv2_major_version], [0]) m4_define([gexiv2_minor_version], [10]) -m4_define([gexiv2_micro_version], [2]) +m4_define([gexiv2_micro_version], [3]) m4_define([gexiv2_real_version], [gexiv2_major_version.gexiv2_minor_version.gexiv2_micro_version]) m4_define([gexiv2_version], [gexiv2_real_version]) diff -Nru gexiv2-0.10.2/debian/changelog gexiv2-0.10.3/debian/changelog --- gexiv2-0.10.2/debian/changelog 2015-02-19 21:48:10.000000000 +0000 +++ gexiv2-0.10.3/debian/changelog 2015-09-09 01:33:13.000000000 +0000 @@ -1,9 +1,27 @@ -gexiv2 (0.10.2-2.1~pmo1~trusty) trusty; urgency=low +gexiv2 (0.10.3-1.2pmo1~trusty) trusty; urgency=high - * Set gcc flag to -O3 instead of -O2 for Quad Core optimization. - * Fix the girepository-1.0 library path. + * No-change rebuild against libexiv2-14 - -- Pascal Mons Thu, 19 Feb 2015 16:48:10 -0500 + -- Pascal Mons Tue, 08 Sep 2015 21:33:13 -0400 + +gexiv2 (0.10.3-1.1pmo1~trusty) trusty; urgency=medium + + * Set gcc flag to -O3 instead of -O2 (default) + for Quad Core optimization in debian/rules. + * Fix the girepository-1.0 library path in + debian/gir1.2-gexiv2-0.10.install. + + -- Pascal Mons Fri, 08 May 2015 15:16:37 -0400 + +gexiv2 (0.10.3-1) unstable; urgency=medium + + * New upstream release. + * debian/libgexiv2-2.symbols: + - Refresh symbols file. + * debian/rules: + - Adjust dh_makeshlibs call. + + -- Luca Falavigna Fri, 01 May 2015 16:33:29 +0200 gexiv2 (0.10.2-2) unstable; urgency=medium diff -Nru gexiv2-0.10.2/debian/copyright gexiv2-0.10.3/debian/copyright --- gexiv2-0.10.2/debian/copyright 2014-09-26 12:05:23.000000000 +0000 +++ gexiv2-0.10.3/debian/copyright 2015-05-01 14:34:39.000000000 +0000 @@ -15,7 +15,7 @@ License: LGPL-2.1+ Files: debian/* -Copyright: 2010-2013 Luca Falavigna +Copyright: 2010-2015 Luca Falavigna 2010-2011 Devid Antonio Filoni License: GPL-2+ diff -Nru gexiv2-0.10.2/debian/libgexiv2-2.symbols gexiv2-0.10.3/debian/libgexiv2-2.symbols --- gexiv2-0.10.2/debian/libgexiv2-2.symbols 2014-09-26 12:05:23.000000000 +0000 +++ gexiv2-0.10.3/debian/libgexiv2-2.symbols 2015-05-01 14:41:30.000000000 +0000 @@ -62,6 +62,7 @@ gexiv2_metadata_erase_exif_thumbnail@Base 0.6.1 gexiv2_metadata_free@Base 0.6.1 gexiv2_metadata_from_app1_segment@Base 0.6.1 + gexiv2_metadata_generate_xmp_packet@Base 0.10.3 gexiv2_metadata_get_comment@Base 0.6.1 gexiv2_metadata_get_exif_tag_description@Base 0.6.1 gexiv2_metadata_get_exif_tag_interpreted_string@Base 0.6.1 @@ -69,6 +70,7 @@ gexiv2_metadata_get_exif_tag_long@Base 0.6.1 gexiv2_metadata_get_exif_tag_rational@Base 0.6.1 gexiv2_metadata_get_exif_tag_rational_as_double@Base 0.9.1 + gexiv2_metadata_get_exif_tag_raw@Base 0.10.3 gexiv2_metadata_get_exif_tag_string@Base 0.6.1 gexiv2_metadata_get_exif_tag_type@Base 0.7.0 gexiv2_metadata_get_exif_tags@Base 0.6.1 @@ -84,6 +86,7 @@ gexiv2_metadata_get_iptc_tag_interpreted_string@Base 0.6.1 gexiv2_metadata_get_iptc_tag_label@Base 0.6.1 gexiv2_metadata_get_iptc_tag_multiple@Base 0.6.1 + gexiv2_metadata_get_iptc_tag_raw@Base 0.10.3 gexiv2_metadata_get_iptc_tag_string@Base 0.6.1 gexiv2_metadata_get_iptc_tag_type@Base 0.7.0 gexiv2_metadata_get_iptc_tags@Base 0.6.1 @@ -104,6 +107,7 @@ gexiv2_metadata_get_tag_label@Base 0.6.1 gexiv2_metadata_get_tag_long@Base 0.6.1 gexiv2_metadata_get_tag_multiple@Base 0.6.1 + gexiv2_metadata_get_tag_raw@Base 0.10.3 gexiv2_metadata_get_tag_string@Base 0.6.1 gexiv2_metadata_get_tag_type@Base 0.7.0 gexiv2_metadata_get_type@Base 0.6.1 @@ -113,6 +117,7 @@ gexiv2_metadata_get_xmp_tag_label@Base 0.6.1 gexiv2_metadata_get_xmp_tag_long@Base 0.6.1 gexiv2_metadata_get_xmp_tag_multiple@Base 0.6.1 + gexiv2_metadata_get_xmp_tag_raw@Base 0.10.3 gexiv2_metadata_get_xmp_tag_string@Base 0.6.1 gexiv2_metadata_get_xmp_tag_type@Base 0.7.0 gexiv2_metadata_get_xmp_tags@Base 0.6.1 @@ -151,6 +156,7 @@ gexiv2_metadata_set_xmp_tag_long@Base 0.6.1 gexiv2_metadata_set_xmp_tag_multiple@Base 0.6.1 gexiv2_metadata_set_xmp_tag_string@Base 0.6.1 + gexiv2_metadata_set_xmp_tag_struct@Base 0.10.3 gexiv2_metadata_unregister_all_xmp_namespaces@Base 0.6.1 gexiv2_metadata_unregister_xmp_namespace@Base 0.6.1 gexiv2_preview_image_free@Base 0.6.1 diff -Nru gexiv2-0.10.2/debian/rules gexiv2-0.10.3/debian/rules --- gexiv2-0.10.2/debian/rules 2015-02-19 21:29:47.000000000 +0000 +++ gexiv2-0.10.3/debian/rules 2015-05-08 18:35:31.000000000 +0000 @@ -15,7 +15,7 @@ dh_auto_configure -- --enable-introspection --enable-static override_dh_makeshlibs: - dh_makeshlibs -V 'libgexiv2-2 (>= 0.9.1)' + dh_makeshlibs -V 'libgexiv2-2 (>= 0.10.3)' override_dh_installchangelogs: dh_installchangelogs NEWS diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata.cpp gexiv2-0.10.3/gexiv2/gexiv2-metadata.cpp --- gexiv2-0.10.2/gexiv2/gexiv2-metadata.cpp 2014-01-17 20:14:04.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata.cpp 2015-03-23 23:06:27.000000000 +0000 @@ -741,7 +741,7 @@ } gdouble gexiv2_metadata_get_fnumber (GExiv2Metadata *self) { - return gexiv2_metadata_get_exif_tag_rational_as_double(self, "Exif.Photo.Fnumber", -1.0); + return gexiv2_metadata_get_exif_tag_rational_as_double(self, "Exif.Photo.FNumber", -1.0); } gdouble gexiv2_metadata_get_focal_length (GExiv2Metadata *self) { @@ -868,4 +868,21 @@ return NULL; } +GBytes* gexiv2_metadata_get_tag_raw(GExiv2Metadata *self, const gchar* tag) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); + g_return_val_if_fail(tag != NULL, NULL); + g_return_val_if_fail(self->priv->image.get() != NULL, NULL); + + if (gexiv2_metadata_is_xmp_tag(tag)) + return gexiv2_metadata_get_xmp_tag_raw(self, tag); + + if (gexiv2_metadata_is_exif_tag(tag)) + return gexiv2_metadata_get_exif_tag_raw(self, tag); + + if (gexiv2_metadata_is_iptc_tag(tag)) + return gexiv2_metadata_get_iptc_tag_raw(self, tag); + + return NULL; +} + G_END_DECLS diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata-exif.cpp gexiv2-0.10.3/gexiv2/gexiv2-metadata-exif.cpp --- gexiv2-0.10.2/gexiv2/gexiv2-metadata-exif.cpp 2014-09-16 22:07:34.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata-exif.cpp 2015-03-23 23:05:49.000000000 +0000 @@ -293,4 +293,31 @@ return NULL; } +GBytes* gexiv2_metadata_get_exif_tag_raw (GExiv2Metadata *self, const gchar* tag) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); + g_return_val_if_fail(tag != NULL, NULL); + g_return_val_if_fail(self->priv->image.get() != NULL, NULL); + + Exiv2::ExifData &exif_data = self->priv->image->exifData(); + + try { + Exiv2::ExifData::iterator it = exif_data.findKey(Exiv2::ExifKey(tag)); + while (it != exif_data.end() && it->count() == 0) + it++; + + if (it != exif_data.end()) { + long size = it->size(); + if( size > 0 ) { + gpointer data = g_malloc(size); + it->copy((Exiv2::byte*)data, Exiv2::invalidByteOrder); + return g_bytes_new_take(data, size); + } + } + } catch (Exiv2::Error& e) { + LOG_ERROR(e); + } + + return NULL; +} + G_END_DECLS diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata.h gexiv2-0.10.3/gexiv2/gexiv2-metadata.h --- gexiv2-0.10.2/gexiv2/gexiv2-metadata.h 2014-09-16 20:29:07.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata.h 2015-03-23 23:05:49.000000000 +0000 @@ -64,6 +64,29 @@ GEXIV2_ORIENTATION_MAX = 8 } GExiv2Orientation; +typedef enum { + GEXIV2_STRUCTURE_XA_NONE = 0, + GEXIV2_STRUCTURE_XA_ALT = 20, + GEXIV2_STRUCTURE_XA_BAG = 21, + GEXIV2_STRUCTURE_XA_SEQ = 22, + GEXIV2_STRUCTURE_XA_LANG = 23 +} GExiv2StructureType; + +/** + * GExiv2XmpFormatFlags: + * Options to control the format of the serialized XMP packet + * Taken from: exiv2/src/xmp.hpp + * + */ +typedef enum { + GEXIV2_OMIT_PACKET_WRAPPER = 0x0010UL, //!< Omit the XML packet wrapper. + GEXIV2_READ_ONLY_PACKET = 0x0020UL, //!< Default is a writeable packet. + GEXIV2_USE_COMPACT_FORMAT = 0x0040UL, //!< Use a compact form of RDF. + GEXIV2_INCLUDE_THUMBNAIL_PAD = 0x0100UL, //!< Include a padding allowance for a thumbnail image. + GEXIV2_EXACT_PACKET_LENGTH = 0x0200UL, //!< The padding parameter is the overall packet length. + GEXIV2_WRITE_ALIAS_COMMENTS = 0x0400UL, //!< Show aliases as XML comments. + GEXIV2_OMIT_ALL_FORMATTING = 0x0800UL //!< Omit all formatting whitespace. +} GExiv2XmpFormatFlags; typedef struct _GExiv2Metadata GExiv2Metadata; typedef struct _GExiv2MetadataClass GExiv2MetadataClass; @@ -338,6 +361,17 @@ gboolean gexiv2_metadata_set_tag_string (GExiv2Metadata *self, const gchar* tag, const gchar* value); /** + * gexiv2_metadata_set_tag_struct: + * @tag: Exiv2 tag name + * @type: The GExiv2StructureType specifying the type of structure + * + * The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html + * + * Returns: TRUE on success + */ +gboolean gexiv2_metadata_set_xmp_tag_struct (GExiv2Metadata *self, const gchar* tag, GExiv2StructureType type); + +/** * gexiv2_metadata_get_tag_interpreted_string: * @tag: Exiv2 tag name * @@ -395,6 +429,16 @@ gboolean gexiv2_metadata_set_tag_multiple (GExiv2Metadata *self, const gchar* tag, const gchar** values); /** + * gexiv2_metadata_get_tag_raw: + * @tag: Exiv2 tag name + * + * The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html + * + * Returns: (transfer full) (allow-none): The tag's raw value as a byte array + */ +GBytes* gexiv2_metadata_get_tag_raw (GExiv2Metadata *self, const gchar* tag); + +/** * EXIF functions */ @@ -493,9 +537,16 @@ void gexiv2_metadata_clear_xmp (GExiv2Metadata *self); /** + * gexiv2_metadata_generate_xmp_packet: + * + * Returns: (transfer full) (allow-none): Encode the XMP packet and return as a NUL-terminated string. + */ +gchar* gexiv2_metadata_generate_xmp_packet (GExiv2Metadata *self, GExiv2XmpFormatFlags xmp_format_flags, guint32 padding); + +/** * gexiv2_metadata_get_xmp_packet: * - * Returns: (transfer full) (allow-none): The XMP tag's description + * Returns: (transfer full) (allow-none): The currently-encoded XMP packet (see gexiv2_metadata_generate_xmp_packet). */ gchar* gexiv2_metadata_get_xmp_packet (GExiv2Metadata *self); diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata-iptc.cpp gexiv2-0.10.3/gexiv2/gexiv2-metadata-iptc.cpp --- gexiv2-0.10.2/gexiv2/gexiv2-metadata-iptc.cpp 2014-05-12 23:25:21.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata-iptc.cpp 2015-03-23 23:05:49.000000000 +0000 @@ -277,4 +277,31 @@ return NULL; } +GBytes* gexiv2_metadata_get_iptc_tag_raw (GExiv2Metadata *self, const gchar* tag) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); + g_return_val_if_fail(tag != NULL, NULL); + g_return_val_if_fail(self->priv->image.get() != NULL, NULL); + + Exiv2::IptcData& iptc_data = self->priv->image->iptcData(); + + try { + Exiv2::IptcData::iterator it = iptc_data.findKey(Exiv2::IptcKey(tag)); + while (it != iptc_data.end() && it->count() == 0) + it++; + + if (it != iptc_data.end()) { + long size = it->size(); + if( size > 0 ) { + gpointer data = g_malloc(size); + it->copy((Exiv2::byte*)data, Exiv2::invalidByteOrder); + return g_bytes_new_take(data, size); + } + } + } catch (Exiv2::Error& e) { + LOG_ERROR(e); + } + + return NULL; +} + G_END_DECLS diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata-private.h gexiv2-0.10.3/gexiv2/gexiv2-metadata-private.h --- gexiv2-0.10.2/gexiv2/gexiv2-metadata-private.h 2014-01-17 20:14:49.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata-private.h 2015-03-23 23:05:49.000000000 +0000 @@ -50,6 +50,8 @@ const gchar* gexiv2_metadata_get_exif_tag_description (const gchar* tag); const gchar* gexiv2_metadata_get_exif_tag_type (const gchar* tag); +GBytes* gexiv2_metadata_get_exif_tag_raw (GExiv2Metadata *self, const gchar* tag); + /* private XMP functions */ gboolean gexiv2_metadata_clear_xmp_tag (GExiv2Metadata *self, const gchar* tag); @@ -66,6 +68,8 @@ const gchar* gexiv2_metadata_get_xmp_tag_description (const gchar* tag); const gchar* gexiv2_metadata_get_xmp_tag_type (const gchar* tag); +GBytes* gexiv2_metadata_get_xmp_tag_raw (GExiv2Metadata *self, const gchar* tag); + /* private IPTC functions */ gboolean gexiv2_metadata_clear_iptc_tag (GExiv2Metadata *self, const gchar* tag); @@ -80,6 +84,7 @@ const gchar* gexiv2_metadata_get_iptc_tag_description (const gchar* tag); const gchar* gexiv2_metadata_get_iptc_tag_type (const gchar* tag); +GBytes* gexiv2_metadata_get_iptc_tag_raw (GExiv2Metadata *self, const gchar* tag); G_END_DECLS diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-metadata-xmp.cpp gexiv2-0.10.3/gexiv2/gexiv2-metadata-xmp.cpp --- gexiv2-0.10.2/gexiv2/gexiv2-metadata-xmp.cpp 2014-09-16 20:31:19.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-metadata-xmp.cpp 2015-03-23 23:05:49.000000000 +0000 @@ -30,6 +30,22 @@ self->priv->image->xmpData().clear(); } +gchar *gexiv2_metadata_generate_xmp_packet(GExiv2Metadata *self, + GExiv2XmpFormatFlags xmp_format_flags, guint32 padding) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); + g_return_val_if_fail(self->priv->image.get() != NULL, NULL); + + Exiv2::XmpData &xmp_data = self->priv->image->xmpData(); + try { + if (Exiv2::XmpParser::encode(self->priv->image->xmpPacket(), xmp_data, xmp_format_flags, padding) == 0) + return g_strdup(self->priv->image->xmpPacket().c_str()); + } catch (Exiv2::Error& e) { + LOG_ERROR(e); + } + + return NULL; +} + gchar *gexiv2_metadata_get_xmp_packet(GExiv2Metadata *self) { g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); g_return_val_if_fail(self->priv->image.get() != NULL, NULL); @@ -156,6 +172,47 @@ return NULL; } +gboolean gexiv2_metadata_set_xmp_tag_struct (GExiv2Metadata *self, const gchar* tag, GExiv2StructureType type) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), FALSE); + g_return_val_if_fail(tag != NULL, FALSE); + g_return_val_if_fail(self->priv->image.get() != NULL, FALSE); + + Exiv2::XmpTextValue tv(""); + Exiv2::XmpData& xmp_data = self->priv->image->xmpData(); + + switch (type) { + case GEXIV2_STRUCTURE_XA_NONE: + tv.read(""); // Clear the value + tv.setXmpArrayType(Exiv2::XmpValue::xaNone); + break; + case GEXIV2_STRUCTURE_XA_ALT: + tv.read(""); + tv.setXmpArrayType(Exiv2::XmpValue::xaAlt); + break; + case GEXIV2_STRUCTURE_XA_BAG: + tv.read(""); + tv.setXmpArrayType(Exiv2::XmpValue::xaBag); + break; + case GEXIV2_STRUCTURE_XA_SEQ: + tv.read(""); + tv.setXmpArrayType(Exiv2::XmpValue::xaSeq); + break; + default: + g_warning("Invalid structure type."); + return FALSE; + break; + } + + try { + xmp_data.add(Exiv2::XmpKey(tag), &tv); + return TRUE; + } catch (Exiv2::Error& e) { + LOG_ERROR(e); + } + + return FALSE; +} + gboolean gexiv2_metadata_set_xmp_tag_string (GExiv2Metadata *self, const gchar* tag, const gchar* value) { g_return_val_if_fail(GEXIV2_IS_METADATA (self), FALSE); @@ -312,6 +369,33 @@ return NULL; } +GBytes* gexiv2_metadata_get_xmp_tag_raw (GExiv2Metadata *self, const gchar* tag) { + g_return_val_if_fail(GEXIV2_IS_METADATA (self), NULL); + g_return_val_if_fail(tag != NULL, NULL); + g_return_val_if_fail(self->priv->image.get() != NULL, NULL); + + Exiv2::XmpData& xmp_data = self->priv->image->xmpData(); + + try { + Exiv2::XmpData::iterator it = xmp_data.findKey(Exiv2::XmpKey(tag)); + while (it != xmp_data.end() && it->count() == 0) + it++; + + if (it != xmp_data.end()) { + long size = it->size(); + if( size > 0 ) { + gpointer data = g_malloc(size); + it->copy((Exiv2::byte*)data, Exiv2::invalidByteOrder); + return g_bytes_new_take(data, size); + } + } + } catch (Exiv2::Error& e) { + LOG_ERROR(e); + } + + return NULL; +} + gboolean gexiv2_metadata_register_xmp_namespace (const gchar* name, const gchar* prefix) { g_return_val_if_fail(name != NULL, FALSE); g_return_val_if_fail(prefix != NULL, FALSE); diff -Nru gexiv2-0.10.2/gexiv2/gexiv2-version.h gexiv2-0.10.3/gexiv2/gexiv2-version.h --- gexiv2-0.10.2/gexiv2/gexiv2-version.h 2014-09-16 22:15:56.000000000 +0000 +++ gexiv2-0.10.3/gexiv2/gexiv2-version.h 2015-03-23 23:14:43.000000000 +0000 @@ -13,7 +13,7 @@ #define GEXIV2_MAJOR_VERSION 0 #define GEXIV2_MINOR_VERSION 10 -#define GEXIV2_MICRO_VERSION 2 +#define GEXIV2_MICRO_VERSION 3 /** * GEXIV2_CHECK_VERSION: diff -Nru gexiv2-0.10.2/GExiv2.py gexiv2-0.10.3/GExiv2.py --- gexiv2-0.10.2/GExiv2.py 2014-08-08 19:12:46.000000000 +0000 +++ gexiv2-0.10.3/GExiv2.py 2015-03-23 23:05:49.000000000 +0000 @@ -78,6 +78,9 @@ def get(self, key, default=None): return self.get_tag_string(key) if self.has_tag(key) else default + + def get_raw(self, key): + return self.get_tag_raw(key).get_data() def __iter__(self): return iter(self.get_tags()) diff -Nru gexiv2-0.10.2/gexiv2.vapi gexiv2-0.10.3/gexiv2.vapi --- gexiv2-0.10.2/gexiv2.vapi 2014-03-17 21:13:05.000000000 +0000 +++ gexiv2-0.10.3/gexiv2.vapi 2015-03-23 23:05:49.000000000 +0000 @@ -30,6 +30,7 @@ public void delete_gps_info (); public void erase_exif_thumbnail (); public bool from_app1_segment ([CCode (array_length = false)] uchar[] data, long n_data) throws GLib.Error; + public string? generate_xmp_packet (GExiv2.XmpFormatFlags xmp_format_flags, uint32 padding); public string? get_comment (); public bool get_exif_tag_rational (string tag, out int nom, out int den); [CCode (array_length = false, array_null_terminated = true)] @@ -61,6 +62,7 @@ public long get_tag_long (string tag); [CCode (array_length = false, array_null_terminated = true)] public string[]? get_tag_multiple (string tag); + public GLib.Bytes? get_tag_raw (string tag); public string? get_tag_string (string tag); public static unowned string get_tag_type (string tag); public string? get_xmp_packet (); @@ -88,6 +90,7 @@ public bool set_tag_long (string tag, long value); public bool set_tag_multiple (string tag, [CCode (array_length = false, array_null_terminated = true)] string[] values); public bool set_tag_string (string tag, string value); + public bool set_xmp_tag_struct (string tag, GExiv2.StructureType type); public static void unregister_all_xmp_namespaces (); public static bool unregister_xmp_namespace (string name); } @@ -132,12 +135,30 @@ ROT_270, MAX } + [CCode (cheader_filename = "gexiv2/gexiv2.h", cprefix = "GEXIV2_STRUCTURE_XA_", has_type_id = false)] + public enum StructureType { + NONE, + ALT, + BAG, + SEQ, + LANG + } [CCode (cheader_filename = "gexiv2/gexiv2.h", cprefix = "", has_type_id = false)] public enum WrapperSeekOrigin { Begin, Current, End } + [CCode (cheader_filename = "gexiv2/gexiv2.h", cprefix = "GEXIV2_", has_type_id = false)] + public enum XmpFormatFlags { + OMIT_PACKET_WRAPPER, + READ_ONLY_PACKET, + USE_COMPACT_FORMAT, + INCLUDE_THUMBNAIL_PAD, + EXACT_PACKET_LENGTH, + WRITE_ALIAS_COMMENTS, + OMIT_ALL_FORMATTING + } [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)] public delegate void LogHandler (GExiv2.LogLevel level, string msg); [CCode (cheader_filename = "gexiv2/gexiv2.h", has_target = false)] diff -Nru gexiv2-0.10.2/Makefile.am gexiv2-0.10.3/Makefile.am --- gexiv2-0.10.2/Makefile.am 2014-09-16 22:07:53.000000000 +0000 +++ gexiv2-0.10.3/Makefile.am 2015-03-23 23:05:49.000000000 +0000 @@ -16,7 +16,10 @@ @PACKAGE_NAME@.vapi \ gexiv2/gexiv2-version.m4 \ $(TYPELIB_FILES) \ - test/gexiv2-dump.vala + test/sample-author-badencoding.jpg \ + test/gexiv2-dump.vala \ + test/python/gexiv2.py + # Installed Files # pkgconfig_DATA = @PACKAGE_NAME@.pc @@ -105,16 +108,24 @@ rm -f gexiv2/gexiv2-version.h rm -f gexiv2.pc rm -f test/gexiv2-dump + rm -rf test/python/gi test/python/__pycache__ # Tests and utilities # if ENABLE_TESTS -tests: test/gexiv2-dump +tests: test/gexiv2-dump test/python2 test/python3 test/gexiv2-dump: test/gexiv2-dump.vala valac -g --enable-checking --vapidir=. --pkg gexiv2 $< -o $@ +test/python/gi/overrides/GExiv2.py: + [ -d $(dir $@) ] || mkdir -p $(dir $@) + ln -sf ../../../../GExiv2.py $@ + +test/python%: $(TYPELIB_FILES) test/python/gi/overrides/GExiv2.py + LD_LIBRARY_PATH=.libs GI_TYPELIB_PATH=. PYTHONPATH=test/python python$* -m unittest gexiv2 + endif # Optional Introspection # diff -Nru gexiv2-0.10.2/Makefile.in gexiv2-0.10.3/Makefile.in --- gexiv2-0.10.2/Makefile.in 2014-09-16 22:15:53.000000000 +0000 +++ gexiv2-0.10.3/Makefile.in 2015-03-23 23:14:23.000000000 +0000 @@ -425,7 +425,9 @@ @PACKAGE_NAME@.vapi \ gexiv2/gexiv2-version.m4 \ $(TYPELIB_FILES) \ - test/gexiv2-dump.vala + test/sample-author-badencoding.jpg \ + test/gexiv2-dump.vala \ + test/python/gexiv2.py # Installed Files # @@ -1243,14 +1245,22 @@ rm -f gexiv2/gexiv2-version.h rm -f gexiv2.pc rm -f test/gexiv2-dump + rm -rf test/python/gi test/python/__pycache__ # Tests and utilities # -@ENABLE_TESTS_TRUE@tests: test/gexiv2-dump +@ENABLE_TESTS_TRUE@tests: test/gexiv2-dump test/python2 test/python3 @ENABLE_TESTS_TRUE@test/gexiv2-dump: test/gexiv2-dump.vala @ENABLE_TESTS_TRUE@ valac -g --enable-checking --vapidir=. --pkg gexiv2 $< -o $@ +@ENABLE_TESTS_TRUE@test/python/gi/overrides/GExiv2.py: +@ENABLE_TESTS_TRUE@ [ -d $(dir $@) ] || mkdir -p $(dir $@) +@ENABLE_TESTS_TRUE@ ln -sf ../../../../GExiv2.py $@ + +@ENABLE_TESTS_TRUE@test/python%: $(TYPELIB_FILES) test/python/gi/overrides/GExiv2.py +@ENABLE_TESTS_TRUE@ LD_LIBRARY_PATH=.libs GI_TYPELIB_PATH=. PYTHONPATH=test/python python$* -m unittest gexiv2 + %.typelib: %.gir g-ir-compiler --includedir=$(BUILD_DIR) -o $@ $< diff -Nru gexiv2-0.10.2/NEWS gexiv2-0.10.3/NEWS --- gexiv2-0.10.2/NEWS 2014-09-16 22:14:13.000000000 +0000 +++ gexiv2-0.10.3/NEWS 2015-03-23 23:10:48.000000000 +0000 @@ -1,3 +1,12 @@ +gexiv2 0.10.3 - 23 March 2015 +----------------------------- + + * Retrieve XMP tag's structure type (#736799) + * Generate XMP packet as NUL-terminated string (#736587) + * Retrieve tag's raw value as GBytes (#730136) + * Fix gexiv2_metadata_get_fnumber() (#745347) + + gexiv2 0.10.2 - 16 September 2014 --------------------------------- diff -Nru gexiv2-0.10.2/README gexiv2-0.10.3/README --- gexiv2-0.10.2/README 2014-02-04 20:59:05.000000000 +0000 +++ gexiv2-0.10.3/README 2015-03-23 23:06:08.000000000 +0000 @@ -26,5 +26,5 @@ - Copyright 2011-2014 Yorba Foundation + Copyright 2011-2015 Yorba Foundation diff -Nru gexiv2-0.10.2/test/python/gexiv2.py gexiv2-0.10.3/test/python/gexiv2.py --- gexiv2-0.10.2/test/python/gexiv2.py 1970-01-01 00:00:00.000000000 +0000 +++ gexiv2-0.10.3/test/python/gexiv2.py 2015-03-23 23:05:49.000000000 +0000 @@ -0,0 +1,53 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2014 Alexandre Rossi +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +import unittest +import os + + +# Workaround pkutil.extend_path in dist-packages/gi/overrides/__init__.py +# not helping us here for obscure reasons when using python2 (the following +# is useless in python3). +import gi.overrides +gi.overrides.__path__.append(os.path.join(os.path.dirname(__file__), + 'gi', 'overrides')) + + +from gi.repository import GExiv2 + + +SAMPLES_DIR = os.path.join(os.path.dirname(__file__), '..') + + +class TestGexiv2(unittest.TestCase): + + def get_sample_path(self, sample): + return os.path.join(SAMPLES_DIR, sample) + + def test_author_badencoding(self): + sample = 'sample-author-badencoding.jpg' + md = GExiv2.Metadata(self.get_sample_path(sample)) + + self.assertEqual(md.get_raw('Exif.Image.Artist'), b'\xc0\xeb\xe5\xea\xf1\xe0\xed\xe4\xf0 \xca\xee\xf8\xe5\xeb\xe5\xe2\x00') + + +if __name__ == '__main__': + unittest.main() Binary files /tmp/48MQkrZ9VX/gexiv2-0.10.2/test/sample-author-badencoding.jpg and /tmp/SoQClKUeNt/gexiv2-0.10.3/test/sample-author-badencoding.jpg differ diff -Nru gexiv2-0.10.2/THANKS gexiv2-0.10.3/THANKS --- gexiv2-0.10.2/THANKS 2014-09-16 22:07:44.000000000 +0000 +++ gexiv2-0.10.3/THANKS 2015-03-23 23:05:49.000000000 +0000 @@ -3,6 +3,7 @@ Robert Ancell Dan Callaghan Luca Falavigna +Hartmut Kuhse Petr Morávek Michael Natterer Jehan Pagès @@ -11,6 +12,7 @@ John Ralls Akhil Ravidas Clint Rogers +Alexandre Rossi Alexandre Rostovtsev Ankur Sinha Alexander Steffen