Remove commented out code.
[geeqie.git] / src / exif-int.h
1 /*
2  * Geeqie
3  * (C) 2006 John Ellis
4  *  Copyright (C) 2008 - 2012 The Geeqie Team
5  *
6  *  Authors:
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
10  *
11
12     This program is free software; you can redistribute it and/or modify
13     it under the terms of the GNU General Public License as published by
14     the Free Software Foundation; either version 2 of the License, or
15     (at your option) any later version.
16
17     This program is distributed in the hope that it will be useful,
18     but WITHOUT ANY WARRANTY; without even the implied warranty of
19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20     GNU General Public License for more details.
21
22     You should have received a copy of the GNU General Public License
23     along with this program; if not, write to the Free Software
24     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27 #ifndef __EXIF_INT_H
28 #define __EXIF_INT_H
29
30 #include "exif.h"
31
32 /*
33  *-----------------------------------------------------------------------------
34  * Tag formats
35  *-----------------------------------------------------------------------------
36  */
37
38 typedef enum {
39         EXIF_BYTE_ORDER_INTEL,
40         EXIF_BYTE_ORDER_MOTOROLA
41 } ExifByteOrder;
42
43 typedef struct _ExifFormatAttrib ExifFormatAttrib;
44 struct _ExifFormatAttrib
45 {
46         ExifFormatType type;
47         guint size;
48         const gchar *short_name;
49         const gchar *description;
50 };
51
52 /* the list of known tag data formats */
53 extern ExifFormatAttrib ExifFormatList[];
54
55
56 /*
57  *-----------------------------------------------------------------------------
58  * Data storage
59  *-----------------------------------------------------------------------------
60  */
61
62 typedef struct _ExifMarker ExifMarker;
63 typedef struct _ExifTextList ExifTextList;
64
65 struct _ExifData
66 {
67         gchar *path;
68         GList *items;   /* list of (ExifItem *) */
69         GList *current; /* for exif_get_next_item */
70 };
71
72
73 struct _ExifItem
74 {
75         ExifFormatType format;
76         guint tag;
77         const ExifMarker *marker;
78         guint elements;
79         gpointer data;
80         guint data_len;
81 };
82
83 struct _ExifMarker
84 {
85         guint           tag;
86         ExifFormatType  format;
87         gint            components;
88         gchar           *key;
89         gchar           *description;
90         ExifTextList    *list;
91 };
92
93 #define EXIF_MARKER_LIST_END { 0x0000, EXIF_FORMAT_UNKNOWN, 0, NULL, NULL, NULL }
94
95 struct _ExifTextList
96 {
97         gint value;
98         const gchar *description;
99 };
100
101 #define EXIF_TEXT_LIST_END { -1, NULL }
102
103
104
105
106 /*
107  *-----------------------------------------------------------------------------
108  * Data
109  *-----------------------------------------------------------------------------
110  */
111
112
113
114 /* the known exif tags list */
115 extern ExifMarker ExifKnownMarkersList[];
116
117 /* the unknown tags utilize this generic list */
118 extern ExifMarker ExifUnknownMarkersList[];
119
120 /* the list of specially formatted keys, for human readable output */
121 extern ExifFormattedText ExifFormattedList[];
122
123
124 /*
125  *-----------------------------------------------------------------------------
126  * functions
127  *-----------------------------------------------------------------------------
128  */
129
130
131 /* usually for debugging to stdout */
132 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list);
133
134
135
136 /* These funcs for use by makernote/tiff parsers only */
137
138 #define EXIF_TIFF_MAX_LEVELS 4
139
140 #define EXIF_TIFD_OFFSET_TAG 0
141 #define EXIF_TIFD_OFFSET_FORMAT 2
142 #define EXIF_TIFD_OFFSET_COUNT 4
143 #define EXIF_TIFD_OFFSET_DATA 8
144 #define EXIF_TIFD_SIZE 12
145
146
147 guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo);
148 guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo);
149 void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo);
150 void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo);
151
152 ExifItem *exif_item_new(ExifFormatType format, guint tag,
153                         guint elements, const ExifMarker *marker);
154 void exif_item_copy_data(ExifItem *item, gpointer src, guint len,
155                          ExifFormatType src_format, ExifByteOrder bo);
156
157 gint exif_parse_IFD_table(ExifData *exif,
158                           guchar *tiff, guint offset,
159                           guint size, ExifByteOrder bo,
160                           gint level,
161                           const ExifMarker *list);
162
163 gint exif_tiff_directory_offset(guchar *data, const guint len,
164                                 guint *offset, ExifByteOrder *bo);
165 gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list);
166
167 gchar *exif_text_list_find_value(ExifTextList *list, guint value);
168
169 #endif
170 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */