annotate src/exif.c @ 1759:f0391a1bf413

print text using pango renderer - the text is sent to postscript as a bitmap - this fixes printing of non-ascii characters http://sourceforge.net/tracker/index.php?func=detail&aid=2836135&group_id=222125&atid=1054680
author nadvornik
date Sat, 26 Sep 2009 08:47:28 +0000
parents 219e1ba3ae30
children 1cff176f8144
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
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1238
diff changeset
4 * Copyright (C) 2008 - 2009 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 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 * TODO:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 * Convert data to useable form in the ??_as_text function for:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 * ComponentsConfiguration
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 * UserComment (convert this to UTF-8?)
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
36 * Add support for marker tag 0x0000
9
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>
1305
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
70 #include <glib/gprintf.h>
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 #include "intl.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 262
diff changeset
74 #include "main.h"
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
75 #include "exif-int.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
77 #include "format_raw.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 #include "ui_fileops.h"
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 * Tag formats
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 ExifFormatAttrib ExifFormatList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 { EXIF_FORMAT_UNKNOWN, 1, "unknown", "unknown" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 { EXIF_FORMAT_BYTE_UNSIGNED, 1, "ubyte", "unsigned byte" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 { EXIF_FORMAT_STRING, 1, "string", "string" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 { EXIF_FORMAT_SHORT_UNSIGNED, 2, "ushort", "unsigned short" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 { EXIF_FORMAT_LONG_UNSIGNED, 4, "ulong", "unsigned long" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 { EXIF_FORMAT_RATIONAL_UNSIGNED,8, "urational", "unsigned rational" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 { EXIF_FORMAT_BYTE, 1, "byte", "byte" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 { EXIF_FORMAT_UNDEFINED, 1, "undefined", "undefined" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 { EXIF_FORMAT_SHORT, 2, "sshort", "signed short" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 { EXIF_FORMAT_LONG, 4, "slong", "signed long" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 { EXIF_FORMAT_RATIONAL, 8, "srational", "signed rational" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 { EXIF_FORMAT_FLOAT, 4, "float", "float" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 { EXIF_FORMAT_DOUBLE, 8, "double", "double" },
749
f606e8962329 Silent few warnings that appeared when using --disable-exiv2 configure option.
zas_
parents: 673
diff changeset
101 { -1, 0, NULL, NULL }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 /* tags that are special, or need special treatment */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 #define TAG_EXIFOFFSET 0x8769
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
106 #define TAG_EXIFMAKERNOTE 0x927c
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
107 #define TAG_GPSOFFSET 0x8825
9
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 /*
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 * Data
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
115 static ExifTextList ExifCompressionList[] = {
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
116 { 1, "Uncompressed" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
117 { 2, "CCITT 1D" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
118 { 3, "T4/Group 3 Fax" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
119 { 4, "T6/Group 4 Fax" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
120 { 5, "LZW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
121 { 6, "JPEG (old style)" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
122 { 7, "JPEG" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
123 { 8, "Adobe Deflate" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
124 { 9, "JBIG B&W" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
125 { 10, "JBIG Color" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
126 { 32766, "Next" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
127 { 32771, "CCIRLEW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
128 { 32773, "PackBits" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
129 { 32809, "ThunderScan" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
130 { 32895, "IT8CTPAD" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
131 { 32896, "IT8LW" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
132 { 32897, "IT8MP" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
133 { 32898, "IT8BL" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
134 { 32908, "PixasFilm" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
135 { 32909, "PixasLog" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
136 { 32946, "Deflate" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
137 { 32947, "DCS" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
138 { 34661, "JBIG" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
139 { 34676, "SGILog" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
140 { 34677, "SGILog24" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
141 { 34712, "JPEF 2000" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
142 { 34713, "Nikon NEF Compressed" },
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
143 EXIF_TEXT_LIST_END
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
144 };
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 static ExifTextList ExifOrientationList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 { EXIF_ORIENTATION_UNKNOWN, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 { EXIF_ORIENTATION_TOP_LEFT, N_("top left") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 { EXIF_ORIENTATION_TOP_RIGHT, N_("top right") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 { EXIF_ORIENTATION_BOTTOM_RIGHT,N_("bottom right") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 { EXIF_ORIENTATION_BOTTOM_LEFT, N_("bottom left") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 { EXIF_ORIENTATION_LEFT_TOP, N_("left top") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 { EXIF_ORIENTATION_RIGHT_TOP, N_("right top") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 { EXIF_ORIENTATION_RIGHT_BOTTOM,N_("right bottom") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 { EXIF_ORIENTATION_LEFT_BOTTOM, N_("left bottom") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 static ExifTextList ExifUnitList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 { EXIF_UNIT_UNKNOWN, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 { EXIF_UNIT_NOUNIT, "" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 { EXIF_UNIT_INCH, N_("inch") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 { EXIF_UNIT_CENTIMETER, N_("centimeter") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 static ExifTextList ExifYCbCrPosList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 { 1, "center" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 { 2, "datum" },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 static ExifTextList ExifMeteringModeList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 { 0, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 { 1, N_("average") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 { 2, N_("center weighted") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 { 3, N_("spot") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 { 4, N_("multi-spot") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 { 5, N_("multi-segment") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 { 6, N_("partial") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 { 255, N_("other") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 static ExifTextList ExifExposureProgramList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 { 0, N_("not defined") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 { 1, N_("manual") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 { 2, N_("normal") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 { 3, N_("aperture") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 { 4, N_("shutter") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 { 5, N_("creative") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 { 6, N_("action") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 { 7, N_("portrait") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 { 8, N_("landscape") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 static ExifTextList ExifLightSourceList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 { 0, N_("unknown") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 { 1, N_("daylight") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 { 2, N_("fluorescent") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 { 3, N_("tungsten (incandescent)") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 { 4, N_("flash") },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
204 { 9, N_("fine weather") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
205 { 10, N_("cloudy weather") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
206 { 11, N_("shade") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
207 { 12, N_("daylight fluorescent") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
208 { 13, N_("day white fluorescent") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
209 { 14, N_("cool white fluorescent") },
293
faeda3c7c8f8 Fix a typo: "while fluorescent" -> "white fluorescent"
zas_
parents: 281
diff changeset
210 { 15, N_("white fluorescent") },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
211 { 17, N_("standard light A") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
212 { 18, N_("standard light B") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
213 { 19, N_("standard light C") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
214 { 20, N_("D55") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
215 { 21, N_("D65") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
216 { 22, N_("D75") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
217 { 23, N_("D50") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
218 { 24, N_("ISO studio tungsten") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 { 255, N_("other") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 static ExifTextList ExifFlashList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 { 0, N_("no") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 { 1, N_("yes") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 { 5, N_("yes, not detected by strobe") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 { 7, N_("yes, detected by strobe") },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 static ExifTextList ExifColorSpaceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
232 { 1, N_("sRGB") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
233 { 65535,N_("uncalibrated") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 static ExifTextList ExifSensorList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
238 { 1, N_("not defined") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
239 { 2, N_("1 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
240 { 2, N_("2 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
241 { 4, N_("3 chip color area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
242 { 5, N_("color sequential area") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
243 { 7, N_("trilinear") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
244 { 8, N_("color sequential linear") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 static ExifTextList ExifSourceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
249 { 3, N_("digital still camera") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 static ExifTextList ExifSceneList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
254 { 1, N_("direct photo") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 static ExifTextList ExifCustRenderList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
259 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
260 { 1, N_("custom") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 static ExifTextList ExifExposureModeList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
265 { 0, N_("auto") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
266 { 1, N_("manual") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
267 { 2, N_("auto bracket") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 static ExifTextList ExifWhiteBalanceList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
272 { 0, N_("auto") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
273 { 1, N_("manual") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 static ExifTextList ExifSceneCaptureList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
278 { 0, N_("standard") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
279 { 1, N_("landscape") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
280 { 2, N_("portrait") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
281 { 3, N_("night scene") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 static ExifTextList ExifGainControlList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
286 { 0, N_("none") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
287 { 1, N_("low gain up") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
288 { 2, N_("high gain up") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
289 { 3, N_("low gain down") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
290 { 4, N_("high gain down") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 static ExifTextList ExifContrastList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
295 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
296 { 1, N_("soft") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
297 { 2, N_("hard") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 static ExifTextList ExifSaturationList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
302 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
303 { 1, N_("low") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
304 { 2, N_("high") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 static ExifTextList ExifSharpnessList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
309 { 0, N_("normal") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
310 { 1, N_("soft") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
311 { 2, N_("hard") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 static ExifTextList ExifSubjectRangeList[] = {
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
316 { 0, N_("unknown") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
317 { 1, N_("macro") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
318 { 2, N_("close") },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
319 { 3, N_("distant") },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 EXIF_TEXT_LIST_END
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
323 /*
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
324 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
325 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
326 */
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
327
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 ExifMarker ExifKnownMarkersList[] = {
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
329 { 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
330 { 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
331 { 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
332 { 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
333 { 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
334 { 0x010f, EXIF_FORMAT_STRING, -1, "Exif.Image.Make", N_("Camera make"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
335 { 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
336 { 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
337 { 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
338 { 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
339 { 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
340 { 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
341 { 0x0132, EXIF_FORMAT_STRING, 20, "Exif.Image.DateTime", N_("Date"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
342 { 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
343 { 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
344 { 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
345 { 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
346 { 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
347 { 0x8298, EXIF_FORMAT_STRING, -1, "Exif.Image.Copyright", N_("Copyright"), NULL },
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
348 { 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
349 /* subIFD follows */
262
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
350 { 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
351 { 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
352 { 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
353 { 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
354 { 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
355 { 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
356 { 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
357 { 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
358 { 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
359 { 0x9101, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.ComponentsConfiguration",N_("Pixel format"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
360 { 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
361 { 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
362 { 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
363 { 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
364 { 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
365 { 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
366 { 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
367 { 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
368 { 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
369 { 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
370 { 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
371 { 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
372 { 0x927c, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.MakerNote", N_("MakerNote"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
373 { 0x9286, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.UserComment", N_("UserComment"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
374 { 0x9290, EXIF_FORMAT_STRING, -1, "Exif.Photo.SubSecTime", N_("Subsecond time"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
375 { 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
376 { 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
377 { 0xa000, EXIF_FORMAT_UNDEFINED, 4, "Exif.Photo.FlashpixVersion", N_("FlashPix version"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
378 { 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
379 /* ExifImageWidth, ExifImageHeight can also be unsigned short */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
380 { 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
381 { 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
382 { 0xa004, EXIF_FORMAT_STRING, -1, "Exif.Photo.RelatedSoundFile", N_("Audio data"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
383 { 0xa005, EXIF_FORMAT_LONG_UNSIGNED, 1, "ExifInteroperabilityOffset", N_("ExifR98 extension"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
384 { 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
385 { 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
386 { 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
387 { 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
388 { 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
389 { 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
390 { 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
391 { 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
392 { 0xa300, EXIF_FORMAT_UNDEFINED, 1, "Exif.Photo.FileSource", N_("Source type"), ExifSourceList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
393 { 0xa301, EXIF_FORMAT_UNDEFINED, 1, "Exif.Photo.SceneType", N_("Scene type"), ExifSceneList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
394 { 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
395 /* 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
396 { 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
397 { 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
398 { 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
399 { 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
400 { 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
401 { 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
402 { 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
403 { 0xa408, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Contrast", N_("Contrast"), ExifContrastList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
404 { 0xa409, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Saturation", N_("Saturation"), ExifSaturationList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
405 { 0xa40a, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Exif.Photo.Sharpness", N_("Sharpness"), ExifSharpnessList },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
406 { 0xa40b, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.DeviceSettingDescription",N_("Device setting"), NULL },
343dd4ae2b2b Mark all exif labels as translatable.
zas_
parents: 242
diff changeset
407 { 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
408 { 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
409 /* 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
410 { 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
411 { 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
412 { 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
413 { 0x013b, EXIF_FORMAT_STRING, -1, "Exif.Image.Artist", "Artist", NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 { 0x013d, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Predictor", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 { 0x0142, EXIF_FORMAT_SHORT_UNSIGNED, 1, "TileWidth", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 { 0x0143, EXIF_FORMAT_SHORT_UNSIGNED, 1, "TileLength", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 { 0x0144, EXIF_FORMAT_LONG_UNSIGNED, -1, "TileOffsets", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 { 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
419 { 0x014a, EXIF_FORMAT_LONG_UNSIGNED, -1, "Exif.Image.SubIFDs", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420 { 0x015b, EXIF_FORMAT_UNDEFINED, -1, "JPEGTables", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
421 { 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
422 { 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
423 { 0x828f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Image.BatteryLevel", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 { 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
425 { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 { 0x8825, EXIF_FORMAT_LONG_UNSIGNED, 1, "GPSInfo", "SubIFD GPS offset", NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 { 0x8829, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Interlace", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 { 0x882a, EXIF_FORMAT_SHORT, 1, "TimeZoneOffset", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 { 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
430 { 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
431 { 0x920c, EXIF_FORMAT_UNDEFINED, -1, "Exif.Photo.SpatialFrequencyResponse", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 { 0x920d, EXIF_FORMAT_UNDEFINED, -1, "Noise", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 { 0x9211, EXIF_FORMAT_LONG_UNSIGNED, 1, "ImageNumber", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 { 0x9212, EXIF_FORMAT_STRING, 1, "SecurityClassification", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 { 0x9213, EXIF_FORMAT_STRING, -1, "ImageHistory", NULL, NULL },
181
c01dd7c9c7dc unified tag names between exiv2 and internal rxif parser
nadvornik
parents: 177
diff changeset
436 { 0x9215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.Photo.ExposureIndex", NULL, NULL },
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 { 0x9216, EXIF_FORMAT_BYTE_UNSIGNED, 4, "TIFF/EPStandardID", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
439 EXIF_MARKER_LIST_END
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
442 ExifMarker ExifKnownGPSInfoMarkersList[] = {
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
443 /* The following do not work at the moment as the tag value 0x0000 has a
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
444 * special meaning. */
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
445 /* { 0x0000, EXIF_FORMAT_BYTE, -1, "Exif.GPSInfo.GPSVersionID", NULL, NULL }, */
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
446 { 0x0001, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLatitudeRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
447 { 0x0002, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLatitude", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
448 { 0x0003, EXIF_FORMAT_STRING, 2, "Exif.GPSInfo.GPSLongitudeRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
449 { 0x0004, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSLongitude", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
450 { 0x0005, EXIF_FORMAT_BYTE_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitudeRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
451 { 0x0006, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Exif.GPSInfo.GPSAltitude", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
452 { 0x0007, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSTimeStamp", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
453 { 0x0008, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSatellites", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
454 { 0x0009, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSStatus", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
455 { 0x000a, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMeasureMode", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
456 { 0x000b, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDOP", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
457 { 0x000c, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSSpeedRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
458 { 0x000d, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSSpeed", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
459 { 0x000e, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSTrackRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
460 { 0x000f, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSTrack", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
461 { 0x0010, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSImgDirectionRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
462 { 0x0011, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSImgDirection", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
463 { 0x0012, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSMapDatum", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
464 { 0x0013, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLatitudeRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
465 { 0x0014, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLatitude", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
466 { 0x0015, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestLongitudeRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
467 { 0x0016, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestLongitude", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
468 { 0x0017, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestBearingRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
469 { 0x0018, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestBearing", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
470 { 0x0019, EXIF_FORMAT_STRING, -1, "Exif.GPSInfo.GPSDestDistanceRef", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
471 { 0x001a, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Exif.GPSInfo.GPSDestDistance", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
472 { 0x001b, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSProcessingMethod", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
473 { 0x001c, EXIF_FORMAT_UNDEFINED, -1, "Exif.GPSInfo.GPSAreaInformation", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
474 { 0x001d, EXIF_FORMAT_RATIONAL_UNSIGNED, 3, "Exif.GPSInfo.GPSDateStamp", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
475 { 0x001e, EXIF_FORMAT_SHORT, -1, "Exif.GPSInfo.GPSDifferential", NULL, NULL },
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
476
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
477 EXIF_MARKER_LIST_END
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
478 };
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
479
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 ExifMarker ExifUnknownMarkersList[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 { 0x0000, EXIF_FORMAT_UNKNOWN, 0, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 { 0x0000, EXIF_FORMAT_BYTE_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 { 0x0000, EXIF_FORMAT_STRING, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 { 0x0000, EXIF_FORMAT_SHORT_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 { 0x0000, EXIF_FORMAT_LONG_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 { 0x0000, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 { 0x0000, EXIF_FORMAT_BYTE, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 { 0x0000, EXIF_FORMAT_UNDEFINED, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 { 0x0000, EXIF_FORMAT_SHORT, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 { 0x0000, EXIF_FORMAT_LONG, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 { 0x0000, EXIF_FORMAT_RATIONAL, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 { 0x0000, EXIF_FORMAT_FLOAT, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 { 0x0000, EXIF_FORMAT_DOUBLE, -1, "unknown", NULL, NULL },
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
496 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
497
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 * ExifItem
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
504 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
505 guint elements, const ExifMarker *marker)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 item = g_new0(ExifItem, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 item->format = format;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 item->tag = tag;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 item->marker = marker;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 item->elements = elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 switch (format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 /* unknown, data is NULL */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 case EXIF_FORMAT_BYTE_UNSIGNED:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
522 item->data_len = sizeof(gchar) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524 case EXIF_FORMAT_STRING:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
525 item->data_len = sizeof(gchar) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 case EXIF_FORMAT_SHORT_UNSIGNED:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
528 item->data_len = sizeof(guint16) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 case EXIF_FORMAT_LONG_UNSIGNED:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
531 item->data_len = sizeof(guint32) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 item->data_len = sizeof(ExifRational) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 case EXIF_FORMAT_BYTE:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
537 item->data_len = sizeof(gchar) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 case EXIF_FORMAT_UNDEFINED:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
540 item->data_len = sizeof(gchar) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 case EXIF_FORMAT_SHORT:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
543 item->data_len = sizeof(gint16) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 case EXIF_FORMAT_LONG:
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
546 item->data_len = sizeof(gint32) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 item->data_len = sizeof(ExifRational) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 item->data_len = sizeof(float) * elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 case EXIF_FORMAT_DOUBLE:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
555 item->data_len = sizeof(gdouble) * elements;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 item->data = g_malloc0(item->data_len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 return item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 static void exif_item_free(ExifItem *item)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 if (!item) return;
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 g_free(item->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 g_free(item);
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
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
572 gchar *exif_item_get_tag_name(ExifItem *item)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 if (!item || !item->marker) return NULL;
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
575 return g_strdup(item->marker->key);
9
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
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
578 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
579 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
580 if (!item) return 0;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
581 return item->tag;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
582 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
583
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
584 guint exif_item_get_elements(ExifItem *item)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
585 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
586 if (!item) return 0;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
587 return item->elements;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
588 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
589
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
590 gchar *exif_item_get_data(ExifItem *item, guint *data_len)
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
591 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
592 if (data_len)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
593 *data_len = item->data_len;
414
49c1cbe058ae partially fixed reading embedded color profiles with exiv2
nadvornik
parents: 293
diff changeset
594 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
595 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
596
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
597 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
598 {
242
59eac2063093 Fix a segfault occuring when using --without-exiv2 and
zas_
parents: 222
diff changeset
599 if (!item) return EXIF_FORMAT_UNKNOWN;
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
600 return item->format;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
601 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
602
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
603
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
604 gchar *exif_item_get_description(ExifItem *item)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 if (!item || !item->marker) return NULL;
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
607 return g_strdup(_(item->marker->description));
9
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
1422
91bed0d66cf2 gint -> gboolean and tidy up.
zas_
parents: 1367
diff changeset
610 const gchar *exif_item_get_format_name(ExifItem *item, gboolean brief)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
612 if (!item || !item->marker) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 }
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 static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
620 for (i = 0 ; i < ne; i++)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
622 guchar c = ((gchar *)data)[i];
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 if (c < 32 || c > 127) c = '.';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 g_string_append_printf(string, "%c", c);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 string = g_string_append(string, " : ");
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
627 for (i = 0 ; i < ne; i++)
9
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 const gchar *spacer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 if (i > 0)
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 if (i%8 == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 spacer = " - ";
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 spacer = " ";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 spacer = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 }
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
645 g_string_append_printf(string, "%s%02x", spacer, ((gchar *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 return string;
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
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
651
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 55
diff changeset
652 gchar *exif_text_list_find_value(ExifTextList *list, guint value)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 gchar *result = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 while (!result && list[i].value >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 {
749
f606e8962329 Silent few warnings that appeared when using --disable-exiv2 configure option.
zas_
parents: 673
diff changeset
660 if (value == (guint) list[i].value) result = g_strdup(_(list[i].description));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 if (!result) result = g_strdup_printf("%d (%s)", value, _("unknown"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 return result;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
668
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 *-------------------------------------------------------------------
107
a01d8c49ca2f fix comments
gqview
parents: 106
diff changeset
671 * byte order utils
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
675 /* 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
676
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
677 guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo)
9
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 guint16 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
680
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
681 memcpy(&align_buf, f, sizeof(guint16));
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 return GUINT16_FROM_LE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
686 return GUINT16_FROM_BE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
689 guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
691 guint32 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
692
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
693 memcpy(&align_buf, f, sizeof(guint32));
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
694
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
695 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
696 return GUINT32_FROM_LE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
698 return GUINT32_FROM_BE(align_buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 }
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
700
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
701 void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
702 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
703 guint16 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
704
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
705 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
706 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
707 align_buf = GUINT16_TO_LE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
708 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
710 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
711 align_buf = GUINT16_TO_BE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
712 }
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
713
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
714 memcpy(f, &align_buf, sizeof(guint16));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
717 void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 {
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
719 guint32 align_buf;
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
720
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
721 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
722 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
723 align_buf = GUINT32_TO_LE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
724 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 else
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
726 {
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
727 align_buf = GUINT32_TO_BE(n);
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
728 }
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
729
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
730 memcpy(f, &align_buf, sizeof(guint32));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
733
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 * IFD utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
740 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
741 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
742 gint i = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
744 if (!list) return NULL;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
745
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
746 while (list[i].tag != 0 && list[i].tag != tag)
9
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 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
751 return (list[i].tag == 0 ? NULL : &list[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753
1002
3096a47232ec Use gpointer instead of void *.
zas_
parents: 1000
diff changeset
754 static void rational_from_data(ExifRational *r, gpointer src, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
756 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
757 r->den = exif_byte_get_int32(src + sizeof(guint32), bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
760 /* 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
761 * 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
762 */
1002
3096a47232ec Use gpointer instead of void *.
zas_
parents: 1000
diff changeset
763 void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
764 ExifFormatType src_format, ExifByteOrder bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
766 gint bs;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
767 gint ne;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 gpointer dest;
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
769 gint i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 bs = ExifFormatList[item->format].size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 ne = item->elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 dest = item->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
775 if (!dest ||
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
776 ExifFormatList[src_format].size * ne > len)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 {
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
778 gchar *tag = exif_item_get_tag_name(item);
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
779 log_printf("exif tag %s data size mismatch\n", tag);
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
780 g_free(tag);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 }
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 switch (item->format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 case EXIF_FORMAT_BYTE_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 case EXIF_FORMAT_BYTE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 case EXIF_FORMAT_UNDEFINED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 memcpy(dest, src, len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 case EXIF_FORMAT_STRING:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 memcpy(dest, src, len);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 /* string is NULL terminated, make sure this is true */
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
796 if (((gchar *)dest)[len - 1] != '\0') ((gchar *)dest)[len - 1] = '\0';
9
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_SHORT_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 case EXIF_FORMAT_SHORT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
802 ((guint16 *)dest)[i] = exif_byte_get_int16(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 case EXIF_FORMAT_LONG:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 if (src_format == EXIF_FORMAT_SHORT_UNSIGNED ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 src_format == EXIF_FORMAT_SHORT)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 /* 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
811 gint ss;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 ss = ExifFormatList[src_format].size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 for (i = 0; i < ne; i++)
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 ((gint32 *)dest)[i] =
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
817 (gint32)exif_byte_get_int16(src + i * ss, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 {
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
824 ((gint32 *)dest)[i] =
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
825 exif_byte_get_int32(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
833 rational_from_data(&((ExifRational *)dest)[i], src + i * bs, 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 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
839 ((float *)dest)[i] = exif_byte_get_int32(src + i * bs, bo);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 case EXIF_FORMAT_DOUBLE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 ExifRational r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
847 rational_from_data(&r, src + i * bs, bo);
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
848 if (r.den) ((gdouble *)dest)[i] = (gdouble)r.num / r.den;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
854 static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
855 guint size, ExifByteOrder bo,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
856 gint level,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
857 const ExifMarker *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
859 guint tag;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
860 guint format;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
861 guint count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
862 guint data_val;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
863 guint data_offset;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
864 guint data_length;
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
865 const ExifMarker *marker;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
868 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
869 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
870 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
871 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
872
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 /* 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
874 * 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
875 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
876 marker = exif_marker_from_tag(tag, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 if (!marker)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
879 if (format >= EXIF_FORMAT_COUNT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 {
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
881 log_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
882 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 /* 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
885 marker = &ExifUnknownMarkersList[format];
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 if (marker->format != format)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 /* Some cameras got mixed up signed/unsigned_rational
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 * eg KODAK DC4800 on object_distance tag
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892 * FIXME: what exactly is this test trying to do?
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 * 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
894 */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
895 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
896 !(marker->format == EXIF_FORMAT_RATIONAL && format == EXIF_FORMAT_RATIONAL_UNSIGNED) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 /* short fits into a long so allow this mismatch
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 * as well (some tags allowed to be unsigned short _or_ unsigned long)
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 !(marker->format == EXIF_FORMAT_LONG_UNSIGNED && format == EXIF_FORMAT_SHORT_UNSIGNED) )
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
902 if (format < EXIF_FORMAT_COUNT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 {
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
904 log_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
905 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
906 ExifFormatList[marker->format].short_name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909 {
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
910 log_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
911 marker->key, format, marker->format,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
912 ExifFormatList[marker->format].short_name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
914 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 /* Where is the data, is it available?
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 */
749
f606e8962329 Silent few warnings that appeared when using --disable-exiv2 configure option.
zas_
parents: 673
diff changeset
920 if (marker->components > 0 && (guint) marker->components != count)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 {
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
922 log_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
923 marker->key, count, marker->components);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
925
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
926 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
927 if (data_length > 4)
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 data_offset = data_val;
1697
219e1ba3ae30 Fix a overrun
mow
parents: 1686
diff changeset
930 if (size < data_offset || size < data_offset + data_length)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931 {
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 541
diff changeset
932 log_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
933 return -1;
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936 else
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 data_offset = offset + EXIF_TIFD_OFFSET_DATA;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
941 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
942 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
943 exif->items = g_list_prepend(exif->items, item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
944
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
945 if (list == ExifKnownMarkersList)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946 {
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
947 switch (item->tag)
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
948 {
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
949 case TAG_EXIFOFFSET:
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
950 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
951 break;
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
952 case TAG_GPSOFFSET:
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
953 exif_parse_IFD_table(exif, tiff, data_val, size, bo, level + 1, ExifKnownGPSInfoMarkersList);
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
954 break;
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
955 case TAG_EXIFMAKERNOTE:
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
956 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
957 break;
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
958 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
959 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
960
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
961 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
962 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
963
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
964 gint exif_parse_IFD_table(ExifData *exif,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
965 guchar *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
966 guint size, ExifByteOrder bo,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
967 gint level,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 47
diff changeset
968 const ExifMarker *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
969 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
970 guint count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
971 guint i;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
972
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
973 /* limit damage from infinite loops */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
974 if (level > EXIF_TIFF_MAX_LEVELS) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
976 /* 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
977 if (size < offset + 2) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
978
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
979 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
980 offset += 2;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
981
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
982 /* 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
983 if (size < offset + count * EXIF_TIFD_SIZE + 4) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
984
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
985 for (i = 0; i < count; i++)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
986 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
987 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
988 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
989
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
990 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
991 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
992
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
993 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
994 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
995 * file formats
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
996 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
997 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
998
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
999 gint exif_tiff_directory_offset(guchar *data, const guint len,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1000 guint *offset, ExifByteOrder *bo)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1001 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1002 if (len < 8) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1003
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1004 if (memcmp(data, "II", 2) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1005 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1006 *bo = EXIF_BYTE_ORDER_INTEL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1008 else if (memcmp(data, "MM", 2) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1010 *bo = EXIF_BYTE_ORDER_MOTOROLA;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1011 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1012 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1013 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1014 return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1015 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1016
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1017 if (exif_byte_get_int16(data + 2, *bo) != 0x002A)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1019 return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1020 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1021
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1022 *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
1023
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1024 return (*offset < len);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1025 }
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1026
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1027 gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list)
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1028 {
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1029 ExifByteOrder bo;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1030 guint offset;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1031
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1032 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
1033
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1034 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
1035 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1036
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1037
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1038 /*
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1039 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1040 * jpeg marker utils
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1041 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1042 */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1043
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1044 #define JPEG_MARKER 0xFF
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1045 #define JPEG_MARKER_SOI 0xD8
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1046 #define JPEG_MARKER_EOI 0xD9
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1047 #define JPEG_MARKER_APP1 0xE1
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1048 #define JPEG_MARKER_APP2 0xE2
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1049
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1050 /* jpeg container format:
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1051 all data markers start with 0XFF
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1052 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
1053 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
1054 FF: 1 byte standard marker identifier
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1055 TT: 1 byte data type
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1056 SSSS: 2 bytes in Motorola byte alignment for length of the data.
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1057 This value includes these 2 bytes in the count, making actual
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1058 length of NN... == SSSS - 2.
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1059 NNN.: the data in this segment
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1060 */
222
77f1bcc6c161 various exif improvements based on patch by Uwe Ohse
nadvornik
parents: 192
diff changeset
1061 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
1062
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1063 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length)
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1064 {
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1065 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
1066 &jpeg_color_marker);
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1067 g_free(item->data);
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1068 item->data = cp_data;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1069 item->elements = cp_length;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1070 item->data_len = cp_length;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1071 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
1072
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1073 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1074
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1075 static gint exif_jpeg_parse(ExifData *exif,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1076 guchar *data, guint size,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1077 ExifMarker *list)
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1078 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1079 guint seg_offset = 0;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1080 guint seg_length = 0;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1081 gint res = -1;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1082
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1083 if (size < 4 ||
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1084 memcmp(data, "\xFF\xD8", 2) != 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1085 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1086 return -2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1088
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1089 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
1090 "Exif\x00\x00", 6,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1091 &seg_offset, &seg_length))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092 {
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1093 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
1094 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1096 if (exif_jpeg_parse_color(exif, data, size))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 {
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1098 res = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1099 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1100
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1101 return res;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1104 guchar *exif_get_color_profile(ExifData *exif, guint *data_len)
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1105 {
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1106 ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile");
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1107 if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED)
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1108 return (guchar *) exif_item_get_data(prof_item, data_len);
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1109 return NULL;
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1110 }
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1111
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1112
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1113 /*
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1114 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1115 * misc
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1116 *-------------------------------------------------------------------
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1117 */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
1118
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1119
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1120 ExifItem *exif_get_first_item(ExifData *exif)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1121 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1122 if (exif->items)
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1123 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1124 ExifItem *ret = (ExifItem *)exif->items->data;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1125 exif->current = exif->items->next;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1126 return ret;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1127 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1128 exif->current = NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1129 return NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1130 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1131
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1132 ExifItem *exif_get_next_item(ExifData *exif)
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1133 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1134 if (exif->current)
176
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1135 {
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1136 ExifItem *ret = (ExifItem *)exif->current->data;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1137 exif->current = exif->current->next;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1138 return ret;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1139 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1140 return NULL;
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1141 }
695e1ad3b169 simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents: 138
diff changeset
1142
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1143 static gint map_file(const gchar *path, void **mapping, gint *size)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1144 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1145 gint fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 struct stat fs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147
855
0c3f6ef17d18 Tidy up.
zas_
parents: 749
diff changeset
1148 fd = open(path, O_RDONLY);
0c3f6ef17d18 Tidy up.
zas_
parents: 749
diff changeset
1149 if (fd == -1)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 if (fstat(fd, &fs) == -1)
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 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159 return -1;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 *size = fs.st_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163
855
0c3f6ef17d18 Tidy up.
zas_
parents: 749
diff changeset
1164 *mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
0c3f6ef17d18 Tidy up.
zas_
parents: 749
diff changeset
1165 if (*mapping == MAP_FAILED)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 perror(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175
1002
3096a47232ec Use gpointer instead of void *.
zas_
parents: 1000
diff changeset
1176 static gint unmap_file(gpointer mapping, gint size)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 if (munmap(mapping, size) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 perror("munmap");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1182 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1184 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186
1069
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
1187 ExifData *exif_get_original(ExifData *processed)
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
1188 {
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
1189 return processed;
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
1190 }
aeae25d5d50d infrastructure for preprocessing of metadata
nadvornik
parents: 1060
diff changeset
1191
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 void exif_free(ExifData *exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1193 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1195
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 if (!exif) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1199 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1200 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201 ExifItem *item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1202 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1203 exif_item_free(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1206 g_list_free(exif->items);
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1207 g_free(exif->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1208 g_free(exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1210
1203
43bfcbb62cd6 prepared infrastructure for delayed metadata writting - refreshing
nadvornik
parents: 1183
diff changeset
1211 ExifData *exif_read(gchar *path, gchar *sidecar_path, GHashTable *modified_xmp)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1213 ExifData *exif;
1002
3096a47232ec Use gpointer instead of void *.
zas_
parents: 1000
diff changeset
1214 gpointer f;
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1215 gint size, res;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 gchar *pathl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217
182
8a417f10ba09 more exiv2 fixes
nadvornik
parents: 181
diff changeset
1218 if (!path) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1219
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
1220 pathl = path_from_utf8(path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1221 if (map_file(pathl, &f, &size) == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1222 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223 g_free(pathl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1225 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1226 g_free(pathl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 exif = g_new0(ExifData, 1);
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1229 exif->path = g_strdup(path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1231 res = exif_jpeg_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
855
0c3f6ef17d18 Tidy up.
zas_
parents: 749
diff changeset
1232 if (res == -2)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1234 res = exif_tiff_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 if (res != 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 {
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1239 FormatRawExifType exif_type;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1240 FormatRawExifParseFunc exif_parse_func;
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1241 guint32 offset = 0;
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1242
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1243 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
1244 switch (exif_type)
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1245 {
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1246 case FORMAT_RAW_EXIF_NONE:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1247 default:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1248 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1249 case FORMAT_RAW_EXIF_TIFF:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1250 res = exif_tiff_parse(exif, (guchar *)f + offset, size - offset,
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1251 ExifKnownMarkersList);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1252 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1253 case FORMAT_RAW_EXIF_JPEG:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1254 res = exif_jpeg_parse(exif, (guchar *)f + offset, size - offset,
449
115db540bd0c read color profiles from jpeg also with Exiv2
nadvornik
parents: 442
diff changeset
1255 ExifKnownMarkersList);
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1256 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1257 case FORMAT_RAW_EXIF_IFD_II:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1258 case FORMAT_RAW_EXIF_IFD_MM:
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1259 res = exif_parse_IFD_table(exif, (guchar *)f, offset, size - offset,
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1260 (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
1261 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
1262 0, ExifKnownMarkersList);
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1263 break;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1264 case FORMAT_RAW_EXIF_PROPRIETARY:
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1265 if (exif_parse_func)
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1266 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1267 res = exif_parse_func((guchar *)f + offset, size - offset, exif);
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1268 }
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1269 break;
43
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1270 }
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1271 }
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1272
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1273 if (res != 0)
ee03f36e9e4b Sun May 15 21:40:26 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
1274 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 exif_free(exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 exif = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279 unmap_file(f, size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 if (exif) exif->items = g_list_reverse(exif->items);
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 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 exif_write_data_list(exif, stdout, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285 exif_write_data_list(exif, stdout, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 return exif;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 ExifItem *exif_get_item(ExifData *exif, const gchar *key)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 if (!key) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1298 while (work)
995
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 855
diff changeset
1299 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 ExifItem *item;
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 item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1304 if (item->marker->key && strcmp(key, item->marker->key) == 0) return item;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1305 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 return NULL;
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
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1309 #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
1310
192
d324b284e183 configure --without-exiv2
nadvornik
parents: 188
diff changeset
1311
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1312 static gchar *exif_item_get_data_as_text_full(ExifItem *item, MetadataFormat format)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313 {
47
aa4c0e1b54b0 Fri Jun 3 01:49:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
1314 const ExifMarker *marker;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 gpointer data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 GString *string;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 gint ne;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 if (!item) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 marker = item->marker;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 if (!marker) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 data = item->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 ne = item->elements;
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1328 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
1329 string = g_string_new("");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 switch (item->format)
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 case EXIF_FORMAT_UNKNOWN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 case EXIF_FORMAT_BYTE_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 case EXIF_FORMAT_BYTE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 case EXIF_FORMAT_UNDEFINED:
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1337 if (ne == 1 && marker->list && format == METADATA_FORMATTED)
9
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 gchar *result;
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1340 guchar val;
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 if (item->format == EXIF_FORMAT_BYTE_UNSIGNED ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 item->format == EXIF_FORMAT_UNDEFINED)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1345 val = ((guchar *)data)[0];
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 {
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1349 val = (guchar)(((gchar *)data)[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 55
diff changeset
1352 result = exif_text_list_find_value(marker->list, (guint)val);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 string = g_string_append(string, result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 g_free(result);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 string = string_append_raw_bytes(string, data, ne);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 case EXIF_FORMAT_STRING:
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1362 if (item->data) string = g_string_append(string, (gchar *)(item->data));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 case EXIF_FORMAT_SHORT_UNSIGNED:
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1365 if (ne == 1 && marker->list && format == METADATA_FORMATTED)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 gchar *result;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1369 result = exif_text_list_find_value(marker->list, ((guint16 *)data)[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 string = g_string_append(string, result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371 g_free(result);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373 else for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 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
1376 ((guint16 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1383 (gulong)((guint32 *)data)[i]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 case EXIF_FORMAT_RATIONAL_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389 ExifRational *r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 r = &((ExifRational *)data)[i];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1393 (gulong)r->num, (gulong)r->den);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396 case EXIF_FORMAT_SHORT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399 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
1400 ((gint16 *)data)[i]);
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 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 case EXIF_FORMAT_LONG:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1407 (glong)((gint32 *)data)[i]);
9
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 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 case EXIF_FORMAT_RATIONAL:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 ExifRational *r;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415 r = &((ExifRational *)data)[i];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1417 (glong)r->num, (glong)r->den);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 case EXIF_FORMAT_FLOAT:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 ((float *)data)[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 case EXIF_FORMAT_DOUBLE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 for (i = 0; i < ne; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
1431 ((gdouble *)data)[i]);
9
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 break;
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
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1436 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
1437 item->format != EXIF_FORMAT_STRING)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1438 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1439 g_string_append(string, " ...");
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1440 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1441
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1442 text = string->str;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 110
diff changeset
1443 g_string_free(string, FALSE);
9
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 return text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1448 gchar *exif_item_get_string(ExifItem *item, gint idx)
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1449 {
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1450 return exif_item_get_data_as_text_full(item, METADATA_PLAIN);
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1451 }
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1452
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1453 gchar *exif_item_get_data_as_text(ExifItem *item)
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1454 {
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1455 return exif_item_get_data_as_text_full(item, METADATA_FORMATTED);
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1456 }
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1457
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 gint exif_item_get_integer(ExifItem *item, gint *value)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460 if (!item) return FALSE;
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 switch (item->format)
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 case EXIF_FORMAT_SHORT:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1465 *value = (gint)(((gint16 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468 case EXIF_FORMAT_SHORT_UNSIGNED:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1469 *value = (gint)(((guint16 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1472 case EXIF_FORMAT_LONG:
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1473 *value = (gint)(((gint32 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1474 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476 case EXIF_FORMAT_LONG_UNSIGNED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 /* FIXME: overflow possible */
110
9fbf210edc6f Tue Nov 14 15:36:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 107
diff changeset
1478 *value = (gint)(((guint32 *)(item->data))[0]);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 /* all other type return FALSE */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482 break;
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 }
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
1058
b600689a677e Fix up few signed vs unsigned warnings: exif_item_get_rational() last parameter is now of guint type.
zas_
parents: 1055
diff changeset
1488 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490 if (!item) return NULL;
1058
b600689a677e Fix up few signed vs unsigned warnings: exif_item_get_rational() last parameter is now of guint type.
zas_
parents: 1055
diff changeset
1491 if (n >= item->elements) return NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1493 if (item->format == EXIF_FORMAT_RATIONAL ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494 item->format == EXIF_FORMAT_RATIONAL_UNSIGNED)
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 if (sign) *sign = (item->format == EXIF_FORMAT_RATIONAL);
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1497 return &((ExifRational *)(item->data))[n];
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502
1053
77ca9a5d42be fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents: 1052
diff changeset
1503 gchar *exif_get_tag_description_by_key(const gchar *key)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507 if (!key) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1510 while (ExifKnownMarkersList[i].tag > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1511 {
1053
77ca9a5d42be fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents: 1052
diff changeset
1512 if (strcmp(key, ExifKnownMarkersList[i].key) == 0) return g_strdup(_(ExifKnownMarkersList[i].description));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1516 i = 0;
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1517 while (ExifKnownGPSInfoMarkersList[i].tag > 0)
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1518 {
1661
13ff1db545f6 Fix two memory failures
mow
parents: 1572
diff changeset
1519 if (strcmp(key, ExifKnownGPSInfoMarkersList[i].key) == 0) return g_strdup(_(ExifKnownGPSInfoMarkersList[i].description));
1052
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1520 i++;
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1521 }
338c21c87ff5 Add support for GPSInfo - patch by Klaus Ethgen
nadvornik
parents: 1025
diff changeset
1522
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526 static void exif_write_item(FILE *f, ExifItem *item)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530 text = exif_item_get_data_as_text(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 if (text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1532 {
185
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
1533 gchar *tag = exif_item_get_tag_name(item);
1305
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
1534 g_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
1535 tag, text);
354da67a7ca2 read also iptc and xmp
nadvornik
parents: 182
diff changeset
1536 g_free(tag);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1539 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1540
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541 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
1542 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543 if (!f || !exif) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544
1305
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
1545 g_fprintf(f, " tag format key value\n");
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
1546 g_fprintf(f, "----------------------------------------------------\n");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1547
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1548 if (human_readable_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1550 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1551
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1552 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1553 while (ExifFormattedList[i].key)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1554 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1555 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1556
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 text = exif_get_formatted_by_key(exif, ExifFormattedList[i].key, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1558 if (text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1559 {
1305
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
1560 g_fprintf(f, " %9s %30s %s\n", "string", ExifFormattedList[i].key, text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1561 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1562 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1563 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1564 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1565 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1566 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1567 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1568
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1569 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1570 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1571 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1572 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1573
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1574 item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1575 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1576
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1577 exif_write_item(f, item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1578 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1579 }
1305
2abdd6e50120 Glibification.
zas_
parents: 1288
diff changeset
1580 g_fprintf(f, "----------------------------------------------------\n");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1581 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1582
1211
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1583 gboolean exif_write(ExifData *exif)
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1584 {
1686
59c72fd324ce fixes for a built without Exiv2
nadvornik
parents: 1661
diff changeset
1585 log_printf("Not compiled with EXIF write support\n");
1211
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1586 return FALSE;
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1587 }
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1588
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1589 gboolean exif_write_sidecar(ExifData *exif, gchar *path)
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1590 {
1686
59c72fd324ce fixes for a built without Exiv2
nadvornik
parents: 1661
diff changeset
1591 log_printf("Not compiled with EXIF write support\n");
1211
e2bbe90b0dcd most of the metadata options now works
nadvornik
parents: 1203
diff changeset
1592 return FALSE;
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1593 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1594
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1595
1203
43bfcbb62cd6 prepared infrastructure for delayed metadata writting - refreshing
nadvornik
parents: 1183
diff changeset
1596 gint exif_update_metadata(ExifData *exif, const gchar *key, const GList *values)
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1597 {
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1598 return 0;
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1599 }
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1600
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1601 GList *exif_get_metadata(ExifData *exif, const gchar *key, MetadataFormat format)
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1602 {
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1603 gchar *str;
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1604 ExifItem *item;
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1605
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1606 if (!key) return NULL;
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1607
1567
c776b1310ca6 added an option to write image orientation to the metadata
nadvornik
parents: 1422
diff changeset
1608 /* convert xmp key to exif key */
1572
df4e69170f2b compilation fixes
nadvornik
parents: 1567
diff changeset
1609 if (strcmp(key, "Xmp.tiff.Orientation") == 0) key = "Exif.Image.Orientation";
1567
c776b1310ca6 added an option to write image orientation to the metadata
nadvornik
parents: 1422
diff changeset
1610
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1611 if (format == METADATA_FORMATTED)
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1612 {
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1613 gchar *text;
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1614 gint key_valid;
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1615 text = exif_get_formatted_by_key(exif, key, &key_valid);
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1616 if (key_valid) return g_list_append(NULL, text);
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1617 }
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1618
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1619 item = exif_get_item(exif, key);
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1620 if (!item) return NULL;
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1621
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1622 str = exif_item_get_data_as_text_full(item, format);
1238
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1623
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1624 if (!str) return NULL;
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1625
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1626 return g_list_append(NULL, str);
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1627 }
947e603a52c6 simplified metadata interface, dropped metadata_read,
nadvornik
parents: 1211
diff changeset
1628
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1629 typedef struct _UnmapData UnmapData;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1630 struct _UnmapData
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1631 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1632 guchar *ptr;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1633 guchar *map_data;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1634 size_t map_len;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1635 };
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1636
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1637 static GList *exif_unmap_list = 0;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1638
1060
1e2de04c6fc4 added option to use exif thumbnails
nadvornik
parents: 1058
diff changeset
1639 guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width, gint requested_height)
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1640 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1641 guint offset;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1642 const gchar* path;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1643 struct stat st;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1644 guchar *map_data;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1645 size_t map_len;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1646 int fd;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1647
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1648 if (!exif) return NULL;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1649 path = exif->path;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1650
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1651 fd = open(path, O_RDONLY);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1652
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1653
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1654 if (fd == -1)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1655 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1656 return 0;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1657 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1658
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1659 if (fstat(fd, &st) == -1)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1660 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1661 close(fd);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1662 return 0;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1663 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1664 map_len = st.st_size;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1665 map_data = (guchar *) mmap(0, map_len, PROT_READ, MAP_PRIVATE, fd, 0);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1666 close(fd);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1667
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1668 if (map_data == MAP_FAILED)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1669 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1670 return 0;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1671 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1672
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1673 if (format_raw_img_exif_offsets(map_data, map_len, &offset, NULL) && offset)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1674 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1675 UnmapData *ud;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1676
1179
de19d176bdbd Fix up format vs type warning.
zas_
parents: 1069
diff changeset
1677 DEBUG_1("%s: offset %u", path, offset);
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1678
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1679 *data_len = map_len - offset;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1680 ud = g_new(UnmapData, 1);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1681 ud->ptr = map_data + offset;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1682 ud->map_data = map_data;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1683 ud->map_len = map_len;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1684
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1685 exif_unmap_list = g_list_prepend(exif_unmap_list, ud);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1686 return ud->ptr;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1687 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1688
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1689 munmap(map_data, map_len);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1690 return NULL;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1691
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1692 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1693
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1694 void exif_free_preview(guchar *buf)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1695 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1696 GList *work = exif_unmap_list;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1697
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1698 while (work)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1699 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1700 UnmapData *ud = (UnmapData *)work->data;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1701 if (ud->ptr == buf)
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1702 {
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1703 exif_unmap_list = g_list_remove_link(exif_unmap_list, work);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1704 g_free(ud);
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1705 return;
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1706 }
1025
448d174454e1 fixed possible endless loop
nadvornik
parents: 1010
diff changeset
1707 work = work->next;
1010
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1708 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1709 g_assert_not_reached();
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1710 }
82fe98d2cfdb added new raw preview interface for legacy exif
nadvornik
parents: 1002
diff changeset
1711
1288
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1712 void exif_init(void)
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1713 {
10073464e6aa use metadata_read_* functions where possible
nadvornik
parents: 1284
diff changeset
1714 }
187
9eafc4957f1a write support in Exiv2 wrapper; for now only string values
nadvornik
parents: 185
diff changeset
1715
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 414
diff changeset
1716 #endif
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 176
diff changeset
1717 /* not HAVE_EXIV2 */
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1053
diff changeset
1718 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */