comparison 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
comparison
equal deleted inserted replaced
42:606fcf461a68 43:ee03f36e9e4b
68 68
69 #include "intl.h" 69 #include "intl.h"
70 70
71 #include "exif.h" 71 #include "exif.h"
72 72
73 #include "format_raw.h"
73 #include "ui_fileops.h" 74 #include "ui_fileops.h"
74 75
75 76
76 /* 77 /*
77 *----------------------------------------------------------------------------- 78 *-----------------------------------------------------------------------------
435 *----------------------------------------------------------------------------- 436 *-----------------------------------------------------------------------------
436 */ 437 */
437 438
438 #define BYTE_ORDER_INTEL 1 439 #define BYTE_ORDER_INTEL 1
439 #define BYTE_ORDER_MOTOROLA 2 440 #define BYTE_ORDER_MOTOROLA 2
440 441
442
441 #define MARKER_UNKNOWN 0x00 443 #define MARKER_UNKNOWN 0x00
442 #define MARKER_SOI 0xD8 444 #define MARKER_SOI 0xD8
443 #define MARKER_APP1 0xE1 445 #define MARKER_APP1 0xE1
444 446
445 typedef struct { 447 /* These data structs are packed to make sure the
448 * byte alignment matches the on-disk data format.
449 */
450 typedef struct __attribute__((packed)) {
446 char byte_order[2]; 451 char byte_order[2];
447 uint16_t magic; 452 uint16_t magic;
448 uint32_t IFD_offset; 453 uint32_t IFD_offset;
449 } TIFFHeader; 454 } TIFFHeader;
450 455
451 typedef struct { 456 typedef struct __attribute__((packed)) {
452 uint16_t tag; 457 uint16_t tag;
453 uint16_t format; 458 uint16_t format;
454 uint32_t nb; 459 uint32_t nb;
455 uint32_t data; 460 uint32_t data;
456 } IFDEntry; 461 } IFDEntry;
1075 exif->items = NULL; 1080 exif->items = NULL;
1076 1081
1077 if ((res = parse_JPEG(exif, (unsigned char *)f, size)) == -2) 1082 if ((res = parse_JPEG(exif, (unsigned char *)f, size)) == -2)
1078 { 1083 {
1079 res = parse_TIFF(exif, (unsigned char *)f, size); 1084 res = parse_TIFF(exif, (unsigned char *)f, size);
1085 }
1086
1087 if (res != 0)
1088 {
1089 guint32 offset = 0;
1090
1091 if (format_raw_img_exif_offsets(-1, f, size, NULL, &offset))
1092 {
1093 res = parse_TIFF(exif, (unsigned char*)f + offset, size - offset);
1094 }
1080 } 1095 }
1081 1096
1082 if (res != 0) 1097 if (res != 0)
1083 { 1098 {
1084 exif_free(exif); 1099 exif_free(exif);