EXIF library (libexif) API 0.6.24

exif-utils.h
Go to the documentation of this file.
1
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 LIBEXIF_EXIF_UTILS_H
24#define LIBEXIF_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
34
35/* If these definitions don't work for you, please let us fix the
36 * macro generating _stdint.h */
37
39 typedef unsigned char ExifByte; /* 1 byte */
40
42 typedef signed char ExifSByte; /* 1 byte */
43
45 typedef char * ExifAscii;
46
48 typedef uint16_t ExifShort; /* 2 bytes */
49
51 typedef int16_t ExifSShort; /* 2 bytes */
52
54 typedef uint32_t ExifLong; /* 4 bytes */
55
57 typedef int32_t ExifSLong; /* 4 bytes */
58
60 typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
61
62 typedef char ExifUndefined; /* 1 byte */
63
65 typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
66
67
74 ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order);
75
82 ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order);
83
90 ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order);
91
98 ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order);
99
106 ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);
107
114 ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order);
115
122 void exif_set_short (unsigned char *b, ExifByteOrder order,
123 ExifShort value);
124
131 void exif_set_sshort (unsigned char *b, ExifByteOrder order,
132 ExifSShort value);
133
140 void exif_set_long (unsigned char *b, ExifByteOrder order,
141 ExifLong value);
142
149 void exif_set_slong (unsigned char *b, ExifByteOrder order,
150 ExifSLong value);
151
158 void exif_set_rational (unsigned char *b, ExifByteOrder order,
159 ExifRational value);
160
167 void exif_set_srational (unsigned char *b, ExifByteOrder order,
168 ExifSRational value);
169
171 void exif_convert_utf16_to_utf8 (char *out, const unsigned char *in, int maxlen);
172
173/* Please do not use this function outside of the library. */
174
176 void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int,
177 ExifByteOrder o_orig, ExifByteOrder o_new);
178
179#undef MIN
180#define MIN(a, b) (((a) < (b)) ? (a) : (b))
181
182#undef MAX
183#define MAX(a, b) (((a) > (b)) ? (a) : (b))
184
185/* For compatibility with older versions */
186
188#define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME
189
190#ifdef __cplusplus
191}
192#endif /* __cplusplus */
193
194#endif /* !defined(LIBEXIF_EXIF_UTILS_H) */
exif-byte-order.h
Defines the ExifByteOrder enum and the associated functions.
ExifByteOrder
ExifByteOrder
Which byte order to use.
Definition: exif-byte-order.h:31
exif-format.h
Handling native EXIF data types.
ExifFormat
ExifFormat
EXIF tag data formats.
Definition: exif-format.h:32
ExifSByte
signed char ExifSByte
EXIF Signed Byte data type.
Definition: exif-utils.h:42
exif_get_srational
ExifSRational exif_get_srational(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSRational value from memory.
Definition: exif-utils.c:177
ExifByte
unsigned char ExifByte
EXIF Unsigned Byte data type.
Definition: exif-utils.h:39
ExifLong
uint32_t ExifLong
EXIF Unsigned Long data type.
Definition: exif-utils.h:54
ExifSLong
int32_t ExifSLong
EXIF Signed Long data type.
Definition: exif-utils.h:57
ExifShort
uint16_t ExifShort
EXIF Unsigned Short data type.
Definition: exif-utils.h:48
exif_get_short
ExifShort exif_get_short(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifShort value from memory.
Definition: exif-utils.c:102
exif_get_slong
ExifSLong exif_get_slong(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSLong value from memory.
Definition: exif-utils.c:130
exif_set_sshort
void exif_set_sshort(unsigned char *b, ExifByteOrder order, ExifSShort value)
Store an ExifSShort value into memory in EXIF format.
Definition: exif-utils.c:108
ExifSShort
int16_t ExifSShort
EXIF Signed Short data type.
Definition: exif-utils.h:51
ExifAscii
char * ExifAscii
EXIF Text String data type.
Definition: exif-utils.h:45
exif_get_sshort
ExifSShort exif_get_sshort(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSShort value from memory.
Definition: exif-utils.c:87
exif_set_rational
void exif_set_rational(unsigned char *b, ExifByteOrder order, ExifRational value)
Store an ExifRational value into memory in EXIF format.
Definition: exif-utils.c:199
exif_set_srational
void exif_set_srational(unsigned char *b, ExifByteOrder order, ExifSRational value)
Store an ExifSRational value into memory in EXIF format.
Definition: exif-utils.c:208
exif_get_long
ExifLong exif_get_long(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifLong value from memory.
Definition: exif-utils.c:165
exif_set_long
void exif_set_long(unsigned char *b, ExifByteOrder order, ExifLong value)
Store an ExifLong value into memory in EXIF format.
Definition: exif-utils.c:171
exif_set_short
void exif_set_short(unsigned char *b, ExifByteOrder order, ExifShort value)
Store an ExifShort value into memory in EXIF format.
Definition: exif-utils.c:124
exif_set_slong
void exif_set_slong(unsigned char *b, ExifByteOrder order, ExifSLong value)
Store an ExifSLong value into memory in EXIF format.
Definition: exif-utils.c:145
exif_convert_utf16_to_utf8
void exif_convert_utf16_to_utf8(char *out, const unsigned char *in, int maxlen)
This function converts rather UCS-2LE than UTF-16 to UTF-8.
Definition: exif-utils.c:220
exif_get_rational
ExifRational exif_get_rational(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifRational value from memory.
Definition: exif-utils.c:188
ExifRational
EXIF Unsigned Rational data type.
Definition: exif-utils.h:60
ExifSRational
EXIF Signed Rational data type.
Definition: exif-utils.h:65