annotate src/exif.c @ 603:e8b28413ffbf

Replace deprecated functions by their counterparts: g_strcasecmp() -> g_ascii_strcasecmp() g_strncasecmp() -> g_ascii_strncasecmp() gtk_input_remove() -> g_source_remove() g_io_channel_close() -> g_io_channel_shutdown() + g_io_channel_unref() All these are deprecated either since 2.2 or 2.4.
author zas_
date Wed, 07 May 2008 23:27:26 +0000
parents 116346636d42
children fbebf5cf4a55
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: 414
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 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * Reimplemented with generic data storage by John Ellis (Nov 2003)
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 * The tags were added with information from the FREE document:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 * http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 * For the official Exif Format, please refer to:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 * http://www.exif.org
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 * http://www.exif.org/specifications.html (PDF spec sheets)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 * Notes:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 * Additional tag formats should be added to the proper
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 * location in ExifKnownMarkersList[].
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 * Human readable ouput (that needs additional processing of data to
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 * be useable) can be defined by adding a key to ExifFormattedList[],
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 * then handling that tag in the function exif_get_formatted_by_key().
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 * The human readable formatted keys must begin with the character 'f'.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 * Unsupported at this time:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 * IFD1 (thumbnail)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 * MakerNote
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 * GPSInfo
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 * TODO:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 * Convert data to useable form in the ??_as_text function for:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 * ComponentsConfiguration
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 * UserComment (convert this to UTF-8?)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 This program is free software; you can redistribute it and/or modify
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 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
41 the Free Software Foundation; either version 2 of the License, or
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 (at your option) any later version.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 This program is distributed in the hope that it will be useful,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 but WITHOUT ANY WARRANTY; without even the implied warranty of
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 GNU General Public License for more details.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 You should have received a copy of the GNU General Public License
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 along with this program; if not, write to the Free Software
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 #ifdef HAVE_CONFIG_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 # include "config.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
58 #ifndef HAVE_EXIV2
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
59
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 #include <stdio.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 #include <string.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 #include <fcntl.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 #include <unistd.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 #include <sys/types.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 #include <sys/stat.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 #include <sys/mman.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 #include <math.h>
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
68
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 #include <glib.h>
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 #include "intl.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 262
diff changeset
73 #include "main.h"
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
74 #include "exif-int.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
76 #include "format_raw.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 * Tag formats
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 */
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 ExifFormatAttrib ExifFormatList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 { EXIF_FORMAT_UNKNOWN, 1, "unknown", "unknown" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 { EXIF_FORMAT_BYTE_UNSIGNED, 1, "ubyte", "unsigned byte" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 { EXIF_FORMAT_STRING, 1, "string", "string" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 { EXIF_FORMAT_SHORT_UNSIGNED, 2, "ushort", "unsigned short" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 { EXIF_FORMAT_LONG_UNSIGNED, 4, "ulong", "unsigned long" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 { EXIF_FORMAT_RATIONAL_UNSIGNED,8, "urational", "unsigned rational" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 { EXIF_FORMAT_BYTE, 1, "byte", "byte" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 { EXIF_FORMAT_UNDEFINED, 1, "undefined", "undefined" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 { EXIF_FORMAT_SHORT, 2, "sshort", "signed short" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 { EXIF_FORMAT_LONG, 4, "slong", "signed long" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 { EXIF_FORMAT_RATIONAL, 8, "srational", "signed rational" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 { EXIF_FORMAT_FLOAT, 4, "float", "float" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 { EXIF_FORMAT_DOUBLE, 8, "double", "double" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 { -1, 0, NULL }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 };
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 /* tags that are special, or need special treatment */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 #define TAG_EXIFOFFSET 0x8769
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
105 #define TAG_EXIFMAKERNOTE 0x927c
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 * Data
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
113 static ExifTextList ExifCompressionList[] = {
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
114 { 1, "Uncompressed" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
115 { 2, "CCITT 1D" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
116 { 3, "T4/Group 3 Fax" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
117 { 4, "T6/Group 4 Fax" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
118 { 5, "LZW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
119 { 6, "JPEG (old style)" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
120 { 7, "JPEG" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
121 { 8, "Adobe Deflate" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
122 { 9, "JBIG B&W" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
123 { 10, "JBIG Color" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
124 { 32766, "Next" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
125 { 32771, "CCIRLEW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
126 { 32773, "PackBits" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
127 { 32809, "ThunderScan" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
128 { 32895, "IT8CTPAD" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
129 { 32896, "IT8LW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
130 { 32897, "IT8MP" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
131 { 32898, "IT8BL" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
132 { 32908, "PixasFilm" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
133 { 32909, "PixasLog" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
134 { 32946, "Deflate" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
135 { 32947, "DCS" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
136 { 34661, "JBIG" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
137 { 34676, "SGILog" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
138 { 34677, "SGILog24" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
139 { 34712, "JPEF 2000" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
140 { 34713, "Nikon NEF Compressed" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
141 EXIF_TEXT_LIST_END
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
142 };
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 static ExifTextList ExifOrientationList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 { EXIF_ORIENTATION_UNKNOWN, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 { EXIF_ORIENTATION_TOP_LEFT, N_("top left") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 { EXIF_ORIENTATION_TOP_RIGHT, N_("top right") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 { EXIF_ORIENTATION_BOTTOM_RIGHT,N_("bottom right") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 { EXIF_ORIENTATION_BOTTOM_LEFT, N_("bottom left") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 { EXIF_ORIENTATION_LEFT_TOP, N_("left top") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 { EXIF_ORIENTATION_RIGHT_TOP, N_("right top") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 { EXIF_ORIENTATION_RIGHT_BOTTOM,N_("right bottom") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 { EXIF_ORIENTATION_LEFT_BOTTOM, N_("left bottom") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 static ExifTextList ExifUnitList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 { EXIF_UNIT_UNKNOWN, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 { EXIF_UNIT_NOUNIT, "" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 { EXIF_UNIT_INCH, N_("inch") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 { EXIF_UNIT_CENTIMETER, N_("centimeter") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 static ExifTextList ExifYCbCrPosList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 { 1, "center" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 { 2, "datum" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 static ExifTextList ExifMeteringModeList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 { 0, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 { 1, N_("average") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 { 2, N_("center weighted") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 { 3, N_("spot") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 { 4, N_("multi-spot") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 { 5, N_("multi-segment") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 { 6, N_("partial") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 { 255, N_("other") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 static ExifTextList ExifExposureProgramList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 { 0, N_("not defined") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 { 1, N_("manual") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 { 2, N_("normal") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 { 3, N_("aperture") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 { 4, N_("shutter") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 { 5, N_("creative") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 { 6, N_("action") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 { 7, N_("portrait") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 { 8, N_("landscape") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 static ExifTextList ExifLightSourceList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 { 0, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 { 1, N_("daylight") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 { 2, N_("fluorescent") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 { 3, N_("tungsten (incandescent)") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 { 4, N_("flash") },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
202 { 9, N_("fine weather") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
203 { 10, N_("cloudy weather") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
204 { 11, N_("shade") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
205 { 12, N_("daylight fluorescent") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
206 { 13, N_("day white fluorescent") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
207 { 14, N_("cool white fluorescent") },
293
faeda3c7c8f8 Fix a typo: "while fluorescent" -> "white fluorescent"
zas_
parents: 281
diff changeset
208 { 15, N_("white fluorescent") },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
209 { 17, N_("standard light A") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
210 { 18, N_("standard light B") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
211 { 19, N_("standard light C") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
212 { 20, N_("D55") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
213 { 21, N_("D65") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
214 { 22, N_("D75") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
215 { 23, N_("D50") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
216 { 24, N_("ISO studio tungsten") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 { 255, N_("other") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 static ExifTextList ExifFlashList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 { 0, N_("no") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 { 1, N_("yes") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 { 5, N_("yes, not detected by strobe") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 { 7, N_("yes, detected by strobe") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 static ExifTextList ExifColorSpaceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
230 { 1, N_("sRGB") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
231 { 65535,N_("uncalibrated") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 static ExifTextList ExifSensorList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
236 { 1, N_("not defined") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
237 { 2, N_("1 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
238 { 2, N_("2 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
239 { 4, N_("3 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
240 { 5, N_("color sequential area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
241 { 7, N_("trilinear") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
242 { 8, N_("color sequential linear") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 static ExifTextList ExifSourceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
247 { 3, N_("digital still camera") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 static ExifTextList ExifSceneList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
252 { 1, N_("direct photo") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 static ExifTextList ExifCustRenderList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
257 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
258 { 1, N_("custom") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 static ExifTextList ExifExposureModeList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
263 { 0, N_("auto") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
264 { 1, N_("manual") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
265 { 2, N_("auto bracket") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 static ExifTextList ExifWhiteBalanceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
270 { 0, N_("auto") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
271 { 1, N_("manual") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 static ExifTextList ExifSceneCaptureList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
276 { 0, N_("standard") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
277 { 1, N_("landscape") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
278 { 2, N_("portrait") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
279 { 3, N_("night scene") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 static ExifTextList ExifGainControlList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
284 { 0, N_("none") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
285 { 1, N_("low gain up") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
286 { 2, N_("high gain up") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
287 { 3, N_("low gain down") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
288 { 4, N_("high gain down") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 static ExifTextList ExifContrastList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
293 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
294 { 1, N_("soft") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
295 { 2, N_("hard") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 static ExifTextList ExifSaturationList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
300 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
301 { 1, N_("low") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
302 { 2, N_("high") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 static ExifTextList ExifSharpnessList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
307 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
308 { 1, N_("soft") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
309 { 2, N_("hard") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 static ExifTextList ExifSubjectRangeList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
314 { 0, N_("unknown") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
315 { 1, N_("macro") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
316 { 2, N_("close") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
317 { 3, N_("distant") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
321 /*
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
322 Tag names should match to exiv2 keys, http://www.exiv2.org/metadata.html
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
323 Tags that don't match are not supported by exiv2 and should not be used anywhere in the code
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
324 */
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
325
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 ExifMarker ExifKnownMarkersList[] = {
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
327 { 0x0100, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Image.ImageWidth", N_("Image Width"), NULL },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
328 { 0x0101, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Image.ImageLength", N_("Image Height"), NULL },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
329 { 0x0102, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Image.BitsPerSample", N_("Bits per Sample/Pixel"), NULL },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
330 { 0x0103, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Image.Compression", N_("Compression"), ExifCompressionList },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
331 { 0x010e, EXIF_FORMAT_STRING, -1, "Exif.Image.ImageDescription", N_("Image description"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
332 { 0x010f, EXIF_FORMAT_STRING, -1, "Exif.Image.Make", N_("Camera make"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
333 { 0x0110, EXIF_FORMAT_STRING, -1, "Exif.Image.Model", N_("Camera model"), NULL },
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
334 { 0x0112, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Image.Orientation", N_("Orientation"), ExifOrientationList },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
335 { 0x011a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Image.XResolution", N_("X resolution"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
336 { 0x011b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Image.YResolution", N_("Y Resolution"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
337 { 0x0128, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Image.ResolutionUnit", N_("Resolution units"), ExifUnitList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
338 { 0x0131, EXIF_FORMAT_STRING, -1, "Exif.Image.Software", N_("Firmware"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
339 { 0x0132, EXIF_FORMAT_STRING, 20, "Exif.Image.DateTime", N_("Date"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
340 { 0x013e, EXIF_FORMAT_RATIONAL_UNSIGNED, 2, "Exif.Image.WhitePoint", N_("White point"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
341 { 0x013f, EXIF_FORMAT_RATIONAL_UNSIGNED, 6, "Exif.Image.PrimaryChromaticities",N_("Primary chromaticities"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
342 { 0x0211, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.Image.YCbCrCoefficients", N_("YCbCy coefficients"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
343 { 0x0213, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Image.YCbCrPositioning", N_("YCbCr positioning"), ExifYCbCrPosList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
344 { 0x0214, EXIF_FORMAT_RATIONAL_UNSIGNED, 6, "Exif.Image.ReferenceBlackWhite",N_("Black white reference"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
345 { 0x8298, EXIF_FORMAT_STRING, -1, "Exif.Image.Copyright", N_("Copyright"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
346 { 0x8769, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Image.ExifTag", N_("SubIFD Exif offset"), NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 /* subIFD follows */
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
348 { 0x829a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.ExposureTime", N_("Exposure time (seconds)"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
349 { 0x829d, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FNumber", N_("FNumber"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
350 { 0x8822, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.ExposureProgram", N_("Exposure program"), ExifExposureProgramList },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
351 { 0x8824, EXIF_FORMAT_STRING, -1, "Exif.Photo.SpectralSensitivity",N_("Spectral Sensitivity"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
352 { 0x8827, EXIF_FORMAT_SHORT_UNSIGNED, -1, "Exif.Photo.ISOSpeedRatings", N_("ISO sensitivity"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
353 { 0x8828, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.OECF", N_("Optoelectric conversion factor"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
354 { 0x9000, EXIF_FORMAT_UNDEFINED, 4, "Exif.Photo.ExifVersion", N_("Exif version"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
355 { 0x9003, EXIF_FORMAT_STRING, 20, "Exif.Photo.DateTimeOriginal", N_("Date original"), NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
356 { 0x9004, EXIF_FORMAT_STRING, 20, "Exif.Photo.DateTimeDigitized", N_("Date digitized"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
357 { 0x9101, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.ComponentsConfiguration",N_("Pixel format"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
358 { 0x9102, EXIF_FORMAT_RATIONAL_UNSIGNED,1, "Exif.Photo.CompressedBitsPerPixel",N_("Compression ratio"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
359 { 0x9201, EXIF_FORMAT_RATIONAL, 1, "Exif.Photo.ShutterSpeedValue", N_("Shutter speed"), NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
360 { 0x9202, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.ApertureValue", N_("Aperture"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
361 { 0x9203, EXIF_FORMAT_RATIONAL, 1, "Exif.Photo.BrightnessValue", N_("Brightness"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
362 { 0x9204, EXIF_FORMAT_RATIONAL, 1, "Exif.Photo.ExposureBiasValue", N_("Exposure bias"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
363 { 0x9205, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.MaxApertureValue", N_("Maximum aperture"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
364 { 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.SubjectDistance", N_("Subject distance"), NULL },
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
365 { 0x9207, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.MeteringMode", N_("Metering mode"), ExifMeteringModeList },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
366 { 0x9208, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.LightSource", N_("Light source"), ExifLightSourceList },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
367 { 0x9209, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Flash", N_("Flash"), ExifFlashList },
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
368 { 0x920a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FocalLength", N_("Focal length"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
369 { 0x9214, EXIF_FORMAT_SHORT_UNSIGNED, -1, "Exif.Photo.SubjectArea", N_("Subject area"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
370 { 0x927c, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.MakerNote", N_("MakerNote"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
371 { 0x9286, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.UserComment", N_("UserComment"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
372 { 0x9290, EXIF_FORMAT_STRING, -1, "Exif.Photo.SubSecTime", N_("Subsecond time"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
373 { 0x9291, EXIF_FORMAT_STRING, -1, "Exif.Photo.SubSecTimeOriginal",N_("Subsecond time original"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
374 { 0x9292, EXIF_FORMAT_STRING, -1, "Exif.Photo.SubSecTimeDigitized",N_("Subsecond time digitized"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
375 { 0xa000, EXIF_FORMAT_UNDEFINED, 4, "Exif.Photo.FlashpixVersion", N_("FlashPix version"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
376 { 0xa001, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.ColorSpace", N_("Colorspace"), ExifColorSpaceList },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 /* ExifImageWidth, ExifImageHeight can also be unsigned short */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
378 { 0xa002, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Photo.PixelXDimension", N_("Width"), NULL },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
379 { 0xa003, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Photo.PixelYDimension", N_("Height"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
380 { 0xa004, EXIF_FORMAT_STRING, -1, "Exif.Photo.RelatedSoundFile", N_("Audio data"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
381 { 0xa005, EXIF_FORMAT_LONG_UNSIGNED, 1, "ExifInteroperabilityOffset", N_("ExifR98 extension"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
382 { 0xa20b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FlashEnergy", N_("Flash strength"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
383 { 0xa20c, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.SpatialFrequencyResponse",N_("Spatial frequency response"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
384 { 0xa20e, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FocalPlaneXResolution", N_("X Pixel density"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
385 { 0xa20f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FocalPlaneYResolution", N_("Y Pixel density"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
386 { 0xa210, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.FocalPlaneResolutionUnit", N_("Pixel density units"), ExifUnitList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
387 { 0x0214, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Exif.Photo.SubjectLocation", N_("Subject location"), NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
388 { 0xa215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.ExposureIndex", N_("ISO sensitivity"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
389 { 0xa217, EXIF_FORMAT_SHORT_UNSIGNED, -1, "Exif.Photo.SensingMethod", N_("Sensor type"), ExifSensorList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
390 { 0xa300, EXIF_FORMAT_UNDEFINED, 1, "Exif.Photo.FileSource", N_("Source type"), ExifSourceList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
391 { 0xa301, EXIF_FORMAT_UNDEFINED, 1, "Exif.Photo.SceneType", N_("Scene type"), ExifSceneList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
392 { 0xa302, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.CFAPattern", N_("Color filter array pattern"), NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 /* tags a4xx were added for Exif 2.2 (not just these - some above, as well) */
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
394 { 0xa401, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.CustomRendered", N_("Render process"), ExifCustRenderList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
395 { 0xa402, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.ExposureMode", N_("Exposure mode"), ExifExposureModeList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
396 { 0xa403, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.WhiteBalance", N_("White balance"), ExifWhiteBalanceList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
397 { 0xa404, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.DigitalZoomRatio", N_("Digital zoom ratio"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
398 { 0xa405, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.FocalLengthIn35mmFilm",N_("Focal length (35mm)"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
399 { 0xa406, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.SceneCaptureType", N_("Scene capture type"), ExifSceneCaptureList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
400 { 0xa407, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.GainControl", N_("Gain control"), ExifGainControlList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
401 { 0xa408, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Contrast", N_("Contrast"), ExifContrastList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
402 { 0xa409, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Saturation", N_("Saturation"), ExifSaturationList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
403 { 0xa40a, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Sharpness", N_("Sharpness"), ExifSharpnessList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
404 { 0xa40b, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.DeviceSettingDescription",N_("Device setting"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
405 { 0xa40c, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.SubjectDistanceRange",N_("Subject range"), ExifSubjectRangeList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
406 { 0xa420, EXIF_FORMAT_STRING, -1, "Exif.Photo.ImageUniqueID", N_("Image serial number"), NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 /* place known, but undocumented or lesser used tags here */
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
408 { 0x00fe, EXIF_FORMAT_LONG_UNSIGNED, 1, "Exif.Image.NewSubfileType", NULL, NULL },
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
409 { 0x00ff, EXIF_FORMAT_SHORT_UNSIGNED, 1, "SubfileType", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
410 { 0x012d, EXIF_FORMAT_SHORT_UNSIGNED, 3, "Exif.Image.TransferFunction", NULL, NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
411 { 0x013b, EXIF_FORMAT_STRING, -1, "Exif.Image.Artist", "Artist", NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 { 0x013d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Predictor", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 { 0x0142, EXIF_FORMAT_SHORT_UNSIGNED, 1, "TileWidth", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 { 0x0143, EXIF_FORMAT_SHORT_UNSIGNED, 1, "TileLength", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 { 0x0144, EXIF_FORMAT_LONG_UNSIGNED, -1, "TileOffsets", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 { 0x0145, EXIF_FORMAT_SHORT_UNSIGNED, -1, "TileByteCounts", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
417 { 0x014a, EXIF_FORMAT_LONG_UNSIGNED, -1, "Exif.Image.SubIFDs", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 { 0x015b, EXIF_FORMAT_UNDEFINED, -1, "JPEGTables", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
419 { 0x828d, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Exif.Image.CFARepeatPatternDim", NULL, NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
420 { 0x828e, EXIF_FORMAT_BYTE_UNSIGNED, -1, "Exif.Image.CFAPattern", NULL, NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
421 { 0x828f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Image.BatteryLevel", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 { 0x83bb, EXIF_FORMAT_LONG_UNSIGNED, -1, "IPTC/NAA", NULL, NULL },
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
423 { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 { 0x8825, EXIF_FORMAT_LONG_UNSIGNED, 1, "GPSInfo", "SubIFD GPS offset", NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 { 0x8829, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Interlace", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 { 0x882a, EXIF_FORMAT_SHORT, 1, "TimeZoneOffset", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 { 0x882b, EXIF_FORMAT_SHORT_UNSIGNED, 1, "SelfTimerMode", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
428 { 0x920b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.FlashEnergy", NULL, NULL },
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
429 { 0x920c, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.SpatialFrequencyResponse", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 { 0x920d, EXIF_FORMAT_UNDEFINED, -1, "Noise", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 { 0x9211, EXIF_FORMAT_LONG_UNSIGNED, 1, "ImageNumber", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 { 0x9212, EXIF_FORMAT_STRING, 1, "SecurityClassification", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 { 0x9213, EXIF_FORMAT_STRING, -1, "ImageHistory", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
434 { 0x9215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.ExposureIndex", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 { 0x9216, EXIF_FORMAT_BYTE_UNSIGNED, 4, "TIFF/EPStandardID", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
437 EXIF_MARKER_LIST_END
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 ExifMarker ExifUnknownMarkersList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 { 0x0000, EXIF_FORMAT_UNKNOWN, 0, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 { 0x0000, EXIF_FORMAT_BYTE_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 { 0x0000, EXIF_FORMAT_STRING, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 { 0x0000, EXIF_FORMAT_SHORT_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 { 0x0000, EXIF_FORMAT_LONG_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 { 0x0000, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 { 0x0000, EXIF_FORMAT_BYTE, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 { 0x0000, EXIF_FORMAT_UNDEFINED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 { 0x0000, EXIF_FORMAT_SHORT, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 { 0x0000, EXIF_FORMAT_LONG, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 { 0x0000, EXIF_FORMAT_RATIONAL, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 { 0x0000, EXIF_FORMAT_FLOAT, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 { 0x0000, EXIF_FORMAT_DOUBLE, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
456 static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 * ExifItem
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
464 ExifItem *exif_item_new(ExifFormatType format, guint tag,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
465 guint elements, const ExifMarker *marker)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469 item = g_new0(ExifItem, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 item->format = format;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 item->tag = tag;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 item->marker = marker;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 item->elements = elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 item->data = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 item->data_len = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 switch (format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 /* unknown, data is NULL */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 case EXIF_FORMAT_BYTE_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 item->data_len = sizeof(char) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 case EXIF_FORMAT_STRING:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 item->data_len = sizeof(char) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 case EXIF_FORMAT_SHORT_UNSIGNED:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
490 item->data_len = sizeof(guint16) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 case EXIF_FORMAT_LONG_UNSIGNED:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
493 item->data_len = sizeof(guint32) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 item->data_len = sizeof(ExifRational) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 case EXIF_FORMAT_BYTE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 item->data_len = sizeof(char) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 case EXIF_FORMAT_UNDEFINED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 item->data_len = sizeof(char) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 case EXIF_FORMAT_SHORT:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
505 item->data_len = sizeof(gint16) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 case EXIF_FORMAT_LONG:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
508 item->data_len = sizeof(gint32) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 item->data_len = sizeof(ExifRational) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 item->data_len = sizeof(float) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 case EXIF_FORMAT_DOUBLE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 item->data_len = sizeof(double) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 item->data = g_malloc0(item->data_len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 static void exif_item_free(ExifItem *item)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 if (!item) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 g_free(item->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 g_free(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533
192
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
534 char *exif_item_get_tag_name(ExifItem *item)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 if (!item || !item->marker) return NULL;
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
537 return g_strdup(item->marker->key);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
540 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
541 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
542 if (!item) return 0;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
543 return item->tag;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
544 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
545
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
546 guint exif_item_get_elements(ExifItem *item)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
547 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
548 if (!item) return 0;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
549 return item->elements;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
550 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
551
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
552 char *exif_item_get_data(ExifItem *item, guint *data_len)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
553 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
554 if (data_len)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
555 *data_len = item->data_len;
414
49c1cbe058ae partially fixed reading embedded color profiles with exiv2
nadvornik
parents: 293
diff changeset
556 return g_memdup(item->data, item->data_len);
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
557 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
558
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
559 guint exif_item_get_format_id(ExifItem *item)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
560 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
561 if (!item) return EXIF_FORMAT_UNKNOWN;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
562 return item->format;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
563 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
564
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
565
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
566 char *exif_item_get_description(ExifItem *item)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 if (!item || !item->marker) return NULL;
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
569 return g_strdup(_(item->marker->description));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 const char *exif_item_get_format_name(ExifItem *item, gint brief)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
574 if (!item || !item->marker) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
582 for (i = 0 ; i < ne; i++)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 unsigned char c = ((char *)data)[i];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 if (c < 32 || c > 127) c = '.';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 g_string_append_printf(string, "%c", c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 string = g_string_append(string, " : ");
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
589 for (i = 0 ; i < ne; i++)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 const gchar *spacer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 if (i > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 if (i%8 == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 spacer = " - ";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 spacer = " ";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 spacer = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 g_string_append_printf(string, "%s%02x", spacer, ((char *)data)[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 return string;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
613
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 55
diff changeset
614 gchar *exif_text_list_find_value(ExifTextList *list, guint value)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 gchar *result = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 while (!result && list[i].value >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 if (value == list[i].value) result = g_strdup(_(list[i].description));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 if (!result) result = g_strdup_printf("%d (%s)", value, _("unknown"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 return result;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
630
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 *-------------------------------------------------------------------
107
a01d8c49ca2f fix comments
gqview
parents: 106
diff changeset
633 * byte order utils
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
637 /* note: the align_buf is used to avoid alignment issues (on sparc) */
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
638
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
639 guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
641 guint16 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
642
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
643 memcpy(&align_buf, f, sizeof(guint16));
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
644
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
645 if (bo == EXIF_BYTE_ORDER_INTEL)
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
646 return GUINT16_FROM_LE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
648 return GUINT16_FROM_BE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
651 guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
653 guint32 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
654
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
655 memcpy(&align_buf, f, sizeof(guint32));
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
656
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
657 if (bo == EXIF_BYTE_ORDER_INTEL)
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
658 return GUINT32_FROM_LE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
660 return GUINT32_FROM_BE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 }
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
662
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
663 void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
664 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
665 guint16 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
666
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
667 if (bo == EXIF_BYTE_ORDER_INTEL)
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
668 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
669 align_buf = GUINT16_TO_LE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
670 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
672 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
673 align_buf = GUINT16_TO_BE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
674 }
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
675
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
676 memcpy(f, &align_buf, sizeof(guint16));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
679 void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
681 guint32 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
682
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
683 if (bo == EXIF_BYTE_ORDER_INTEL)
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
684 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
685 align_buf = GUINT32_TO_LE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
686 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
688 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
689 align_buf = GUINT32_TO_BE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
690 }
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
691
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
692 memcpy(f, &align_buf, sizeof(guint32));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
695
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 * IFD utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
702 static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
704 gint i = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
706 if (!list) return NULL;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
707
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
708 while (list[i].tag != 0 && list[i].tag != tag)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
713 return (list[i].tag == 0 ? NULL : &list[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
716 static void rational_from_data(ExifRational *r, void *src, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
718 r->num = exif_byte_get_int32(src, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
719 r->den = exif_byte_get_int32(src + sizeof(guint32), bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
722 /* src_format and item->format must be compatible
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
723 * and not overrun src or item->data.
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
724 */
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
725 void exif_item_copy_data(ExifItem *item, void *src, guint len,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
726 ExifFormatType src_format, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
728 gint bs;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
729 gint ne;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 gpointer dest;
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
731 gint i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 bs = ExifFormatList[item->format].size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 ne = item->elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 dest = item->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
737 if (!dest ||
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
738 ExifFormatList[src_format].size * ne > len)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 {
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
740 gchar *tag = exif_item_get_tag_name(item);
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
741 printf("exif tag %s data size mismatch\n", tag);
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
742 g_free(tag);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 switch (item->format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 case EXIF_FORMAT_BYTE_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751 case EXIF_FORMAT_BYTE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 case EXIF_FORMAT_UNDEFINED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 memcpy(dest, src, len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 case EXIF_FORMAT_STRING:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 memcpy(dest, src, len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 /* string is NULL terminated, make sure this is true */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 if (((char *)dest)[len - 1] != '\0') ((char *)dest)[len - 1] = '\0';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 case EXIF_FORMAT_SHORT_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 case EXIF_FORMAT_SHORT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
764 ((guint16 *)dest)[i] = exif_byte_get_int16(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 case EXIF_FORMAT_LONG:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 if (src_format == EXIF_FORMAT_SHORT_UNSIGNED ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 src_format == EXIF_FORMAT_SHORT)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 /* a short fits into a long, so allow it */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
773 gint ss;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 ss = ExifFormatList[src_format].size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
778 ((gint32 *)dest)[i] =
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
779 (gint32)exif_byte_get_int16(src + i * ss, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
786 ((gint32 *)dest)[i] =
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
787 exif_byte_get_int32(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
795 rational_from_data(&((ExifRational *)dest)[i], src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
801 ((float *)dest)[i] = exif_byte_get_int32(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 case EXIF_FORMAT_DOUBLE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 ExifRational r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
809 rational_from_data(&r, src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 if (r.den) ((double *)dest)[i] = (double)r.num / r.den;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
816 static gint exif_parse_IFD_entry(ExifData *exif, unsigned char *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
817 guint size, ExifByteOrder bo,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
818 gint level,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
819 const ExifMarker *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
821 guint tag;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
822 guint format;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
823 guint count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
824 guint data_val;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
825 guint data_offset;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
826 guint data_length;
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
827 const ExifMarker *marker;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
830 tag = exif_byte_get_int16(tiff + offset + EXIF_TIFD_OFFSET_TAG, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
831 format = exif_byte_get_int16(tiff + offset + EXIF_TIFD_OFFSET_FORMAT, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
832 count = exif_byte_get_int32(tiff + offset + EXIF_TIFD_OFFSET_COUNT, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
833 data_val = exif_byte_get_int32(tiff + offset + EXIF_TIFD_OFFSET_DATA, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 /* Check tag type. If it does not match, either the format is wrong,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 * either it is a unknown tag; so it is not really an error.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
838 marker = exif_marker_from_tag(tag, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 if (!marker)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
841 if (format >= EXIF_FORMAT_COUNT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
843 printf("warning: exif tag 0x%4x has invalid format %d\n", tag, format);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 /* allow non recognized tags to be displayed */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
847 marker = &ExifUnknownMarkersList[format];
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
849 if (marker->format != format)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 /* Some cameras got mixed up signed/unsigned_rational
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 * eg KODAK DC4800 on object_distance tag
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 * FIXME: what exactly is this test trying to do?
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 * ok, so this test is to allow the case of swapped signed/unsigned mismatch to leak through?
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
857 if (!(marker->format == EXIF_FORMAT_RATIONAL_UNSIGNED && format == EXIF_FORMAT_RATIONAL) &&
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
858 !(marker->format == EXIF_FORMAT_RATIONAL && format == EXIF_FORMAT_RATIONAL_UNSIGNED) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 /* short fits into a long so allow this mismatch
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 * as well (some tags allowed to be unsigned short _or_ unsigned long)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
862 !(marker->format == EXIF_FORMAT_LONG_UNSIGNED && format == EXIF_FORMAT_SHORT_UNSIGNED) )
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
864 if (format < EXIF_FORMAT_COUNT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 printf("warning: exif tag %s format mismatch, found %s exif spec requests %s\n",
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
867 marker->key, ExifFormatList[format].short_name,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
868 ExifFormatList[marker->format].short_name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 printf("warning: exif tag %s format mismatch, found unknown id %d exif spec requests %d (%s)\n",
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
873 marker->key, format, marker->format,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
874 ExifFormatList[marker->format].short_name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 /* Where is the data, is it available?
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
882 if (marker->components > 0 && marker->components != count)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
884 printf("warning: exif tag %s has %d elements, exif spec requests %d\n",
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
885 marker->key, count, marker->components);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
887
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
888 data_length = ExifFormatList[marker->format].size * count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
889 if (data_length > 4)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
891 data_offset = data_val;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
892 if (size < data_offset + data_length)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
894 printf("warning: exif tag %s data will overrun end of file, ignored.\n", marker->key);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
900 data_offset = offset + EXIF_TIFD_OFFSET_DATA;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
903 item = exif_item_new(marker->format, tag, count, marker);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
904 exif_item_copy_data(item, tiff + data_offset, data_length, format, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 exif->items = g_list_prepend(exif->items, item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
907 if (list == ExifKnownMarkersList)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908 {
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
909 switch (item->tag)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
910 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
911 case TAG_EXIFOFFSET:
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
912 exif_parse_IFD_table(exif, tiff, data_val, size, bo, level + 1, list);
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
913 break;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
914 case TAG_EXIFMAKERNOTE:
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
915 format_exif_makernote_parse(exif, tiff, data_val, size, bo);
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
916 break;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
917 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
923 gint exif_parse_IFD_table(ExifData *exif,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
924 unsigned char *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
925 guint size, ExifByteOrder bo,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
926 gint level,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
927 const ExifMarker *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
929 guint count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
930 guint i;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
931
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
932 /* limit damage from infinite loops */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
933 if (level > EXIF_TIFF_MAX_LEVELS) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
934
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 /* We should be able to read number of entries in IFD0) */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
936 if (size < offset + 2) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
938 count = exif_byte_get_int16(tiff + offset, bo);
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 55
diff changeset
939 offset += 2;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941 /* Entries and next IFD offset must be readable */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
942 if (size < offset + count * EXIF_TIFD_SIZE + 4) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
944 for (i = 0; i < count; i++)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
945 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
946 exif_parse_IFD_entry(exif, tiff, offset + i * EXIF_TIFD_SIZE, size, bo, level, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
947 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
948
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
949 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
953 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
954 * file formats
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
955 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
956 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
957
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
958 gint exif_tiff_directory_offset(unsigned char *data, const guint len,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
959 guint *offset, ExifByteOrder *bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
960 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
961 if (len < 8) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
962
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
963 if (memcmp(data, "II", 2) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
964 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
965 *bo = EXIF_BYTE_ORDER_INTEL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
966 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
967 else if (memcmp(data, "MM", 2) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
968 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
969 *bo = EXIF_BYTE_ORDER_MOTOROLA;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
970 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
971 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
972 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
973 return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
974 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
976 if (exif_byte_get_int16(data + 2, *bo) != 0x002A)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
977 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
978 return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
979 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
980
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
981 *offset = exif_byte_get_int32(data + 4, *bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
982
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
983 return (*offset < len);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
984 }
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
985
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
986 gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list)
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
987 {
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
988 ExifByteOrder bo;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
989 guint offset;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
990
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
991 if (!exif_tiff_directory_offset(tiff, size, &offset, &bo)) return -1;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
992
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
993 return exif_parse_IFD_table(exif, tiff, offset, size, bo, 0, list);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
994 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
995
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
996
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
997 /*
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
998 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
999 * jpeg marker utils
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1000 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1001 */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1002
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1003 #define JPEG_MARKER 0xFF
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1004 #define JPEG_MARKER_SOI 0xD8
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1005 #define JPEG_MARKER_EOI 0xD9
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1006 #define JPEG_MARKER_APP1 0xE1
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1007 #define JPEG_MARKER_APP2 0xE2
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1008
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1009 /* jpeg container format:
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1010 all data markers start with 0XFF
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1011 2 byte long file start and end markers: 0xFFD8(SOI) and 0XFFD9(EOI)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1012 4 byte long data segment markers in format: 0xFFTTSSSSNNN...
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1013 FF: 1 byte standard marker identifier
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1014 TT: 1 byte data type
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1015 SSSS: 2 bytes in Motorola byte alignment for length of the data.
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1016 This value includes these 2 bytes in the count, making actual
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1017 length of NN... == SSSS - 2.
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1018 NNN.: the data in this segment
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1019 */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
1020 static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL };
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1021
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1022 void exif_add_jpeg_color_profile(ExifData *exif, unsigned char *cp_data, guint cp_length)
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1023 {
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1024 ExifItem *item = exif_item_new(jpeg_color_marker.format, jpeg_color_marker.tag, 1,
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1025 &jpeg_color_marker);
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1026 g_free(item->data);
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1027 item->data = cp_data;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1028 item->elements = cp_length;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1029 item->data_len = cp_length;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1030 exif->items = g_list_prepend(exif->items, item);
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1031
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1032 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1033
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1034 static gint exif_jpeg_parse(ExifData *exif,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1035 unsigned char *data, guint size,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1036 ExifMarker *list)
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1037 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1038 guint seg_offset = 0;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1039 guint seg_length = 0;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1040 gint res = -1;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1041
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1042 if (size < 4 ||
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1043 memcmp(data, "\xFF\xD8", 2) != 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1044 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1045 return -2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1046 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1047
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1048 if (exif_jpeg_segment_find(data, size, JPEG_MARKER_APP1,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1049 "Exif\x00\x00", 6,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1050 &seg_offset, &seg_length))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1051 {
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1052 res = exif_tiff_parse(exif, data + seg_offset + 6, seg_length - 6, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1053 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1054
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1055 if (exif_jpeg_parse_color(exif, data, size))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1056 {
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1057 res = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1058 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1059
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1060 return res;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1061 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1062
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1063 unsigned char *exif_get_color_profile(ExifData *exif, guint *data_len)
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1064 {
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1065 ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile");
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1066 if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED)
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1067 return (unsigned char*) exif_item_get_data(prof_item, data_len);
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1068 return NULL;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1069 }
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1070
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1071
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1072 /*
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1073 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1074 * misc
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1075 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1076 */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1077
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1078
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1079 ExifItem *exif_get_first_item(ExifData *exif)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1080 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1081 if (exif->items)
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1082 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1083 ExifItem *ret = (ExifItem *)exif->items->data;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1084 exif->current = exif->items->next;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1085 return ret;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1086 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1087 exif->current = NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1088 return NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1089 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1090
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1091 ExifItem *exif_get_next_item(ExifData *exif)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1092 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1093 if (exif->current)
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1094 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1095 ExifItem *ret = (ExifItem *)exif->current->data;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1096 exif->current = exif->current->next;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1097 return ret;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1098 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1099 return NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1100 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1101
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 static gint map_file(const gchar *path, void **mapping, int *size)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 int fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105 struct stat fs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1107 if ((fd = open(path, O_RDONLY)) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1109 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1111 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1112
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 if (fstat(fd, &fs) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1114 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120 *size = fs.st_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122 if ((*mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1130 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1133 static gint unmap_file(void *mapping, int size)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135 if (munmap(mapping, size) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1137 perror("munmap");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1141 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1143
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1144 void exif_free(ExifData *exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1148 if (!exif) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1149
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 ExifItem *item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 exif_item_free(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158 g_list_free(exif->items);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159 g_free(exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1162 ExifData *exif_read(gchar *path, gchar *sidecar_path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164 ExifData *exif;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1165 void *f;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166 int size, res;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 gchar *pathl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
1169 if (!path) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
1171 pathl = path_from_utf8(path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 if (map_file(pathl, &f, &size) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 g_free(pathl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 g_free(pathl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 exif = g_new0(ExifData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 exif->items = NULL;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1181 exif->current = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1182
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1183 if ((res = exif_jpeg_parse(exif, (unsigned char *)f, size,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1184 ExifKnownMarkersList)) == -2)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1186 res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 if (res != 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190 {
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1191 FormatRawExifType exif_type;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1192 FormatRawExifParseFunc exif_parse_func;
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1193 guint32 offset = 0;
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1194
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1195 exif_type = format_raw_exif_offset(f, size, &offset, &exif_parse_func);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1196 switch (exif_type)
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1197 {
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1198 case FORMAT_RAW_EXIF_NONE:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1199 default:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1200 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1201 case FORMAT_RAW_EXIF_TIFF:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1202 res = exif_tiff_parse(exif, (unsigned char*)f + offset, size - offset,
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1203 ExifKnownMarkersList);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1204 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1205 case FORMAT_RAW_EXIF_JPEG:
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1206 res = exif_jpeg_parse(exif, (unsigned char*)f + offset, size - offset,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1207 ExifKnownMarkersList);
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1208 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1209 case FORMAT_RAW_EXIF_IFD_II:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1210 case FORMAT_RAW_EXIF_IFD_MM:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1211 res = exif_parse_IFD_table(exif, (unsigned char*)f, offset, size - offset,
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1212 (exif_type == FORMAT_RAW_EXIF_IFD_II) ?
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1213 EXIF_BYTE_ORDER_INTEL : EXIF_BYTE_ORDER_MOTOROLA,
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1214 0, ExifKnownMarkersList);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1215 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1216 case FORMAT_RAW_EXIF_PROPRIETARY:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1217 if (exif_parse_func)
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1218 {
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1219 res = exif_parse_func((unsigned char*)f + offset, size - offset, exif);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1220 }
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1221 break;
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1222 }
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1223 }
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1224
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1225 if (res != 0)
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1226 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227 exif_free(exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 exif = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231 unmap_file(f, size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 if (exif) exif->items = g_list_reverse(exif->items);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236 exif_write_data_list(exif, stdout, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 exif_write_data_list(exif, stdout, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240 return exif;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243 ExifItem *exif_get_item(ExifData *exif, const gchar *key)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 if (!key) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1249 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256 if (item->marker->key && strcmp(key, item->marker->key) == 0) return item;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1257 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1259 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1261 #define EXIF_DATA_AS_TEXT_MAX_COUNT 16
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1262
192
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1263 gchar *exif_item_get_string(ExifItem *item, int idx)
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1264 {
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1265 return exif_item_get_data_as_text(item);
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1266 }
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1267
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1268
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 gchar *exif_item_get_data_as_text(ExifItem *item)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 {
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
1271 const ExifMarker *marker;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272 gpointer data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273 GString *string;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 gint ne;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 if (!item) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280 marker = item->marker;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 if (!marker) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283 data = item->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 ne = item->elements;
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1285 if (ne > EXIF_DATA_AS_TEXT_MAX_COUNT) ne = EXIF_DATA_AS_TEXT_MAX_COUNT;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 string = g_string_new("");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 switch (item->format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 case EXIF_FORMAT_BYTE_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 case EXIF_FORMAT_BYTE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 case EXIF_FORMAT_UNDEFINED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294 if (ne == 1 && marker->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 gchar *result;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 unsigned char val;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 if (item->format == EXIF_FORMAT_BYTE_UNSIGNED ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 item->format == EXIF_FORMAT_UNDEFINED)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302 val = ((unsigned char *)data)[0];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1304 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1305 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 val = (unsigned char)(((signed char *)data)[0]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 55
diff changeset
1309 result = exif_text_list_find_value(marker->list, (guint)val);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310 string = g_string_append(string, result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311 g_free(result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1314 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 string = string_append_raw_bytes(string, data, ne);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 case EXIF_FORMAT_STRING:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 string = g_string_append(string, (gchar *)(item->data));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 case EXIF_FORMAT_SHORT_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 if (ne == 1 && marker->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 gchar *result;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1326 result = exif_text_list_find_value(marker->list, ((guint16 *)data)[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 string = g_string_append(string, result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 g_free(result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 else for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1332 g_string_append_printf(string, "%s%hd", (i > 0) ? ", " : "",
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1333 ((guint16 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1340 (unsigned long int)((guint32 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1341 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 ExifRational *r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 r = &((ExifRational *)data)[i];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 (unsigned long)r->num, (unsigned long)r->den);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 case EXIF_FORMAT_SHORT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 g_string_append_printf(string, "%s%hd", (i > 0) ? ", " : "",
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1357 ((gint16 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 case EXIF_FORMAT_LONG:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1364 (long int)((gint32 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 ExifRational *r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372 r = &((ExifRational *)data)[i];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 (long)r->num, (long)r->den);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 ((float *)data)[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 case EXIF_FORMAT_DOUBLE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 ((double *)data)[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1393 if (item->elements > EXIF_DATA_AS_TEXT_MAX_COUNT &&
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1394 item->format != EXIF_FORMAT_STRING)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1395 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1396 g_string_append(string, " ...");
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1397 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1398
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1399 text = string->str;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1400 g_string_free(string, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 return text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 gint exif_item_get_integer(ExifItem *item, gint *value)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407 if (!item) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409 switch (item->format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 case EXIF_FORMAT_SHORT:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1412 *value = (gint)(((gint16 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415 case EXIF_FORMAT_SHORT_UNSIGNED:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1416 *value = (gint)(((guint16 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 case EXIF_FORMAT_LONG:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1420 *value = (gint)(((gint32 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 /* FIXME: overflow possible */
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1425 *value = (gint)(((guint32 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 /* all other type return FALSE */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 if (!item) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439 if (item->format == EXIF_FORMAT_RATIONAL ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 item->format == EXIF_FORMAT_RATIONAL_UNSIGNED)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442 if (sign) *sign = (item->format == EXIF_FORMAT_RATIONAL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443 return &((ExifRational *)(item->data))[0];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
1449 const gchar *exif_get_tag_description_by_key(const gchar *key)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453 if (!key) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 while (ExifKnownMarkersList[i].tag > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 if (strcmp(key, ExifKnownMarkersList[i].key) == 0) return _(ExifKnownMarkersList[i].description);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 static void exif_write_item(FILE *f, ExifItem *item)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1469 text = exif_item_get_data_as_text(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 if (text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 {
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
1472 gchar *tag = exif_item_get_tag_name(item);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1473 fprintf(f, "%4x %9s %30s %s\n", item->tag, ExifFormatList[item->format].short_name,
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
1474 tag, text);
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
1475 g_free(tag);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482 if (!f || !exif) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1483
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1484 fprintf(f, " tag format key value\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 fprintf(f, "----------------------------------------------------\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 if (human_readable_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492 while (ExifFormattedList[i].key)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1493 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 text = exif_get_formatted_by_key(exif, ExifFormattedList[i].key, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 if (text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 fprintf(f, " %9s %30s %s\n", "string", ExifFormattedList[i].key, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1510 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1511 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516 exif_write_item(f, item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 fprintf(f, "----------------------------------------------------\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1522 int exif_write(ExifData *exif)
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1523 {
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1524 printf("Not compiled with EXIF write support");
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1525 return 0;
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1526 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1527
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1528 ExifItem *exif_add_item(ExifData *exif, const gchar *key)
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1529 {
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1530 return NULL;
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1531 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1532
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1533 int exif_item_delete(ExifData *exif, ExifItem *item)
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1534 {
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1535 return 0;
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1536 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1537
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1538 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
1539 {
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1540 return 0;
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1541 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1542
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1543
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1544
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1545 #endif
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
1546 /* not HAVE_EXIV2 */