EXIF library (libexif) API 0.6.25

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 * SPDX-License-Identifier: LGPL-2.0-or-later
23 */
24
25#ifndef LIBEXIF_EXIF_UTILS_H
26#define LIBEXIF_EXIF_UTILS_H
27
28#ifdef __cplusplus
29 extern "C" {
30#endif /* __cplusplus */
31
32#include <libexif/exif-byte-order.h>
33#include <libexif/exif-format.h>
34#include <libexif/_stdint.h>
35
36
37/* If these definitions don't work for you, please let us fix the
38 * macro generating _stdint.h */
39
41 typedef unsigned char ExifByte; /* 1 byte */
42
44 typedef signed char ExifSByte; /* 1 byte */
45
47 typedef char * ExifAscii;
48
50 typedef uint16_t ExifShort; /* 2 bytes */
51
53 typedef int16_t ExifSShort; /* 2 bytes */
54
56 typedef uint32_t ExifLong; /* 4 bytes */
57
59 typedef int32_t ExifSLong; /* 4 bytes */
60
62 typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
63
64 typedef char ExifUndefined; /* 1 byte */
65
67 typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
68
69
76 ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order);
77
84 ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order);
85
92 ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order);
93
100 ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order);
101
108 ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);
109
116 ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order);
117
124 void exif_set_short (unsigned char *b, ExifByteOrder order,
125 ExifShort value);
126
133 void exif_set_sshort (unsigned char *b, ExifByteOrder order,
134 ExifSShort value);
135
142 void exif_set_long (unsigned char *b, ExifByteOrder order,
143 ExifLong value);
144
151 void exif_set_slong (unsigned char *b, ExifByteOrder order,
152 ExifSLong value);
153
160 void exif_set_rational (unsigned char *b, ExifByteOrder order,
161 ExifRational value);
162
169 void exif_set_srational (unsigned char *b, ExifByteOrder order,
170 ExifSRational value);
171
173 void exif_convert_utf16_to_utf8 (char *out, const unsigned char *in, int maxlen);
174
175/* Please do not use this function outside of the library. */
176
178 void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int,
179 ExifByteOrder o_orig, ExifByteOrder o_new);
180
181#undef MIN
182#define MIN(a, b) (((a) < (b)) ? (a) : (b))
183
184#undef MAX
185#define MAX(a, b) (((a) > (b)) ? (a) : (b))
186
187/* For compatibility with older versions */
188
190#define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME
191
192#ifdef __cplusplus
193}
194#endif /* __cplusplus */
195
196#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:33
exif-format.h
Handling native EXIF data types.
ExifFormat
ExifFormat
EXIF tag data formats.
Definition exif-format.h:34
ExifSByte
signed char ExifSByte
EXIF Signed Byte data type.
Definition exif-utils.h:44
exif_get_srational
ExifSRational exif_get_srational(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSRational value from memory.
Definition exif-utils.c:179
ExifByte
unsigned char ExifByte
EXIF Unsigned Byte data type.
Definition exif-utils.h:41
ExifLong
uint32_t ExifLong
EXIF Unsigned Long data type.
Definition exif-utils.h:56
ExifSLong
int32_t ExifSLong
EXIF Signed Long data type.
Definition exif-utils.h:59
ExifShort
uint16_t ExifShort
EXIF Unsigned Short data type.
Definition exif-utils.h:50
exif_get_short
ExifShort exif_get_short(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifShort value from memory.
Definition exif-utils.c:104
exif_get_slong
ExifSLong exif_get_slong(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSLong value from memory.
Definition exif-utils.c:132
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:110
ExifSShort
int16_t ExifSShort
EXIF Signed Short data type.
Definition exif-utils.h:53
ExifAscii
char * ExifAscii
EXIF Text String data type.
Definition exif-utils.h:47
exif_get_sshort
ExifSShort exif_get_sshort(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSShort value from memory.
Definition exif-utils.c:89
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:201
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:210
exif_get_long
ExifLong exif_get_long(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifLong value from memory.
Definition exif-utils.c:167
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:173
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:126
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:147
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:222
exif_get_rational
ExifRational exif_get_rational(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifRational value from memory.
Definition exif-utils.c:190
ExifRational
EXIF Unsigned Rational data type.
Definition exif-utils.h:62
ExifSRational
EXIF Signed Rational data type.
Definition exif-utils.h:67