changeset 177:0ca3b4c8ffae

started exiv2 integration
author nadvornik
date Wed, 13 Feb 2008 14:46:23 +0000
parents 695e1ad3b169
children 9dc8bc9b2bb9
files configure.in src/Makefile.am src/bar_exif.c src/cache-loader.c src/exif.c src/exif.h src/format_canon.c src/format_fuji.c src/format_nikon.c src/format_olympus.c src/format_raw.c src/image.c src/pan-view.c
diffstat 13 files changed, 36 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Wed Feb 13 13:57:31 2008 +0000
+++ b/configure.in	Wed Feb 13 14:46:23 2008 +0000
@@ -7,6 +7,7 @@
 
 AC_ISC_POSIX
 AC_PROG_CC
+AC_PROG_CXX
 AC_STDC_HEADERS
 AC_ARG_PROGRAM
 
@@ -49,6 +50,13 @@
   have_lcms="no (lcms support disabled)"
 fi
 
+
+PKG_CHECK_MODULES(EXIV2, exiv2 >= 0.11,
+  [ have_exiv2=yes
+    AC_DEFINE(HAVE_EXIV2, 1, have exiv2) ],
+  [ have_exiv2=no
+    AC_MSG_RESULT($EXIV2_PKG_ERRORS) ] )
+
 AC_SUBST(LCMS_LIBS)
 AM_CONDITIONAL(HAVE_LCMS, test "$have_lcms" = "yes")
 
--- a/src/Makefile.am	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/Makefile.am	Wed Feb 13 14:46:23 2008 +0000
@@ -84,6 +84,7 @@
 	editors.h	\
 	exif.c		\
 	exif.h		\
+	exiv2.cc	\
 	filelist.c	\
 	filelist.h	\
 	format_canon.c	\
--- a/src/bar_exif.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/bar_exif.c	Wed Feb 13 14:46:23 2008 +0000
@@ -172,7 +172,7 @@
 	ExifData *exif;
 	gint len, i;
 
-	exif = exif_read(eb->fd, FALSE);
+	exif = exif_read(eb->fd->path, FALSE);
 
 	if (!exif)
 		{
--- a/src/cache-loader.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/cache-loader.c	Wed Feb 13 14:46:23 2008 +0000
@@ -125,7 +125,7 @@
 		time_t date = -1;
 		ExifData *exif;
 
-		exif = exif_read(cl->fd, FALSE);
+		exif = exif_read(cl->fd->path, FALSE);
 		if (exif)
 			{
 			gchar *text;
--- a/src/exif.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/exif.c	Wed Feb 13 14:46:23 2008 +0000
@@ -54,6 +54,8 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
+
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
@@ -1232,7 +1234,7 @@
 	g_free(exif);
 }
 
-ExifData *exif_read(FileData *fd, gint parse_color_profile)
+ExifData *exif_read(gchar *path, gint parse_color_profile)
 {
 	ExifData *exif;
 	void *f;
@@ -1241,7 +1243,7 @@
 
 	if (!fd) return NULL;
 
-	pathl = path_from_utf8(fd->path);
+	pathl = path_from_utf8(path);
 	if (map_file(pathl, &f, &size) == -1)
 		{
 		g_free(pathl);
@@ -1848,3 +1850,5 @@
 	fprintf(f, "----------------------------------------------------\n");
 }
 
+#endif 
+/* not HAVE_EXIV2 */
--- a/src/exif.h	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/exif.h	Wed Feb 13 14:46:23 2008 +0000
@@ -97,7 +97,7 @@
  *-----------------------------------------------------------------------------
  */
 
-ExifData *exif_read(FileData *fd, gint parse_color_profile);
+ExifData *exif_read(gchar *path, gint parse_color_profile);
 void exif_free(ExifData *exif);
 
 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key);
--- a/src/format_canon.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/format_canon.c	Wed Feb 13 14:46:23 2008 +0000
@@ -19,6 +19,7 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
 
 #include <stdio.h>
 #include <string.h>
@@ -629,3 +630,5 @@
 }
 
 
+#endif 
+/* not HAVE_EXIV2 */
--- a/src/format_fuji.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/format_fuji.c	Wed Feb 13 14:46:23 2008 +0000
@@ -14,6 +14,7 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
 
 #include <stdio.h>
 #include <string.h>
@@ -201,3 +202,5 @@
 	return TRUE;
 }
 
+#endif 
+/* not HAVE_EXIV2 */
--- a/src/format_nikon.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/format_nikon.c	Wed Feb 13 14:46:23 2008 +0000
@@ -15,6 +15,7 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
 
 #include <stdio.h>
 #include <string.h>
@@ -443,3 +444,5 @@
 	return TRUE;
 }
 
+#endif 
+/* not HAVE_EXIV2 */
--- a/src/format_olympus.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/format_olympus.c	Wed Feb 13 14:46:23 2008 +0000
@@ -11,6 +11,7 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
 
 #include <stdio.h>
 #include <string.h>
@@ -380,3 +381,5 @@
 }
 
 
+#endif 
+/* not HAVE_EXIV2 */
--- a/src/format_raw.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/format_raw.c	Wed Feb 13 14:46:23 2008 +0000
@@ -14,6 +14,7 @@
 #  include "config.h"
 #endif
 
+#ifndef HAVE_EXIV2
 
 #include <stdio.h>
 #include <string.h>
@@ -564,4 +565,6 @@
 }
 #endif
 
+#endif 
+/* not HAVE_EXIV2 */
 
--- a/src/image.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/image.c	Wed Feb 13 14:46:23 2008 +0000
@@ -425,7 +425,7 @@
 	if (exif_rotate_enable ||
 	    (imd->color_profile_enable && imd->color_profile_use_image) )
 		{
-		exif = exif_read(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image));
+		exif = exif_read(imd->image_fd->path, (imd->color_profile_enable && imd->color_profile_use_image));
 		}
 
 	if (exif_rotate_enable && exif)
@@ -624,7 +624,7 @@
 			{
 			ExifData *exif = NULL;
 
-			if (imd->color_profile_use_image) exif = exif_read(imd->image_fd, TRUE);
+			if (imd->color_profile_use_image) exif = exif_read(imd->image_fd->path, TRUE);
 			image_post_process_color(imd, imd->prev_color_row, exif);
 			exif_free(exif);
 			}
--- a/src/pan-view.c	Wed Feb 13 13:57:31 2008 +0000
+++ b/src/pan-view.c	Wed Feb 13 14:46:23 2008 +0000
@@ -1434,7 +1434,7 @@
 	gint i;
 
 	if (!fd) return;
-	exif = exif_read(fd, FALSE);
+	exif = exif_read(fd->path, FALSE);
 	if (!exif) return;
 
 	pan_text_alignment_add(ta, NULL, NULL);