Mercurial > geeqie
annotate src/exif.h @ 902:c414002a1f27
Move history_list_*() functions to separate files:
history_list.c and history_list.h.
author | zas_ |
---|---|
date | Sun, 20 Jul 2008 14:56:32 +0000 |
parents | efed9a1520d6 |
children | 4fe8f9656107 |
rev | line source |
---|---|
9 | 1 /* |
541 | 2 * Geeqie |
3 * (C) 2006 John Ellis | |
475 | 4 * Copyright (C) 2008 The Geeqie Team |
9 | 5 * |
6 * Authors: | |
442 | 7 * Support for Exif file format, originally written by Eric Swalens. |
9 | 8 * Modified by Quy Tonthat |
9 * Reimplemented with generic data storage by John Ellis | |
10 * | |
11 | |
12 This program is free software; you can redistribute it and/or modify | |
13 it under the terms of the GNU General Public License as published by | |
14 the Free Software Foundation; either version 2 of the License, or | |
15 (at your option) any later version. | |
16 | |
17 This program is distributed in the hope that it will be useful, | |
18 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 GNU General Public License for more details. | |
21 | |
22 You should have received a copy of the GNU General Public License | |
23 along with this program; if not, write to the Free Software | |
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 */ | |
26 | |
27 #ifndef __EXIF_H | |
28 #define __EXIF_H | |
29 | |
30 | |
31 /* | |
32 *----------------------------------------------------------------------------- | |
33 * Tag formats | |
34 *----------------------------------------------------------------------------- | |
35 */ | |
36 | |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
37 #define EXIF_FORMAT_COUNT 13 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
38 |
9 | 39 typedef enum { |
40 EXIF_FORMAT_UNKNOWN = 0, | |
41 EXIF_FORMAT_BYTE_UNSIGNED = 1, | |
42 EXIF_FORMAT_STRING = 2, | |
43 EXIF_FORMAT_SHORT_UNSIGNED = 3, | |
44 EXIF_FORMAT_LONG_UNSIGNED = 4, | |
45 EXIF_FORMAT_RATIONAL_UNSIGNED = 5, | |
46 EXIF_FORMAT_BYTE = 6, | |
47 EXIF_FORMAT_UNDEFINED = 7, | |
48 EXIF_FORMAT_SHORT = 8, | |
49 EXIF_FORMAT_LONG = 9, | |
50 EXIF_FORMAT_RATIONAL = 10, | |
51 EXIF_FORMAT_FLOAT = 11, | |
52 EXIF_FORMAT_DOUBLE = 12 | |
53 } ExifFormatType; | |
54 | |
178
9dc8bc9b2bb9
first exiv2 support that does not crash immediately
nadvornik
parents:
177
diff
changeset
|
55 |
9 | 56 /* |
57 *----------------------------------------------------------------------------- | |
58 * Data storage | |
59 *----------------------------------------------------------------------------- | |
60 */ | |
61 | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
62 typedef struct _ExifItem ExifItem; |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
63 |
9 | 64 typedef struct _ExifRational ExifRational; |
65 struct _ExifRational | |
66 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
67 guint32 num; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
68 guint32 den; |
9 | 69 }; |
70 | |
71 | |
72 /* enums useful for image manipulation */ | |
73 | |
74 typedef enum { | |
75 EXIF_ORIENTATION_UNKNOWN = 0, | |
76 EXIF_ORIENTATION_TOP_LEFT = 1, | |
77 EXIF_ORIENTATION_TOP_RIGHT = 2, | |
78 EXIF_ORIENTATION_BOTTOM_RIGHT = 3, | |
79 EXIF_ORIENTATION_BOTTOM_LEFT = 4, | |
80 EXIF_ORIENTATION_LEFT_TOP = 5, | |
81 EXIF_ORIENTATION_RIGHT_TOP = 6, | |
82 EXIF_ORIENTATION_RIGHT_BOTTOM = 7, | |
83 EXIF_ORIENTATION_LEFT_BOTTOM = 8 | |
84 } ExifOrientationType; | |
85 | |
86 typedef enum { | |
87 EXIF_UNIT_UNKNOWN = 0, | |
88 EXIF_UNIT_NOUNIT = 1, | |
89 EXIF_UNIT_INCH = 2, | |
90 EXIF_UNIT_CENTIMETER = 3 | |
91 } ExifUnitType; | |
92 | |
93 | |
548
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
94 typedef struct _ExifFormattedText ExifFormattedText; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
95 struct _ExifFormattedText |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
96 { |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
97 const gchar *key; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
98 const gchar *description; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
99 gchar *(*build_func)(ExifData *exif); |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
100 }; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
101 |
9 | 102 /* |
103 *----------------------------------------------------------------------------- | |
104 * functions | |
105 *----------------------------------------------------------------------------- | |
106 */ | |
107 | |
449 | 108 ExifData *exif_read(gchar *path, gchar *sidecar_path); |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
109 |
449 | 110 ExifData *exif_read_fd(FileData *fd); |
844 | 111 void exif_free_fd(FileData *fd, ExifData *exif); |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
112 |
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
113 |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
114 int exif_write(ExifData *exif); |
9 | 115 void exif_free(ExifData *exif); |
116 | |
117 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key); | |
118 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value); | |
119 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign); | |
120 | |
121 ExifItem *exif_get_item(ExifData *exif, const gchar *key); | |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
122 ExifItem *exif_add_item(ExifData *exif, const gchar *key); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
123 ExifItem *exif_get_first_item(ExifData *exif); |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
124 ExifItem *exif_get_next_item(ExifData *exif); |
9 | 125 |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
126 |
185 | 127 char *exif_item_get_tag_name(ExifItem *item); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
128 guint exif_item_get_tag_id(ExifItem *item); |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
129 guint exif_item_get_elements(ExifItem *item); |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
130 char *exif_item_get_data(ExifItem *item, guint *data_len); |
182 | 131 char *exif_item_get_description(ExifItem *item); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
132 guint exif_item_get_format_id(ExifItem *item); |
9 | 133 const char *exif_item_get_format_name(ExifItem *item, gint brief); |
134 gchar *exif_item_get_data_as_text(ExifItem *item); | |
135 gint exif_item_get_integer(ExifItem *item, gint *value); | |
136 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign); | |
137 | |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
138 gchar *exif_item_get_string(ExifItem *item, int idx); |
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
139 |
9 | 140 const gchar *exif_get_description_by_key(const gchar *key); |
182 | 141 const gchar *exif_get_tag_description_by_key(const gchar *key); |
142 | |
143 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid); | |
9 | 144 |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
145 int exif_item_delete(ExifData *exif, ExifItem *item); |
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
146 int exif_item_set_string(ExifItem *item, const char *str); |
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
147 |
449 | 148 unsigned char *exif_get_color_profile(ExifData *exif, guint *data_len); |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
149 |
449 | 150 /* jpeg embedded icc support */ |
151 | |
152 void exif_add_jpeg_color_profile(ExifData *exif, unsigned char *cp_data, guint cp_length); | |
153 | |
154 | |
155 gint exif_jpeg_segment_find(unsigned char *data, guint size, | |
156 guchar app_marker, const gchar *magic, guint magic_len, | |
157 guint *seg_offset, guint *seg_length); | |
158 gint exif_jpeg_parse_color(ExifData *exif, unsigned char *data, guint size); | |
159 | |
160 /*raw support */ | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
161 gint format_raw_img_exif_offsets_fd(int fd, const gchar *path, |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
162 unsigned char *header_data, const guint header_len, |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
163 guint *image_offset, guint *exif_offset); |
57
a8c9992320f4
Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents:
54
diff
changeset
|
164 |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
165 |
449 | 166 |
9 | 167 #endif |