diff src/exif.c @ 43:ee03f36e9e4b

Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net> * format_raw.[ch]: New files to parse image data and exif offsets for the raw camera formats. * exif.c, image-load.c: Add support calls to format_raw.c functions above. * filelist.c: Add Fujifilm raw file extension to known formats. * thumb_standard.c (thumb_loader_std_start): Check for existing thumbnail file before checking for a failure mark. * src/Makefile.am: Add format_raw.[ch]. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Mon, 16 May 2005 01:49:51 +0000
parents d907d608745f
children 7cfa60beda76
line wrap: on
line diff
--- a/src/exif.c	Sat May 14 20:58:18 2005 +0000
+++ b/src/exif.c	Mon May 16 01:49:51 2005 +0000
@@ -70,6 +70,7 @@
 
 #include "exif.h"
 
+#include "format_raw.h"
 #include "ui_fileops.h"
 
 
@@ -437,18 +438,22 @@
 
 #define BYTE_ORDER_INTEL	1
 #define BYTE_ORDER_MOTOROLA	2
-                                                                                                                          
+
+
 #define MARKER_UNKNOWN		0x00
 #define MARKER_SOI		0xD8
 #define MARKER_APP1		0xE1
 
-typedef struct {
+/* These data structs are packed to make sure the
+ * byte alignment matches the on-disk data format.
+ */
+typedef struct __attribute__((packed)) {
 	char		byte_order[2];
 	uint16_t	magic;
 	uint32_t	IFD_offset;
 } TIFFHeader;
  
-typedef struct {
+typedef struct __attribute__((packed)) {
 	uint16_t	tag;
 	uint16_t	format;
 	uint32_t	nb;
@@ -1081,6 +1086,16 @@
 
 	if (res != 0)
 		{
+		guint32 offset = 0;
+		
+		if (format_raw_img_exif_offsets(-1, f, size, NULL, &offset))
+			{
+			res = parse_TIFF(exif, (unsigned char*)f + offset, size - offset);
+			}
+		}
+
+	if (res != 0)
+		{
 		exif_free(exif);
 		exif = NULL;
 		}