Mercurial > geeqie.yaz
comparison src/exif-int.h @ 176:695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
author | nadvornik |
---|---|
date | Wed, 13 Feb 2008 13:57:31 +0000 |
parents | |
children | 9dc8bc9b2bb9 |
comparison
equal
deleted
inserted
replaced
175:682705e0c0e0 | 176:695e1ad3b169 |
---|---|
1 /* | |
2 * GQView | |
3 * (C) 2006 John Ellis | |
4 * | |
5 * Authors: | |
6 * Support for Exif file format, originally written by Eric Swalens. | |
7 * Modified by Quy Tonthat | |
8 * Reimplemented with generic data storage by John Ellis | |
9 * | |
10 | |
11 This program is free software; you can redistribute it and/or modify | |
12 it under the terms of the GNU General Public License as published by | |
13 the Free Software Foundation; either version 2 of the License, or | |
14 (at your option) any later version. | |
15 | |
16 This program is distributed in the hope that it will be useful, | |
17 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 GNU General Public License for more details. | |
20 | |
21 You should have received a copy of the GNU General Public License | |
22 along with this program; if not, write to the Free Software | |
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 */ | |
25 | |
26 #ifndef __EXIF_INT_H | |
27 #define __EXIF_INT_H | |
28 | |
29 #include "exif.h" | |
30 | |
31 /* | |
32 *----------------------------------------------------------------------------- | |
33 * Tag formats | |
34 *----------------------------------------------------------------------------- | |
35 */ | |
36 | |
37 typedef enum { | |
38 EXIF_BYTE_ORDER_INTEL, | |
39 EXIF_BYTE_ORDER_MOTOROLA | |
40 } ExifByteOrder; | |
41 | |
42 typedef struct _ExifFormatAttrib ExifFormatAttrib; | |
43 struct _ExifFormatAttrib | |
44 { | |
45 ExifFormatType type; | |
46 guint size; | |
47 const gchar *short_name; | |
48 const gchar *description; | |
49 }; | |
50 | |
51 /* the list of known tag data formats */ | |
52 extern ExifFormatAttrib ExifFormatList[]; | |
53 | |
54 | |
55 /* | |
56 *----------------------------------------------------------------------------- | |
57 * Data storage | |
58 *----------------------------------------------------------------------------- | |
59 */ | |
60 | |
61 typedef struct _ExifMarker ExifMarker; | |
62 typedef struct _ExifTextList ExifTextList; | |
63 | |
64 struct _ExifData | |
65 { | |
66 GList *items; /* list of (ExifItem *) */ | |
67 GList *current; /* for exif_get_next_item */ | |
68 }; | |
69 | |
70 | |
71 struct _ExifItem | |
72 { | |
73 ExifFormatType format; | |
74 guint tag; | |
75 const ExifMarker *marker; | |
76 guint elements; | |
77 gpointer data; | |
78 guint data_len; | |
79 }; | |
80 | |
81 struct _ExifMarker | |
82 { | |
83 guint tag; | |
84 ExifFormatType format; | |
85 gint components; | |
86 gchar *key; | |
87 gchar *description; | |
88 ExifTextList *list; | |
89 }; | |
90 | |
91 #define EXIF_MARKER_LIST_END { 0x0000, EXIF_FORMAT_UNKNOWN, 0, NULL, NULL, NULL } | |
92 | |
93 struct _ExifTextList | |
94 { | |
95 gint value; | |
96 const gchar* description; | |
97 }; | |
98 | |
99 #define EXIF_TEXT_LIST_END { -1, NULL } | |
100 | |
101 | |
102 typedef struct _ExifFormattedText ExifFormattedText; | |
103 struct _ExifFormattedText | |
104 { | |
105 const gchar *key; | |
106 const gchar *description; | |
107 }; | |
108 | |
109 | |
110 /* | |
111 *----------------------------------------------------------------------------- | |
112 * Data | |
113 *----------------------------------------------------------------------------- | |
114 */ | |
115 | |
116 | |
117 | |
118 /* the known exif tags list */ | |
119 extern ExifMarker ExifKnownMarkersList[]; | |
120 | |
121 /* the unknown tags utilize this generic list */ | |
122 extern ExifMarker ExifUnknownMarkersList[]; | |
123 | |
124 /* the list of specially formatted keys, for human readable output */ | |
125 extern ExifFormattedText ExifFormattedList[]; | |
126 | |
127 | |
128 /* | |
129 *----------------------------------------------------------------------------- | |
130 * functions | |
131 *----------------------------------------------------------------------------- | |
132 */ | |
133 | |
134 | |
135 /* usually for debugging to stdout */ | |
136 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list); | |
137 | |
138 | |
139 | |
140 /* These funcs for use by makernote/tiff parsers only */ | |
141 | |
142 #define EXIF_TIFF_MAX_LEVELS 4 | |
143 | |
144 #define EXIF_TIFD_OFFSET_TAG 0 | |
145 #define EXIF_TIFD_OFFSET_FORMAT 2 | |
146 #define EXIF_TIFD_OFFSET_COUNT 4 | |
147 #define EXIF_TIFD_OFFSET_DATA 8 | |
148 #define EXIF_TIFD_SIZE 12 | |
149 | |
150 | |
151 guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo); | |
152 guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo); | |
153 void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo); | |
154 void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo); | |
155 | |
156 ExifItem *exif_item_new(ExifFormatType format, guint tag, | |
157 guint elements, const ExifMarker *marker); | |
158 void exif_item_copy_data(ExifItem *item, void *src, guint len, | |
159 ExifFormatType src_format, ExifByteOrder bo); | |
160 | |
161 gint exif_parse_IFD_table(ExifData *exif, | |
162 unsigned char *tiff, guint offset, | |
163 guint size, ExifByteOrder bo, | |
164 gint level, | |
165 const ExifMarker *list); | |
166 | |
167 gint exif_tiff_directory_offset(unsigned char *data, const guint len, | |
168 guint *offset, ExifByteOrder *bo); | |
169 gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list); | |
170 | |
171 gchar *exif_text_list_find_value(ExifTextList *list, guint value); | |
172 | |
173 | |
174 #endif | |
175 |