Mercurial > geeqie.yaz
annotate src/exif.h @ 1594:3fbec0e63e6b
updated version string to beta1
author | nadvornik |
---|---|
date | Thu, 07 May 2009 19:38:07 +0000 |
parents | 7cb24fdf07c0 |
children |
rev | line source |
---|---|
9 | 1 /* |
541 | 2 * Geeqie |
3 * (C) 2006 John Ellis | |
1284 | 4 * Copyright (C) 2008 - 2009 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 | |
1189 | 30 #define EXIF_FORMATTED(x) "formatted."x |
31 #define EXIF_FORMATTED_LEN (sizeof(EXIF_FORMATTED()) - 1) | |
9 | 32 |
33 /* | |
34 *----------------------------------------------------------------------------- | |
35 * Tag formats | |
36 *----------------------------------------------------------------------------- | |
37 */ | |
38 | |
54
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
39 #define EXIF_FORMAT_COUNT 13 |
b58cac75ad12
Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents:
51
diff
changeset
|
40 |
9 | 41 typedef enum { |
42 EXIF_FORMAT_UNKNOWN = 0, | |
43 EXIF_FORMAT_BYTE_UNSIGNED = 1, | |
44 EXIF_FORMAT_STRING = 2, | |
45 EXIF_FORMAT_SHORT_UNSIGNED = 3, | |
46 EXIF_FORMAT_LONG_UNSIGNED = 4, | |
47 EXIF_FORMAT_RATIONAL_UNSIGNED = 5, | |
48 EXIF_FORMAT_BYTE = 6, | |
49 EXIF_FORMAT_UNDEFINED = 7, | |
50 EXIF_FORMAT_SHORT = 8, | |
51 EXIF_FORMAT_LONG = 9, | |
52 EXIF_FORMAT_RATIONAL = 10, | |
53 EXIF_FORMAT_FLOAT = 11, | |
54 EXIF_FORMAT_DOUBLE = 12 | |
55 } ExifFormatType; | |
56 | |
178
9dc8bc9b2bb9
first exiv2 support that does not crash immediately
nadvornik
parents:
177
diff
changeset
|
57 |
9 | 58 /* |
59 *----------------------------------------------------------------------------- | |
60 * Data storage | |
61 *----------------------------------------------------------------------------- | |
62 */ | |
63 | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
64 typedef struct _ExifItem ExifItem; |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
65 |
9 | 66 typedef struct _ExifRational ExifRational; |
67 struct _ExifRational | |
68 { | |
51
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
69 guint32 num; |
276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
47
diff
changeset
|
70 guint32 den; |
9 | 71 }; |
72 | |
73 | |
74 /* enums useful for image manipulation */ | |
75 | |
76 typedef enum { | |
77 EXIF_ORIENTATION_UNKNOWN = 0, | |
78 EXIF_ORIENTATION_TOP_LEFT = 1, | |
79 EXIF_ORIENTATION_TOP_RIGHT = 2, | |
80 EXIF_ORIENTATION_BOTTOM_RIGHT = 3, | |
81 EXIF_ORIENTATION_BOTTOM_LEFT = 4, | |
82 EXIF_ORIENTATION_LEFT_TOP = 5, | |
83 EXIF_ORIENTATION_RIGHT_TOP = 6, | |
84 EXIF_ORIENTATION_RIGHT_BOTTOM = 7, | |
85 EXIF_ORIENTATION_LEFT_BOTTOM = 8 | |
86 } ExifOrientationType; | |
87 | |
88 typedef enum { | |
89 EXIF_UNIT_UNKNOWN = 0, | |
90 EXIF_UNIT_NOUNIT = 1, | |
91 EXIF_UNIT_INCH = 2, | |
92 EXIF_UNIT_CENTIMETER = 3 | |
93 } ExifUnitType; | |
94 | |
548
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
95 typedef struct _ExifFormattedText ExifFormattedText; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
96 struct _ExifFormattedText |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
97 { |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
98 const gchar *key; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
99 const gchar *description; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
100 gchar *(*build_func)(ExifData *exif); |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
101 }; |
7ada6e5d4de8
Add a pointer to the build function in the formatted exif tags struct
zas_
parents:
541
diff
changeset
|
102 |
9 | 103 /* |
104 *----------------------------------------------------------------------------- | |
105 * functions | |
106 *----------------------------------------------------------------------------- | |
107 */ | |
108 | |
1288 | 109 void exif_init(void); |
110 | |
1203
43bfcbb62cd6
prepared infrastructure for delayed metadata writting - refreshing
nadvornik
parents:
1189
diff
changeset
|
111 ExifData *exif_read(gchar *path, gchar *sidecar_path, GHashTable *modified_xmp); |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
112 |
449 | 113 ExifData *exif_read_fd(FileData *fd); |
844 | 114 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
|
115 |
1069 | 116 /* exif_read returns processed data (merged from image and sidecar, etc.) |
117 this function gives access to the original data from the image. | |
118 original data are part of the processed data and should not be freed separately */ | |
119 ExifData *exif_get_original(ExifData *processed); | |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
120 |
1211 | 121 |
122 gboolean exif_write(ExifData *exif); | |
123 gboolean exif_write_sidecar(ExifData *exif, gchar *path); | |
124 | |
9 | 125 void exif_free(ExifData *exif); |
126 | |
127 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key); | |
128 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value); | |
129 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign); | |
130 | |
131 ExifItem *exif_get_item(ExifData *exif, const gchar *key); | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
132 ExifItem *exif_get_first_item(ExifData *exif); |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
133 ExifItem *exif_get_next_item(ExifData *exif); |
9 | 134 |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
135 |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
136 gchar *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
|
137 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
|
138 guint exif_item_get_elements(ExifItem *item); |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
139 gchar *exif_item_get_data(ExifItem *item, guint *data_len); |
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
140 gchar *exif_item_get_description(ExifItem *item); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
141 guint exif_item_get_format_id(ExifItem *item); |
1422 | 142 const gchar *exif_item_get_format_name(ExifItem *item, gboolean brief); |
9 | 143 gchar *exif_item_get_data_as_text(ExifItem *item); |
144 gint exif_item_get_integer(ExifItem *item, gint *value); | |
1058
b600689a677e
Fix up few signed vs unsigned warnings: exif_item_get_rational() last parameter is now of guint type.
zas_
parents:
1055
diff
changeset
|
145 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n); |
9 | 146 |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
147 gchar *exif_item_get_string(ExifItem *item, gint idx); |
188
0584cb78aa14
write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents:
187
diff
changeset
|
148 |
1053
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
149 gchar *exif_get_description_by_key(const gchar *key); |
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
150 gchar *exif_get_tag_description_by_key(const gchar *key); |
182 | 151 |
1422 | 152 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gboolean *key_valid); |
9 | 153 |
1203
43bfcbb62cd6
prepared infrastructure for delayed metadata writting - refreshing
nadvornik
parents:
1189
diff
changeset
|
154 gint exif_update_metadata(ExifData *exif, const gchar *key, const GList *values); |
1288 | 155 GList *exif_get_metadata(ExifData *exif, const gchar *key, MetadataFormat format); |
187
9eafc4957f1a
write support in Exiv2 wrapper; for now only string values
nadvornik
parents:
185
diff
changeset
|
156 |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
157 guchar *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
|
158 |
449 | 159 /* jpeg embedded icc support */ |
160 | |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
844
diff
changeset
|
161 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length); |
449 | 162 |
163 | |
1422 | 164 gboolean exif_jpeg_segment_find(guchar *data, guint size, |
165 guchar app_marker, const gchar *magic, guint magic_len, | |
166 guint *seg_offset, guint *seg_length); | |
167 gboolean exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size); | |
449 | 168 |
169 /*raw support */ | |
1060 | 170 guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width, gint requested_height); |
1008 | 171 void exif_free_preview(guchar *buf); |
47
aa4c0e1b54b0
Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
172 |
1483
7cb24fdf07c0
re-added possibility to display basic file info (size, mode, date)
nadvornik
parents:
1422
diff
changeset
|
173 gchar *metadata_file_info(FileData *fd, const gchar *key, MetadataFormat format); |
449 | 174 |
9 | 175 #endif |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1053
diff
changeset
|
176 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |