annotate src/format_canon.c @ 53:00843150f7c8

Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net> * filelist.c (filter_add_defaults): Add Nikon file extension for nef. * format_canon.[ch], format_fuji.[ch]: Add comment tile, and description field for MakerNote parser. * format_nikon.[ch]: Add support for jpegs embedded in Nikon nef files. * format_raw.c: Add debug description output and Nikon raw parser hook. ##### 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 Tue, 07 Jun 2005 07:55:00 +0000
parents 276ea4c98d33
children b58cac75ad12
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
2 * GQView
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2005 John Ellis
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * This software is released under the GNU General Public License (GNU GPL).
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 * Please read the included file COPYING for more information.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 * This software comes with no warranty of any kind, use at your own risk!
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 * Code to add support for Canon CR2 and CRW files, version 0.2
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12 * Developed by Daniel M. German, dmgerman at uvic.ca
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
13 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14 * you can find the sources for this patch at http://turingmachine.org/~dmg/libdcraw/gqview/
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18 #ifdef HAVE_CONFIG_H
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19 # include "config.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 #include <stdio.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24 #include <string.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25 #include <unistd.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
26
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
27 #include <glib.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29 #include "intl.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
31 #include "format_canon.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
32 #include "format_raw.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
33
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
34 #include "exif.h"
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
35
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
36
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
37 /*
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
38 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
39 * Raw (CR2, CRW) embedded jpeg extraction for Canon
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
40 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
41 */
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
42
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
43
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 #if 0
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45 #define CANON_DEBUG
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 #ifdef CANON_DEBUG
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49 int canonEnableDebug = 0;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50 /* This should be really a stack, but I am too lazy to implement */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51 #define DEBUG_ENABLE (canonEnableDebug = 0)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
52 #define DEBUG_DISABLE (canonEnableDebug = 1)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
53 /* It would be nice if these functions indented according to depth in the stack, but I am too lazy to implement */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
54
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
55 #define DEBUG_ENTRY(a) (canonEnableDebug || fprintf(stderr, "Entering function: %s [%s:%d]\n", a, __FILE__, __LINE__))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56 #define DEBUG_EXIT(a) (canonEnableDebug || fprintf(stderr, "Exiting function: %s [%s:%d]\n", a, __FILE__, __LINE__))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57 #define DEBUG_1(a) (canonEnableDebug || fprintf(stderr, a " [%s:%d]\n", __FILE__, __LINE__))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 #define DEBUG_2(a,b) (canonEnableDebug || fprintf(stderr, a " [%s:%d]\n",b, __FILE__, __LINE__))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 #define DEBUG_3(a,b,c) (canonEnableDebug || fprintf(stderr, a " [%s:%d]\n",b, c, __FILE__, __LINE__))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61 #else
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
62 #define DEBUG_ENABLE
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
63 #define DEBUG_DISABLE
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
64 #define DEBUG_ENTRY(a)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
65 #define DEBUG_EXIT(a)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67 #define DEBUG_1(a)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68 #define DEBUG_2(a,b)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69 #define DEBUG_3(a,b,c)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
72
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
73 /* canon_read_int4
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
74
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
75
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
76 The problem with gqview is that sometimes the data is to be read from
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
77 a file, and sometimes it is in memory. This function tries to isolate
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
78 the rest of the code from having to deal with both cases
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
79
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
80 This function reads a 4 byte unsigned integer, and fixes its endianism.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
81
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
82 If fd >= 0 then the value is read from the corresponding file descriptor
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
83
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
84 in that case, if offset is > 0, then the value is read from that offset
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
85
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
86 otherwise it is read from the current file pointer
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
87
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
88 if fd < 0 then the value is read from the memory pointed by data + offset
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
89
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
90
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
91 offset is a pointer to the actual offset of the file.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
92
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
93 sizeInt can be 2 or 4 (it is the number of bytes to read)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
94
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
95 RETURNS true is no error, false if it can't read the value
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
96
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
97
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
98 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
99 static int canon_read_int(unsigned int *offset, const void *data, int sizeInt, unsigned int *value )
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
100 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
101 DEBUG_DISABLE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
102
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
103 DEBUG_ENTRY("canon_read_int");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
104 /* Verify values before we do anything */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
105 if (sizeInt != 2 && sizeInt != 4) return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
106 if (offset == NULL) return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
107 if (*offset <= 0) return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
108 if (data == NULL) return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
109 if (value == NULL) return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
110
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
111 if (sizeInt == 4) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
112 *value = GUINT32_FROM_LE(*(guint32*)(data + *offset));
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
113 *offset +=4;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
114 DEBUG_3("Read 4 bytes %d %x", *value, *value);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
115 } else {
50
3b83fb81afc4 Sat Jun 4 04:02:04 2005 John Ellis <johne@verizon.net>
gqview
parents: 49
diff changeset
116 *value = GUINT16_FROM_LE(*(guint16*)(data + *offset));
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
117 *offset +=2;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
118 DEBUG_3("Read 2 bytes %d %x", *value, *value);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
119 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
120
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
121 DEBUG_EXIT("canon_read_int");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
122
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
123 DEBUG_ENABLE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
124 return TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
125 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
126
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
127 #define CANON_HEADER_SIZE 26
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
128
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
129 /*
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
130
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
131 The CR2 format is really a TIFF format. It is nicely documented in the TIFF V 6.0 document available from adobe.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
132
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
133 The CR2 file contains two thumbnails, one tiny and one decent sized. The record Id of the latter is 0x0111.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
134
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
135 The photo info is also available, in EXIF, and it looks like I don't need to do anything! Yeah!
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
136
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
137 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
138
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
139 static int canon_cr2_process_directory(void *data, int offsetIFD, guint *jpegLocation, guint *exifLocation)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
140 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
141 unsigned int offset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
142 int returnValue = FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
143
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
144 DEBUG_ENTRY("canon_cr2_process_directory");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
145
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
146 /* The directory is a link list, after an array of records, the next 4 byptes point to the offset of the next directory.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
147
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
148 All offsets are absolution within the file (in CRWs the offsets are relative ).
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
149
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
150 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
151
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
152 while (offsetIFD != 0 && offsetIFD != 0xFFFF) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
153 int countEntries=0;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
154 int i;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
155 /* Read directory, we start by reading number of entries in the directory */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
156
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
157 offset = offsetIFD;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
158 if (!canon_read_int(&offset, data, 2, &countEntries)) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
159 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
160 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
161 DEBUG_2("Number of entries: %d\n", countEntries);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
162
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
163 for (i=0;i<countEntries;i++) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
164 /* read each entry */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
165
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
166 int recordId;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
167 #if 0
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
168 int format;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
169 int size;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
170 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
171
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
172 /* read record type */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
173 if (!canon_read_int(&offset, data, 2, &recordId)) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
174 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
175 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
176
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
177 /* Did we find the JPEG */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
178 if (recordId == 0x0111) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
179 DEBUG_1("This is the record to find**********************\n");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
180 offset +=6;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
181 if (!canon_read_int(&offset, data, 4, jpegLocation)) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
182 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
183 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
184 DEBUG_3("JPEG Location %d 0x%x\n", *jpegLocation, *jpegLocation);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
185 /* We don't want to keep reading, because there is another
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
186 0x0111 record at the end that contains the raw data */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
187 returnValue = TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
188 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
189 } else {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
190 /* advance pointer by skipping rest of record */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
191 offset += 10;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
192 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
193 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
194 /* The next 4 bytes are the offset of next directory, if zero we are done
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
195
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
196 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
197 if (!canon_read_int(&offset, data, 4, &offsetIFD)) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
198 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
199 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
200 DEBUG_3("Value of NEXT offsetIFD: %d 0x%x\n", offsetIFD, offsetIFD);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
201 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
202
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
203 returnValue = TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
204 DEBUG_1("Going to return true");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
205
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
206 return_only:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
207 DEBUG_EXIT("canon_cr2_process_directory");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
208
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
209 return TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
210
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
211
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
212 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
213
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
214
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
215 static int format_raw_test_canon_cr2(void *data, const guint len,
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
216 guint *image_offset, guint *exif_offset)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
217 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
218 #if 0
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
219 char signature[4];
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
220 unsigned int offset = 4;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
221 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
222 int offsetIFD;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
223 int returnValue = FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
224 void *jpgInDataOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
225
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
226 DEBUG_ENTRY("format_raw_test_canon_cr2");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
227
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
228 /* Verify signature */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
229 if (memcmp(data, "\x49\x49\x2a\00", 4) != 0) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
230 DEBUG_1("This is not a CR2");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
231 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
232 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
233
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
234 /* Get address of first directory */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
235 offsetIFD = GUINT32_FROM_LE(*(guint32*)(data + 4));
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
236
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
237
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
238 DEBUG_2("Value of offsetIFD: %d\n", offsetIFD);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
239
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
240 returnValue = canon_cr2_process_directory(data, offsetIFD, image_offset, exif_offset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
241
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
242 if (returnValue) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
243 jpgInDataOffset = data + *image_offset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
244
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
245 /* Make sure we really got a JPEG */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
246
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
247 if (memcmp(jpgInDataOffset, "\xff\xd8",2) != 0) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
248 /* It is not at the JPEG! */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
249 DEBUG_2("THis is not a jpeg after all: there are the first 4 bytes 0x%x ", (int)jpgInDataOffset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
250 returnValue = FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
251 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
252 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
253
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
254 return_only:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
255 DEBUG_EXIT("format_raw_test_canon_cr2");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
256
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
257 return returnValue;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
258 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
259
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
260
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
261 gint format_canon_raw(const void *data, const guint len,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
262 guint *image_offset, guint *exif_offset)
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
263 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
264
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
265
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
266 /* There are at least 2 types of Canon raw files. CRW and CR2
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
267
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
268 CRW files have a proprietary format.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
269
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
270 HEADER
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
271 Heap
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
272 RAW data
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
273 JPEG data
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
274 PHoto data
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
275
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
276 HEADER_LENGTH 32 bytes
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
277 int2 byteOrder; Always II (MM Motorola ---big endian, II Intel --little endian)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
278 int4 length; Should be 26
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
279 char identifier[8];type HEAP, subtype heap CCDR
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
280 int2 version;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
281 int2 subversion;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
282 char unused[14];
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
283 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
284
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
285 int returnValue = FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
286 int heapHeaderOffset = 0;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
287 int heapRecordsCount = 0;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
288 #if 0
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
289 guint32 rawInt4;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
290 guint16 rawInt2;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
291 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
292 int i;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
293 unsigned int currentOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
294 /* File has to be little endian, first two bytes II */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
295
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
296 if (len < 100)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
297 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
298
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
299 if (format_raw_test_canon_cr2((void *)data, len, image_offset, exif_offset)) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
300 return TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
301 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
302
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
303 if (memcmp("II", data, 2) != 0) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
304 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
305 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
306 /* NO DEBUG BEFORE THIS POINT, we want to debug only Canon */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
307
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
308 DEBUG_ENTRY("format_raw_test_canon");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
309
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
310 DEBUG_2("Length of buffer read %u", len);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
311
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
312 DEBUG_2("CRW header length Data %d", GUINT32_FROM_LE(*(guint32*)(data + 2)));
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
313
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
314 /* the length has to be CANON_HEADER_SIZE */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
315 if (GUINT32_FROM_LE(*(guint32*)(data + 2)) != CANON_HEADER_SIZE) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
316 DEBUG_1("It is not the right size");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
317 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
318 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
319
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
320 if (!memcmp("HEAPCCDR", data+6, 8) == 0) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
321 DEBUG_1("This file is not a Canon CRW raw photo");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
322 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
323
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
324 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
325
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
326 /* Ok, so now we know that this is a CRW file */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
327
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
328 /* The heap is a strange data structure. It is recursive, so a record
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
329 can contain a heap itself. That is indeed the case for the photo information
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
330 reecord. Luckily the first heap contains the jpeg, so we don't need to do
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
331 any recursive processing.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
332
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
333 Its "header" is a the end. The header is a sequence of records,
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
334 and the data of each record is at the beginning of the heap
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
335
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
336 +-----------------+
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
337 | data raw |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
338 +-----------------+
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
339 | data jpeg |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
340 +-----------------+
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
341 | data photo info |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
342 +-----------------+
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
343 |header of heap |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
344 | # records | it should be 3
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
345 | raw info |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
346 | jpeg info |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
347 | photo info |
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
348 +-----------------+
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
349
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
350 The header contains
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
351 number of records: 2 bytes
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
352 for each record (10 bytes long)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
353 type: 2 bytes
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
354 length: 4 bytes
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
355 offset: 4 bytes
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
356
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
357 In some records the length and offset are actually data,
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
358 but none for the ones in the first heap.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
359
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
360 the offset is with respect to the beginning of the heap, not the
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
361 beginning of the file. That allows heaps to be "movable"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
362
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
363 For the purpose of finding the JPEG, all we need is to scan the fist heap,
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
364 which contains the following record types:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
365
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
366 0x2005 Record RAW data
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
367 0x2007 Record JPEG data
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
368 0x300a Record with photo info
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
369
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
370 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
371
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
372
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
373 if (len < 0x10000) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
374 DEBUG_2("We have a problem, the length is too small %d ", len);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
375 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
376 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
377 currentOffset = len-4;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
378
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
379
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
380 /* The last 4 bytes have the offset of the header of the heap */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
381 if (!canon_read_int(&currentOffset, data, 4, &heapHeaderOffset))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
382 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
383
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
384 /* The heapoffset has to be adjusted to the actual file size, the header is CANON_HEADER_SIZE bytes long */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
385 heapHeaderOffset += CANON_HEADER_SIZE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
386 DEBUG_2("heap header Offset %d ", heapHeaderOffset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
387
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
388 /* Just check, it does not hurt, we don't want to crash */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
389 if (heapHeaderOffset > len)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
390 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
391
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
392 currentOffset = heapHeaderOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
393 /* Let us read the number of records in the heap */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
394 if (!canon_read_int(&currentOffset, data, 2, &heapRecordsCount))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
395 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
396
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
397 DEBUG_2("heap record count %d ", heapRecordsCount);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
398
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
399 if (heapRecordsCount != 3) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
400 /* In all the cameras I have seen, this is always 3
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
401 if not, something is wrong, so just quit */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
402 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
403 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
404
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
405 for (i=0;i<3;i++) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
406 int recordType;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
407 int recordOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
408 int recordLength;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
409 const void *jpgInDataOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
410 /* Read each record, to find jpg, it should be second */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
411
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
412 if (!canon_read_int(&currentOffset, data, 2, &recordType))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
413 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
414
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
415 DEBUG_2("record type 0x%x ", recordType);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
416
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
417 if (recordType != 0x2007) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
418 /* Go to the next record, don't waste time,
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
419 but first, eat 8 bytes from header */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
420 currentOffset += 8;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
421 continue; /* Nah, wrong record, go to next */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
422 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
423 /* Bingo, we are at the JPEG record */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
424
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
425 /* Read length */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
426 if (!canon_read_int(&currentOffset, data, 4, &recordLength))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
427 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
428
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
429 DEBUG_2("record length %d ", recordLength);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
430
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
431 /* Read offset */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
432
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
433 if (!canon_read_int(&currentOffset, data, 4, &recordOffset))
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
434 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
435
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
436 DEBUG_2("record offset 0x%d ", recordOffset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
437
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
438 /* Great, we now know where the JPEG is!
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
439 it is CANON_HEADER_SIZE (size of CRW header) + recordOffset
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
440 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
441
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
442 *image_offset = CANON_HEADER_SIZE + recordOffset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
443 DEBUG_2("image offset %d ", *image_offset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
444
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
445 /* keep checking for potential errors */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
446 if (*image_offset > len) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
447 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
448 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
449 /* Get the JPEG is */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
450
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
451 jpgInDataOffset = data + *image_offset;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
452
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
453 if (memcmp(jpgInDataOffset, "\xff\xd8\xff\xdb",4) != 0) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
454 /* It is not at the JPEG! */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
455 DEBUG_2("THis is not a jpeg after all: there are the first 4 bytes 0x%x ", (int)jpgInDataOffset);
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
456 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
457 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
458 returnValue = TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
459 goto return_only;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
460 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
461 /* undo whatever we need in case of an error*/
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
462 DEBUG_1("We scan all records, but nothing was found!!!!!!!!!!!!!!!!!!");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
463
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
464
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
465 /* At this point we are returning */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
466 return_only:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
467 if (returnValue) {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
468 DEBUG_1("****We got an embedded JPEG for a canon CRW");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
469
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
470 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
471
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
472 DEBUG_EXIT("format_raw_test_canon");
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
473 return returnValue;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
474
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
475 #undef DEBUG_2
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
476 #undef DEBUG
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
477 #undef DEBUG_ENTRY
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
478 #undef DEBUG_EXIT
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
479
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
480 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
481
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
482 /*
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
483 *-----------------------------------------------------------------------------
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
484 * EXIF Makernote for Canon
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
485 *-----------------------------------------------------------------------------
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
486 */
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
487
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
488 static ExifTextList CanonSet1MacroMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
489 { 1, "macro" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
490 { 2, "normal" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
491 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
492 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
493
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
494 static ExifTextList CanonSet1Quality[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
495 { 2, "normal" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
496 { 3, "fine" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
497 { 5, "superfine" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
498 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
499 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
500
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
501 static ExifTextList CanonSet1FlashMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
502 { 0, "flash not fired" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
503 { 1, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
504 { 2, "on" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
505 { 3, "red eye reduction" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
506 { 4, "slow synchro" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
507 { 5, "auto with red eye reduction" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
508 { 6, "on with red eye reduction" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
509 { 16, "external flash" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
510 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
511 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
512
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
513 static ExifTextList CanonSet1DriveMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
514 { 0, "single or timer" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
515 { 1, "continuous" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
516 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
517 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
518
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
519 static ExifTextList CanonSet1FocusMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
520 { 0, "one-shot" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
521 { 1, "AI servo" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
522 { 2, "AI focus" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
523 { 3, "manual" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
524 { 4, "single" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
525 { 5, "continuous" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
526 { 6, "manual" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
527 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
528 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
529
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
530 static ExifTextList CanonSet1ImageSize[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
531 { 0, "large" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
532 { 1, "medium" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
533 { 2, "small" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
534 /* where (or) does Medium 1/2 fit in here ? */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
535 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
536 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
537
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
538 static ExifTextList CanonSet1ShootingMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
539 { 0, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
540 { 1, "manual" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
541 { 2, "landscape" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
542 { 3, "fast shutter" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
543 { 4, "slow shutter" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
544 { 5, "night" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
545 { 6, "black and white" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
546 { 7, "sepia" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
547 { 8, "portrait" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
548 { 9, "sports" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
549 { 10, "macro" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
550 { 11, "panoramic focus" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
551 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
552 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
553
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
554 /* Don't think this is interpreted correctly/completely, A60 at 2.5x Digital sets value of 3 */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
555 static ExifTextList CanonSet1DigitalZoom[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
556 { 0, "none" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
557 { 1, "2x" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
558 { 2, "4x" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
559 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
560 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
561
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
562 static ExifTextList CanonSet1ConSatSharp[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
563 { 0, "normal" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
564 { 1, "high" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
565 { 65535,"low" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
566 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
567 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
568
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
569 static ExifTextList CanonSet1ISOSpeed[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
570 /* { 0, "not set/see EXIF tag" }, */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
571 { 15, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
572 { 16, "50" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
573 { 17, "100" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
574 { 18, "200" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
575 { 19, "400" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
576 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
577 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
578
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
579 static ExifTextList CanonSet1MeteringMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
580 { 3, "evaluative" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
581 { 4, "partial" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
582 { 5, "center-weighted" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
583 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
584 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
585
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
586 static ExifTextList CanonSet1FocusType[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
587 { 0, "manual" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
588 { 1, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
589 { 3, "macro" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
590 { 8, "locked" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
591 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
592 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
593
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
594 static ExifTextList CanonSet1AutoFocusPoint[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
595 { 12288, "manual focus" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
596 { 12289, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
597 { 12290, "right" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
598 { 12291, "center" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
599 { 12292, "left" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
600 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
601 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
602
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
603 static ExifTextList CanonSet1ExposureMode[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
604 { 0, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
605 { 1, "program" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
606 { 2, "Tv priority" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
607 { 3, "Av priority" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
608 { 4, "manual" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
609 { 5, "A-DEP" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
610 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
611 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
612
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
613 static ExifTextList CanonSet1FlashFired[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
614 { 0, "no" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
615 { 1, "yes" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
616 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
617 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
618
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
619 static ExifTextList CanonSet1FocusCont[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
620 { 0, "no (single)" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
621 { 1, "yes" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
622 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
623 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
624
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
625 static ExifMarker CanonSet1[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
626 /* 0 is length of array in bytes (2 x array size) */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
627 { 1, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.MacroMode", "Macro mode", CanonSet1MacroMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
628 { 2, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SelfTimer", "Self timer (10ths of second)", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
629 { 3, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.Quality", "Quality", CanonSet1Quality },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
630 { 4, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashMode", "Flash mode", CanonSet1FlashMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
631 { 5, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.DriveMode", "Drive mode", CanonSet1DriveMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
632 { 7, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocusMode", "Focus mode", CanonSet1FocusMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
633 { 10, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ImageSize", "Image size", CanonSet1ImageSize },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
634 { 11, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ShootingMode","Shooting mode", CanonSet1ShootingMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
635 { 11, EXIF_FORMAT_SHORT_UNSIGNED, 1, "ExposureProgram", "ExposureProgram", CanonSet1ShootingMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
636 { 12, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.DigitalZoom", "Digital zoom", CanonSet1DigitalZoom },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
637 { 13, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.Contrast", "Contrast", CanonSet1ConSatSharp },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
638 { 14, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.Saturation", "Saturation", CanonSet1ConSatSharp },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
639 { 15, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.Sharpness", "Sharpness", CanonSet1ConSatSharp },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
640 { 16, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ISOSpeed", "ISO speed", CanonSet1ISOSpeed },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
641 { 16, EXIF_FORMAT_SHORT_UNSIGNED, 1, "ISOSpeedRatings", "ISO speed", CanonSet1ISOSpeed },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
642 { 17, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.MeteringMode","Metering mode", CanonSet1MeteringMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
643 { 18, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocusType", "Focus type", CanonSet1FocusType },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
644 { 19, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AutoFocus", "AutoFocus point", CanonSet1AutoFocusPoint },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
645 { 20, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ExposureMode","Exposure mode", CanonSet1ExposureMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
646 { 20, EXIF_FORMAT_SHORT_UNSIGNED, 1, "ExposureMode", "Exposure mode", CanonSet1ExposureMode },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
647 { 23, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthLong","Long focal length", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
648 { 24, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthShort","Short focal length", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
649 { 25, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FocalLengthUnits","Focal units per mm", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
650 { 28, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashFired", "Flash fired", CanonSet1FlashFired },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
651 { 29, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashDetails","Flash details", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
652 { 32, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ContinuousFocus","Continuous focus", CanonSet1FocusCont },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
653 EXIF_MARKER_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
654 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
655
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
656 static ExifTextList CanonSet2WhiteBalance[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
657 { 0, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
658 { 1, "sunny" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
659 { 2, "cloudy" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
660 { 3, "tungsten" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
661 { 4, "flourescent" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
662 { 5, "flash" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
663 { 6, "custom" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
664 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
665 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
666
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
667 static ExifTextList CanonSet2FlashBias[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
668 { 0x0000, "0" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
669 { 0x000c, "0.33" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
670 { 0x0010, "0.5" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
671 { 0x0014, "0.67" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
672 { 0x0020, "1" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
673 { 0x002c, "1.33" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
674 { 0x0030, "1.5" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
675 { 0x0034, "1.67" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
676 { 0x0040, "2" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
677 { 0xffc0, "-2" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
678 { 0xffcc, "-1.67" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
679 { 0xffd0, "-1.5" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
680 { 0xffd4, "-1.33" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
681 { 0xffe0, "-1" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
682 { 0xffec, "-0.67" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
683 { 0xfff0, "-0.5" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
684 { 0xfff4, "-0.33" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
685 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
686 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
687
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
688 static ExifMarker CanonSet2[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
689 /* 0 is length of array in bytes (2 x array size) */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
690 { 7, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.WhiteBalance","White balance", CanonSet2WhiteBalance },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
691 { 7, EXIF_FORMAT_SHORT_UNSIGNED, 1, "LightSource", "White balance", CanonSet2WhiteBalance },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
692 { 9, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SequenceNumber","Sequence number", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
693 { 15, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FlashBias", "Flash bias", CanonSet2FlashBias },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
694 /* distance needs more than just this (metric) value */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
695 { 19, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SubjectDistance", "Subject Distance", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
696 EXIF_MARKER_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
697 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
698
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
699 #if 0
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
700
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
701 static ExifTextList CanonCustomEnable[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
702 { 0, "off" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
703 { 1, "on" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
704 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
705 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
706
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
707 static ExifTextList CanonCustomEnableInvert[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
708 { 0, "on" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
709 { 1, "off" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
710 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
711 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
712
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
713 static ExifTextList CanonCustomExposureLevel[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
714 { 0, "1/2 stop" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
715 { 1, "1/3 stop" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
716 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
717 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
718
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
719 static ExifTextList CanonCustomAVShutterSpeed[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
720 { 0, "auto" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
721 { 1, "1/200 (fixed)" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
722 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
723 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
724
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
725 static ExifTextList CanonCustomShutterCurtainSync[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
726 { 0, "1st" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
727 { 1, "2nd" },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
728 EXIF_TEXT_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
729 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
730
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
731 static ExifMarker CanonCustom[] = {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
732 { 1, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.NoiseReduction", "Noise reduction", CanonCustomEnable },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
733 /*{ 2, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncShutter",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
734 "Shutter/Auto exposure button function",CanonCustomBTNShutter }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
735 { 3, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.MirrorLockup", "Mirror lockup", CanonCustomEnable },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
736 { 4, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.TvAvExposureLevel",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
737 "Tv/Av and exposure level", CanonCustomExposureLevel },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
738 { 5, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AFAssistLight", "AF assist light", CanonCustomEnableInvert },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
739 { 6, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AvShutterSpeed",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
740 "Shutter speed in Av mode", CanonCustomAVShutterSpeed },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
741 /*{ 7, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AutoBracket",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
742 "Auto-Exposure bracketting sequence/auto cancellation", CanonCustom }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
743 { 8, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ShutterSync", "Shutter sync", CanonCustomShutterCurtainSync },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
744 /* { 9, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncAF", "AF button function", CanonCustom }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
745 { 10, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FillFlashReduction",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
746 "Fill flash auto reduction", CanonCustomEnableInvert },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
747 /*{ 11, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncMenu",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
748 "Menu button function", CanonCustom }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
749 /*{ 12, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncSet", "Set button function", CanonCustom }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
750 { 13, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SensorCleaning", "Sensor cleaning", CanonCustomEnable },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
751 EXIF_MARKER_LIST_END
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
752 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
753
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
754 #endif
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
755
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
756 static ExifMarker CanonExifMarkersList[] = {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
757 { 1, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings1", NULL, NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
758 { 4, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2", NULL, NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
759 { 6, EXIF_FORMAT_STRING, -1, "MkN.Canon.ImageType", "Image type", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
760 { 7, EXIF_FORMAT_STRING, -1, "MkN.Canon.FirmwareVersion", "Firmware version", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
761 { 8, EXIF_FORMAT_LONG_UNSIGNED, 1, "MkN.Canon.ImageNumber", "Image number", NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
762 { 9, EXIF_FORMAT_STRING, -1, "MkN.Canon.OwnerName", "Owner name", NULL },
48
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
763 { 12, EXIF_FORMAT_LONG_UNSIGNED, -1, "MkN.Canon.SerialNumber", "Camera serial number", NULL },
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
764 { 15, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.CustomFunctions", NULL, NULL },
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
765 EXIF_MARKER_LIST_END
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
766 };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
767
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
768 static void canon_mknote_parse_settings(ExifData *exif,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
769 guint16 *data, guint32 len, ExifByteOrder byte_order,
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
770 ExifMarker *list)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
771 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
772 gint i;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
773
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
774 i = 0;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
775 while (list[i].tag != 0)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
776 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
777 if (list[i].tag < len)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
778 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
779 ExifItem *item;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
780
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
781 item = exif_item_new(EXIF_FORMAT_SHORT_UNSIGNED, list[i].tag, 1, &list[i]);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
782 exif_item_copy_data(item, &data[list[i].tag], 1, EXIF_FORMAT_SHORT_UNSIGNED, byte_order);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
783 exif->items = g_list_prepend(exif->items, item);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
784 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
785
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
786 i++;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
787 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
788 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
789
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
790 #if 0
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
791 static void canon_mknote_parse_convert(ExifData *exif)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
792 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
793 gint value;
48
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
794 ExifItem *result;
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
795
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
796 /* seems we need more than only this value for distance */
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
797 if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value))
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
798 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
799 static ExifMarker marker= { 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
800 "SubjectDistance", "Subject distance", NULL };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
801 ExifItem *item;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
802 ExifRational *rational;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
803
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
804 item = exif_item_new(marker.format, marker.tag, 1, &marker);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
805 rational = item->data;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
806 rational->num = value;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
807 rational->den = 100;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
808
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
809 exif->items = g_list_prepend(exif->items, item);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
810 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
811
48
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
812 result = exif_get_item(exif, "MkN.Canon.SerialNumber");
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
813 if (result && result->format == EXIF_FORMAT_LONG_UNSIGNED && result->data_len == 4)
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
814 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
815 static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1,
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
816 "SerialNumber", "Camera serial number", NULL };
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
817 ExifItem *item;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
818 gchar *text;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
819 gint l;
48
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
820 guint32 n;
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
821
49
ae627d150a6b Fri Jun 3 20:02:23 2005 John Ellis <johne@verizon.net>
gqview
parents: 48
diff changeset
822 n = (guint32)((guint32 *)(result->data))[0];
48
6948407f52a5 Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
823 text = g_strdup_printf("%04X%05d", n & 0xffff0000 >> 8, n & 0x0000ffff);
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
824 l = strlen(text);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
825 item = exif_item_new(marker.format, marker.tag, l, &marker);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
826 memcpy(item->data, text, l);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
827 g_free(text);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
828
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
829 exif->items = g_list_prepend(exif->items, item);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
830 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
831 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
832 #endif
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
833
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
834 gint format_canon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
835 guint size, ExifByteOrder byte_order)
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
836 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
837 ExifItem *item;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
838
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 50
diff changeset
839 if (exif_parse_IFD_table(exif, tiff, offset, size, byte_order, CanonExifMarkersList) != 0)
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
840 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
841 return FALSE;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
842 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
843
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
844 item = exif_get_item(exif, "MkN.Canon.Settings1");
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
845 if (item)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
846 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
847 canon_mknote_parse_settings(exif, item->data, item->data_len, byte_order, CanonSet1);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
848 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
849
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
850 item = exif_get_item(exif, "MkN.Canon.Settings2");
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
851 if (item)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
852 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
853 canon_mknote_parse_settings(exif, item->data, item->data_len, byte_order, CanonSet2);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
854 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
855
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
856 #if 0
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
857 canon_mknote_parse_convert(exif);
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
858 #endif
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
859
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
860 return TRUE;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
861 }
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
862
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
863