4 * Copyright (C) 2008 The Geeqie Team
7 * Support for Exif file format, originally written by Eric Swalens.
8 * Modified by Quy Tonthat
9 * Reimplemented with generic data storage by John Ellis
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 *-----------------------------------------------------------------------------
35 *-----------------------------------------------------------------------------
39 EXIF_BYTE_ORDER_INTEL,
40 EXIF_BYTE_ORDER_MOTOROLA
43 typedef struct _ExifFormatAttrib ExifFormatAttrib;
44 struct _ExifFormatAttrib
48 const gchar *short_name;
49 const gchar *description;
52 /* the list of known tag data formats */
53 extern ExifFormatAttrib ExifFormatList[];
57 *-----------------------------------------------------------------------------
59 *-----------------------------------------------------------------------------
62 typedef struct _ExifMarker ExifMarker;
63 typedef struct _ExifTextList ExifTextList;
67 GList *items; /* list of (ExifItem *) */
68 GList *current; /* for exif_get_next_item */
74 ExifFormatType format;
76 const ExifMarker *marker;
85 ExifFormatType format;
92 #define EXIF_MARKER_LIST_END { 0x0000, EXIF_FORMAT_UNKNOWN, 0, NULL, NULL, NULL }
97 const gchar *description;
100 #define EXIF_TEXT_LIST_END { -1, NULL }
106 *-----------------------------------------------------------------------------
108 *-----------------------------------------------------------------------------
113 /* the known exif tags list */
114 extern ExifMarker ExifKnownMarkersList[];
116 /* the unknown tags utilize this generic list */
117 extern ExifMarker ExifUnknownMarkersList[];
119 /* the list of specially formatted keys, for human readable output */
120 extern ExifFormattedText ExifFormattedList[];
124 *-----------------------------------------------------------------------------
126 *-----------------------------------------------------------------------------
130 /* usually for debugging to stdout */
131 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list);
135 /* These funcs for use by makernote/tiff parsers only */
137 #define EXIF_TIFF_MAX_LEVELS 4
139 #define EXIF_TIFD_OFFSET_TAG 0
140 #define EXIF_TIFD_OFFSET_FORMAT 2
141 #define EXIF_TIFD_OFFSET_COUNT 4
142 #define EXIF_TIFD_OFFSET_DATA 8
143 #define EXIF_TIFD_SIZE 12
146 guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo);
147 guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo);
148 void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo);
149 void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo);
151 ExifItem *exif_item_new(ExifFormatType format, guint tag,
152 guint elements, const ExifMarker *marker);
153 void exif_item_copy_data(ExifItem *item, void *src, guint len,
154 ExifFormatType src_format, ExifByteOrder bo);
156 gint exif_parse_IFD_table(ExifData *exif,
157 guchar *tiff, guint offset,
158 guint size, ExifByteOrder bo,
160 const ExifMarker *list);
162 gint exif_tiff_directory_offset(guchar *data, const guint len,
163 guint *offset, ExifByteOrder *bo);
164 gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list);
166 gchar *exif_text_list_find_value(ExifTextList *list, guint value);