EXIF library (libexif) API  0.6.25
exif-data.h
Go to the documentation of this file.
1 
4 /*
5  * Copyright (c) 2001-2008 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_DATA_H
26 #define LIBEXIF_EXIF_DATA_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
33 #include <libexif/exif-data-type.h>
34 #include <libexif/exif-ifd.h>
35 #include <libexif/exif-log.h>
36 #include <libexif/exif-tag.h>
37 
39 typedef struct _ExifData ExifData;
40 typedef struct _ExifDataPrivate ExifDataPrivate;
41 
42 #include <libexif/exif-content.h>
44 #include <libexif/exif-mem.h>
45 
47 struct _ExifData
48 {
50  ExifContent *ifd[EXIF_IFD_COUNT];
51 
53  unsigned char *data;
54 
56  unsigned int size;
57 
58  ExifDataPrivate *priv;
59 };
60 
68 ExifData *exif_data_new (void);
69 
78 
85 ExifData *exif_data_new_from_file (const char *path);
86 
93 ExifData *exif_data_new_from_data (const unsigned char *data,
94  unsigned int size);
95 
107 void exif_data_load_data (ExifData *data, const unsigned char *d,
108  unsigned int size);
109 
120 void exif_data_save_data (ExifData *data, unsigned char **d,
121  unsigned int *ds);
122 
123 void exif_data_ref (ExifData *data);
124 void exif_data_unref (ExifData *data);
125 void exif_data_free (ExifData *data);
126 
133 
142 
152 
160 void exif_data_fix (ExifData *d);
161 
162 typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data);
163 
171  ExifDataForeachContentFunc func,
172  void *user_data);
173 
175 typedef enum {
178 
181 
185 
193 
201 
208 
215 
221 void exif_data_set_data_type (ExifData *d, ExifDataType dt);
222 
228 ExifDataType exif_data_get_data_type (ExifData *d);
229 
235 void exif_data_dump (ExifData *data);
236 
242 void exif_data_log (ExifData *data, ExifLog *log);
243 
252 #define exif_data_get_entry(d,t) \
253  (exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \
254  exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
255  exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \
256  exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \
257  exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \
258  exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \
259  exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \
260  exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \
261  exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \
262  exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)
263 
264 #ifdef __cplusplus
265 }
266 #endif /* __cplusplus */
267 
268 #endif /* !defined(LIBEXIF_EXIF_DATA_H) */
Act as though unknown tags are not present.
Definition: exif-data.h:177
void exif_data_log(ExifData *data, ExifLog *log)
Set the log message object for all IFDs.
Definition: exif-data.c:1240
ExifData * exif_data_new(void)
Allocate a new ExifData.
Definition: exif-data.c:98
void exif_data_fix(ExifData *d)
Fix the EXIF data to bring it into specification.
Definition: exif-data.c:1349
ExifByteOrder
Which byte order to use.
Definition: exif-byte-order.h:33
Definition: exif-content.h:42
Fix the EXIF tags to follow the spec.
Definition: exif-data.h:180
ExifData * exif_data_new_mem(ExifMem *)
Allocate a new ExifData using the given memory allocator.
Definition: exif-data.c:109
void exif_data_load_data(ExifData *data, const unsigned char *d, unsigned int size)
Load the ExifData structure from the raw JPEG or EXIF data in the given memory buffer.
Definition: exif-data.c:851
ExifByteOrder exif_data_get_byte_order(ExifData *data)
Return the byte order in use by this EXIF structure.
Definition: exif-data.c:1180
void exif_data_unset_option(ExifData *d, ExifDataOption o)
Clear the given option on the given ExifData.
Definition: exif-data.c:1312
struct _ExifMem ExifMem
ExifMem define a memory allocator.
Definition: exif-mem.h:59
unsigned char * data
Pointer to thumbnail image, or NULL if not available.
Definition: exif-data.h:53
void exif_data_foreach_content(ExifData *data, ExifDataForeachContentFunc func, void *user_data)
Execute a function on each IFD in turn.
Definition: exif-data.c:1189
Log message infrastructure.
Handling EXIF MakerNote tags.
Definition: exif-mnote-data-priv.h:62
ExifDataType exif_data_get_data_type(ExifData *d)
Return the data type for the given ExifData.
Definition: exif-data.c:1364
ExifData * exif_data_new_from_file(const char *path)
Allocate a new ExifData and load EXIF data from a JPEG file.
Definition: exif-data.c:1082
Handling EXIF tags.
Leave the MakerNote alone, which could cause it to be corrupted.
Definition: exif-data.h:183
void exif_data_save_data(ExifData *data, unsigned char **d, unsigned int *ds)
Store raw EXIF data representing the ExifData structure into a memory buffer.
Definition: exif-data.c:1037
void exif_data_set_byte_order(ExifData *data, ExifByteOrder order)
Set the byte order to use for this EXIF data.
Definition: exif-data.c:1224
ExifDataOption
Options to configure the behaviour of ExifData.
Definition: exif-data.h:175
Define the ExifMem data type and the associated functions.
ExifContent * ifd[EXIF_IFD_COUNT]
Data for each IFD.
Definition: exif-data.h:50
ExifData * exif_data_new_from_data(const unsigned char *data, unsigned int size)
Allocate a new ExifData and load EXIF data from a memory buffer.
Definition: exif-data.c:156
const char * exif_data_option_get_description(ExifDataOption o)
Return a verbose textual description of the given ExifDataOption.
Definition: exif-data.c:1292
void exif_data_set_data_type(ExifData *d, ExifDataType dt)
Set the data type for the given ExifData.
Definition: exif-data.c:1355
ExifMnoteData * exif_data_get_mnote_data(ExifData *d)
Return the MakerNote data out of the EXIF data.
Definition: exif-data.c:92
Represents the entire EXIF data found in an image.
Definition: exif-data.h:47
Handling EXIF IFDs.
void exif_data_dump(ExifData *data)
Dump all EXIF data to stdout.
Definition: exif-data.c:1153
unsigned int size
Number of bytes in thumbnail image at data.
Definition: exif-data.h:56
const char * exif_data_option_get_name(ExifDataOption o)
Return a short textual description of the given ExifDataOption.
Definition: exif-data.c:1281
Defines the ExifByteOrder enum and the associated functions.
struct _ExifLog ExifLog
State maintained by the logging interface.
Definition: exif-log.h:36
void exif_data_set_option(ExifData *d, ExifDataOption o)
Set the given option on the given ExifData.
Definition: exif-data.c:1303