OLD | NEW |
(Empty) | |
| 1 /*! \file exif-utils.h |
| 2 * \brief EXIF data manipulation functions and types |
| 3 */ |
| 4 /* |
| 5 * Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net> |
| 6 * |
| 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. |
| 11 * |
| 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. |
| 16 * |
| 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. |
| 21 */ |
| 22 |
| 23 #ifndef __EXIF_UTILS_H__ |
| 24 #define __EXIF_UTILS_H__ |
| 25 |
| 26 #ifdef __cplusplus |
| 27 extern "C" { |
| 28 #endif /* __cplusplus */ |
| 29 |
| 30 #include <libexif/exif-byte-order.h> |
| 31 #include <libexif/exif-format.h> |
| 32 #include <libexif/_stdint.h> |
| 33 #include "config.h" |
| 34 |
| 35 |
| 36 /* If these definitions don't work for you, please let us fix the |
| 37 * macro generating _stdint.h */ |
| 38 |
| 39 /*! EXIF Unsigned Byte data type */ |
| 40 typedef unsigned char ExifByte; /* 1 byte */ |
| 41 |
| 42 /*! EXIF Signed Byte data type */ |
| 43 typedef signed char ExifSByte; /* 1 byte */ |
| 44 |
| 45 /*! EXIF Text String data type */ |
| 46 typedef char * ExifAscii; |
| 47 |
| 48 /*! EXIF Unsigned Short data type */ |
| 49 typedef uint16_t ExifShort; /* 2 bytes */ |
| 50 |
| 51 /*! EXIF Signed Short data type */ |
| 52 typedef int16_t ExifSShort; /* 2 bytes */ |
| 53 |
| 54 /*! EXIF Unsigned Long data type */ |
| 55 typedef uint32_t ExifLong; /* 4 bytes */ |
| 56 |
| 57 /*! EXIF Signed Long data type */ |
| 58 typedef int32_t ExifSLong; /* 4 bytes */ |
| 59 |
| 60 /*! EXIF Unsigned Rational data type */ |
| 61 typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational; |
| 62 |
| 63 typedef char ExifUndefined; /* 1 byte */ |
| 64 |
| 65 /*! EXIF Signed Rational data type */ |
| 66 typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational; |
| 67 |
| 68 |
| 69 /*! Retrieve an #ExifShort value from memory. |
| 70 * |
| 71 * \param[in] b pointer to raw EXIF value in memory |
| 72 * \param[in] order byte order of raw value |
| 73 * \return value |
| 74 */ |
| 75 ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order); |
| 76 |
| 77 /*! Retrieve an #ExifSShort value from memory. |
| 78 * |
| 79 * \param[in] b pointer to raw EXIF value in memory |
| 80 * \param[in] order byte order of raw value |
| 81 * \return value |
| 82 */ |
| 83 ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order); |
| 84 |
| 85 /*! Retrieve an #ExifLong value from memory. |
| 86 * |
| 87 * \param[in] b pointer to raw EXIF value in memory |
| 88 * \param[in] order byte order of raw value |
| 89 * \return value |
| 90 */ |
| 91 ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order); |
| 92 |
| 93 /*! Retrieve an #ExifSLong value from memory. |
| 94 * |
| 95 * \param[in] b pointer to raw EXIF value in memory |
| 96 * \param[in] order byte order of raw value |
| 97 * \return value |
| 98 */ |
| 99 ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order); |
| 100 |
| 101 /*! Retrieve an #ExifRational value from memory. |
| 102 * |
| 103 * \param[in] b pointer to raw EXIF value in memory |
| 104 * \param[in] order byte order of raw value |
| 105 * \return value |
| 106 */ |
| 107 ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order); |
| 108 |
| 109 /*! Retrieve an #ExifSRational value from memory. |
| 110 * |
| 111 * \param[in] b pointer to raw EXIF value in memory |
| 112 * \param[in] order byte order of raw value |
| 113 * \return value |
| 114 */ |
| 115 ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order); |
| 116 |
| 117 /*! Store an ExifShort value into memory in EXIF format. |
| 118 * |
| 119 * \param[out] b buffer in which to write raw value |
| 120 * \param[in] order byte order to use |
| 121 * \param[in] value data value to store |
| 122 */ |
| 123 void exif_set_short (unsigned char *b, ExifByteOrder order, |
| 124 ExifShort value); |
| 125 |
| 126 /*! Store an ExifSShort value into memory in EXIF format. |
| 127 * |
| 128 * \param[out] b buffer in which to write raw value |
| 129 * \param[in] order byte order to use |
| 130 * \param[in] value data value to store |
| 131 */ |
| 132 void exif_set_sshort (unsigned char *b, ExifByteOrder order, |
| 133 ExifSShort value); |
| 134 |
| 135 /*! Store an ExifLong value into memory in EXIF format. |
| 136 * |
| 137 * \param[out] b buffer in which to write raw value |
| 138 * \param[in] order byte order to use |
| 139 * \param[in] value data value to store |
| 140 */ |
| 141 void exif_set_long (unsigned char *b, ExifByteOrder order, |
| 142 ExifLong value); |
| 143 |
| 144 /*! Store an ExifSLong value into memory in EXIF format. |
| 145 * |
| 146 * \param[out] b buffer in which to write raw value |
| 147 * \param[in] order byte order to use |
| 148 * \param[in] value data value to store |
| 149 */ |
| 150 void exif_set_slong (unsigned char *b, ExifByteOrder order, |
| 151 ExifSLong value); |
| 152 |
| 153 /*! Store an ExifRational value into memory in EXIF format. |
| 154 * |
| 155 * \param[out] b buffer in which to write raw value |
| 156 * \param[in] order byte order to use |
| 157 * \param[in] value data value to store |
| 158 */ |
| 159 void exif_set_rational (unsigned char *b, ExifByteOrder order, |
| 160 ExifRational value); |
| 161 |
| 162 /*! Store an ExifSRational value into memory in EXIF format. |
| 163 * |
| 164 * \param[out] b buffer in which to write raw value |
| 165 * \param[in] order byte order to use |
| 166 * \param[in] value data value to store |
| 167 */ |
| 168 void exif_set_srational (unsigned char *b, ExifByteOrder order, |
| 169 ExifSRational value); |
| 170 |
| 171 /*! \internal */ |
| 172 void exif_convert_utf16_to_utf8 (char *out, const unsigned short *in, int maxlen
); |
| 173 |
| 174 /* Please do not use this function outside of the library. */ |
| 175 |
| 176 /*! \internal */ |
| 177 void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int, |
| 178 ExifByteOrder o_orig, ExifByteOrder o_new); |
| 179 |
| 180 #undef MIN |
| 181 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| 182 |
| 183 #undef MAX |
| 184 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) |
| 185 |
| 186 /* For compatibility with older versions */ |
| 187 |
| 188 /*! \deprecated Use EXIF_TAG_SUB_SEC_TIME instead. */ |
| 189 #define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME |
| 190 |
| 191 #ifdef __cplusplus |
| 192 } |
| 193 #endif /* __cplusplus */ |
| 194 |
| 195 #endif /* __EXIF_UTILS_H__ */ |
OLD | NEW |