annotate src/exif.h @ 1160:2562e0bc89a1

Mark keyboard keys with a span and make them look like a key through css style.
author zas_
date Wed, 19 Nov 2008 22:42:20 +0000
parents aeae25d5d50d
children 9e424170e958
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
541
116346636d42 Replace GQView by Geeqie.
zas_
parents: 475
diff changeset
2 * Geeqie
116346636d42 Replace GQView by Geeqie.
zas_
parents: 475
diff changeset
3 * (C) 2006 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 449
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Authors:
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 188
diff changeset
7 * Support for Exif file format, originally written by Eric Swalens.
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Modified by Quy Tonthat
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Reimplemented with generic data storage by John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 This program is free software; you can redistribute it and/or modify
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 it under the terms of the GNU General Public License as published by
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 the Free Software Foundation; either version 2 of the License, or
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 (at your option) any later version.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 This program is distributed in the hope that it will be useful,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 GNU General Public License for more details.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 You should have received a copy of the GNU General Public License
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 along with this program; if not, write to the Free Software
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #ifndef __EXIF_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #define __EXIF_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 * Tag formats
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 EXIF_FORMAT_UNKNOWN = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 EXIF_FORMAT_BYTE_UNSIGNED = 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 EXIF_FORMAT_STRING = 2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 EXIF_FORMAT_SHORT_UNSIGNED = 3,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 EXIF_FORMAT_LONG_UNSIGNED = 4,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 EXIF_FORMAT_RATIONAL_UNSIGNED = 5,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 EXIF_FORMAT_BYTE = 6,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 EXIF_FORMAT_UNDEFINED = 7,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 EXIF_FORMAT_SHORT = 8,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 EXIF_FORMAT_LONG = 9,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 EXIF_FORMAT_RATIONAL = 10,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 EXIF_FORMAT_FLOAT = 11,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 EXIF_FORMAT_DOUBLE = 12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 } ExifFormatType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54
178
9dc8bc9b2bb9 first exiv2 support that does not crash immediately
nadvornik
parents: 177
diff changeset
55
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 * Data storage
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 typedef struct _ExifRational ExifRational;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 struct _ExifRational
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 /* enums useful for image manipulation */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 EXIF_ORIENTATION_UNKNOWN = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 EXIF_ORIENTATION_TOP_LEFT = 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 EXIF_ORIENTATION_TOP_RIGHT = 2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 EXIF_ORIENTATION_BOTTOM_RIGHT = 3,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 EXIF_ORIENTATION_BOTTOM_LEFT = 4,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 EXIF_ORIENTATION_LEFT_TOP = 5,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 EXIF_ORIENTATION_RIGHT_TOP = 6,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 EXIF_ORIENTATION_RIGHT_BOTTOM = 7,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 EXIF_ORIENTATION_LEFT_BOTTOM = 8
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 } ExifOrientationType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 EXIF_UNIT_UNKNOWN = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 EXIF_UNIT_NOUNIT = 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 EXIF_UNIT_INCH = 2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 EXIF_UNIT_CENTIMETER = 3
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 } ExifUnitType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 * functions
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
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
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
110 ExifData *exif_read_fd(FileData *fd);
844
efed9a1520d6 implemented generic FileData cache
nadvornik
parents: 552
diff changeset
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
1069
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
113 /* exif_read returns processed data (merged from image and sidecar, etc.)
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
114 this function gives access to the original data from the image.
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
115 original data are part of the processed data and should not be freed separately */
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
116 ExifData *exif_get_original(ExifData *processed);
188
0584cb78aa14 write comment and keywords to xmp, sidecars are used if exist
nadvornik
parents: 187
diff changeset
117
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
118 gint exif_write(ExifData *exif);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 void exif_free(ExifData *exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 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
126 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
127 ExifItem *exif_get_first_item(ExifData *exif);
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
128 ExifItem *exif_get_next_item(ExifData *exif);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
130
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
131 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
132 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
133 guint exif_item_get_elements(ExifItem *item);
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
134 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
135 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
136 guint exif_item_get_format_id(ExifItem *item);
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
137 const gchar *exif_item_get_format_name(ExifItem *item, gint brief);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 gchar *exif_item_get_data_as_text(ExifItem *item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 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
140 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
142 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
143
1053
77ca9a5d42be fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents: 1052
diff changeset
144 gchar *exif_get_description_by_key(const gchar *key);
77ca9a5d42be fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents: 1052
diff changeset
145 gchar *exif_get_tag_description_by_key(const gchar *key);
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 178
diff changeset
146
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 178
diff changeset
147 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
149 gint exif_item_delete(ExifData *exif, ExifItem *item);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
150 gint exif_item_set_string(ExifItem *item, const gchar *str);
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
151
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
152 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
153
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
154 /* jpeg embedded icc support */
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
155
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
156 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length);
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
157
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
158
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
159 gint exif_jpeg_segment_find(guchar *data, guint size,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
160 guchar app_marker, const gchar *magic, guint magic_len,
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
161 guint *seg_offset, guint *seg_length);
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 844
diff changeset
162 gint exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size);
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
163
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
164 /*raw support */
1060
1e2de04c6fc4 added option to use exif thumbnails
nadvornik
parents: 1058
diff changeset
165 guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width, gint requested_height);
1008
68b0cb6ca8f0 use mmaped files image loader
nadvornik
parents: 1000
diff changeset
166 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
167
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 446
diff changeset
168
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 #endif
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1053
diff changeset
170 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */