2 * \brief EXIF data manipulation functions and types
5 * Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA.
23 #ifndef __EXIF_UTILS_H__
24 #define __EXIF_UTILS_H__
28 #endif /* __cplusplus */
30 #include <libexif/exif-byte-order.h>
31 #include <libexif/exif-format.h>
32 #include <libexif/_stdint.h>
35 /* If these definitions don't work for you, please let us fix the
36 * macro generating _stdint.h */
38 /*! EXIF Unsigned Byte data type */
39 typedef unsigned char ExifByte; /* 1 byte */
41 /*! EXIF Signed Byte data type */
42 typedef signed char ExifSByte; /* 1 byte */
44 /*! EXIF Text String data type */
45 typedef char * ExifAscii;
47 /*! EXIF Unsigned Short data type */
48 typedef uint16_t ExifShort; /* 2 bytes */
50 /*! EXIF Signed Short data type */
51 typedef int16_t ExifSShort; /* 2 bytes */
53 /*! EXIF Unsigned Long data type */
54 typedef uint32_t ExifLong; /* 4 bytes */
56 /*! EXIF Signed Long data type */
57 typedef int32_t ExifSLong; /* 4 bytes */
59 /*! EXIF Unsigned Rational data type */
60 typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
62 typedef char ExifUndefined; /* 1 byte */
64 /*! EXIF Signed Rational data type */
65 typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
68 /*! Retrieve an #ExifShort value from memory.
70 * \param[in] b pointer to raw EXIF value in memory
71 * \param[in] order byte order of raw value
74 ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order);
76 /*! Retrieve an #ExifSShort value from memory.
78 * \param[in] b pointer to raw EXIF value in memory
79 * \param[in] order byte order of raw value
82 ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order);
84 /*! Retrieve an #ExifLong value from memory.
86 * \param[in] b pointer to raw EXIF value in memory
87 * \param[in] order byte order of raw value
90 ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order);
92 /*! Retrieve an #ExifSLong value from memory.
94 * \param[in] b pointer to raw EXIF value in memory
95 * \param[in] order byte order of raw value
98 ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order);
100 /*! Retrieve an #ExifRational value from memory.
102 * \param[in] b pointer to raw EXIF value in memory
103 * \param[in] order byte order of raw value
106 ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);
108 /*! Retrieve an #ExifSRational value from memory.
110 * \param[in] b pointer to raw EXIF value in memory
111 * \param[in] order byte order of raw value
114 ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order);
116 /*! Store an ExifShort value into memory in EXIF format.
118 * \param[out] b buffer in which to write raw value
119 * \param[in] order byte order to use
120 * \param[in] value data value to store
122 void exif_set_short (unsigned char *b, ExifByteOrder order,
125 /*! Store an ExifSShort value into memory in EXIF format.
127 * \param[out] b buffer in which to write raw value
128 * \param[in] order byte order to use
129 * \param[in] value data value to store
131 void exif_set_sshort (unsigned char *b, ExifByteOrder order,
134 /*! Store an ExifLong value into memory in EXIF format.
136 * \param[out] b buffer in which to write raw value
137 * \param[in] order byte order to use
138 * \param[in] value data value to store
140 void exif_set_long (unsigned char *b, ExifByteOrder order,
143 /*! Store an ExifSLong value into memory in EXIF format.
145 * \param[out] b buffer in which to write raw value
146 * \param[in] order byte order to use
147 * \param[in] value data value to store
149 void exif_set_slong (unsigned char *b, ExifByteOrder order,
152 /*! Store an ExifRational value into memory in EXIF format.
154 * \param[out] b buffer in which to write raw value
155 * \param[in] order byte order to use
156 * \param[in] value data value to store
158 void exif_set_rational (unsigned char *b, ExifByteOrder order,
161 /*! Store an ExifSRational value into memory in EXIF format.
163 * \param[out] b buffer in which to write raw value
164 * \param[in] order byte order to use
165 * \param[in] value data value to store
167 void exif_set_srational (unsigned char *b, ExifByteOrder order,
168 ExifSRational value);
171 void exif_convert_utf16_to_utf8 (char *out, const unsigned short *in, int maxlen);
173 /* Please do not use this function outside of the library. */
176 void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int,
177 ExifByteOrder o_orig, ExifByteOrder o_new);
180 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
183 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
185 /* For compatibility with older versions */
187 /*! \deprecated Use EXIF_TAG_SUB_SEC_TIME instead. */
188 #define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME
192 #endif /* __cplusplus */
194 #endif /* __EXIF_UTILS_H__ */