EXIF library (libexif) API 0.6.22

exif-data.h
Go to the documentation of this file.
1
4 /*
5 * \author Lutz Mueller <lutz@users.sourceforge.net>
6 * \date 2001-2005
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 */
23
24 #ifndef __EXIF_DATA_H__
25 #define __EXIF_DATA_H__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 #include <libexif/exif-byte-order.h>
32 #include <libexif/exif-data-type.h>
33 #include <libexif/exif-ifd.h>
34 #include <libexif/exif-log.h>
35 #include <libexif/exif-tag.h>
36
38 typedef struct _ExifData ExifData;
39 typedef struct _ExifDataPrivate ExifDataPrivate;
40
41 #include <libexif/exif-content.h>
42 #include <libexif/exif-mnote-data.h>
43 #include <libexif/exif-mem.h>
44
46 struct _ExifData
47 {
49 ExifContent *ifd[EXIF_IFD_COUNT];
50
52 unsigned char *data;
53
55 unsigned int size;
56
57 ExifDataPrivate *priv;
58 };
59
67 ExifData *exif_data_new (void);
68
76 ExifData *exif_data_new_mem (ExifMem *);
77
84 ExifData *exif_data_new_from_file (const char *path);
85
92 ExifData *exif_data_new_from_data (const unsigned char *data,
93 unsigned int size);
94
106 void exif_data_load_data (ExifData *data, const unsigned char *d,
107 unsigned int size);
108
119 void exif_data_save_data (ExifData *data, unsigned char **d,
120 unsigned int *ds);
121
122 void exif_data_ref (ExifData *data);
123 void exif_data_unref (ExifData *data);
124 void exif_data_free (ExifData *data);
125
131 ExifByteOrder exif_data_get_byte_order (ExifData *data);
132
140 void exif_data_set_byte_order (ExifData *data, ExifByteOrder order);
141
150 ExifMnoteData *exif_data_get_mnote_data (ExifData *d);
151
159 void exif_data_fix (ExifData *d);
160
161 typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data);
162
169 void exif_data_foreach_content (ExifData *data,
170 ExifDataForeachContentFunc func,
171 void *user_data);
172
174 typedef enum {
176 EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0,
177
179 EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1,
180
182 EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2
183 } ExifDataOption;
184
191 const char *exif_data_option_get_name (ExifDataOption o);
192
199 const char *exif_data_option_get_description (ExifDataOption o);
200
206 void exif_data_set_option (ExifData *d, ExifDataOption o);
207
213 void exif_data_unset_option (ExifData *d, ExifDataOption o);
214
220 void exif_data_set_data_type (ExifData *d, ExifDataType dt);
221
227 ExifDataType exif_data_get_data_type (ExifData *d);
228
234 void exif_data_dump (ExifData *data);
235
241 void exif_data_log (ExifData *data, ExifLog *log);
242
251 #define exif_data_get_entry(d,t) \
252 (exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \
253 exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
254 exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \
255 exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \
256 exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \
257 exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \
258 exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \
259 exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \
260 exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \
261 exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)
262
263 #ifdef __cplusplus
264 }
265 #endif /* __cplusplus */
266
267 #endif /* __EXIF_DATA_H__ */
_ExifEntry::components
unsigned long components
Number of elements in the array, if this is an array entry.
Definition: exif-entry.h:52
_ExifEntry
Data found in one EXIF tag.
Definition: exif-entry.h:43
exif_content_foreach_entry
void exif_content_foreach_entry(ExifContent *content, ExifContentForeachEntryFunc func, void *user_data)
Executes function on each EXIF tag in this IFD in turn.
Definition: exif-content.c:216
_ExifEntry::tag
ExifTag tag
EXIF tag for this entry.
Definition: exif-entry.h:45
exif_data_foreach_content
void exif_data_foreach_content(ExifData *data, ExifDataForeachContentFunc func, void *user_data)
Execute a function on each IFD in turn.
Definition: exif-data.c:1157
exif-loader.h
Defines the ExifLoader type.
EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE
@ EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE
Leave the MakerNote alone, which could cause it to be corrupted.
Definition: exif-data.h:182
exif_content_remove_entry
void exif_content_remove_entry(ExifContent *c, ExifEntry *e)
Remove an EXIF tag from an IFD.
Definition: exif-content.c:163
exif_data_option_get_description
const char * exif_data_option_get_description(ExifDataOption o)
Return a verbose textual description of the given ExifDataOption.
Definition: exif-data.c:1260
ExifDataOption
ExifDataOption
Options to configure the behaviour of ExifData.
Definition: exif-data.h:174
exif_data_get_byte_order
ExifByteOrder exif_data_get_byte_order(ExifData *data)
Return the byte order in use by this EXIF structure.
Definition: exif-data.c:1148
exif_loader_new
ExifLoader * exif_loader_new(void)
Allocate a new ExifLoader.
Definition: exif-loader.c:317
exif-system.h
System specific definitions, not for installation!
exif_mem_new_default
ExifMem * exif_mem_new_default(void)
Create a new ExifMem with default values for your convenience.
Definition: exif-mem.c:95
exif_content_add_entry
void exif_content_add_entry(ExifContent *c, ExifEntry *entry)
Add an EXIF tag to an IFD.
Definition: exif-content.c:139
ExifTag
ExifTag
EXIF tags.
Definition: exif-tag.h:34
_ExifEntry::data
unsigned char * data
Pointer to the raw EXIF data for this entry.
Definition: exif-entry.h:57
exif_data_unset_option
void exif_data_unset_option(ExifData *d, ExifDataOption o)
Clear the given option on the given ExifData.
Definition: exif-data.c:1280
ExifLog
struct _ExifLog ExifLog
State maintained by the logging interface.
Definition: exif-log.h:34
_ExifContent
Definition: exif-content.h:41
exif_data_new_mem
ExifData * exif_data_new_mem(ExifMem *)
Allocate a new ExifData using the given memory allocator.
Definition: exif-data.c:104
ExifShort
uint16_t ExifShort
EXIF Unsigned Short data type.
Definition: exif-utils.h:48
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_data_set_option
void exif_data_set_option(ExifData *d, ExifDataOption o)
Set the given option on the given ExifData.
Definition: exif-data.c:1271
exif-mnote-data.h
Handling EXIF MakerNote tags.
EXIF_BYTE_ORDER_MOTOROLA
@ EXIF_BYTE_ORDER_MOTOROLA
Big-endian byte order.
Definition: exif-byte-order.h:33
_ExifMnoteData
Definition: exif-mnote-data-priv.h:61
EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS
@ EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS
Act as though unknown tags are not present.
Definition: exif-data.h:176
exif_data_new_from_file
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:1050
exif_data_load_data
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:837
exif_tag_get_name
const char * exif_tag_get_name(ExifTag tag)
Definition: exif-tag.c:1110
exif-byte-order.h
Defines the ExifByteOrder enum and the associated functions.
_ExifData::data
unsigned char * data
Pointer to thumbnail image, or NULL if not available.
Definition: exif-data.h:52
exif_tag_get_name_in_ifd
const char * exif_tag_get_name_in_ifd(ExifTag tag, ExifIfd ifd)
Return a textual name of the given tag when found in the given IFD.
Definition: exif-tag.c:1001
exif_mnote_data_save
void exif_mnote_data_save(ExifMnoteData *d, unsigned char **buf, unsigned int *buf_size)
Save the raw MakerNote data into a memory buffer.
Definition: exif-mnote-data.c:88
exif-utils.h
EXIF data manipulation functions and types.
exif_mem_unref
void exif_mem_unref(ExifMem *)
Unrefcount an ExifMem.
Definition: exif-mem.c:61
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_data_set_data_type
void exif_data_set_data_type(ExifData *d, ExifDataType dt)
Set the data type for the given ExifData.
Definition: exif-data.c:1323
exif_data_save_data
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:1005
exif_loader_unref
void exif_loader_unref(ExifLoader *loader)
Decrease the refcount of the ExifLoader.
Definition: exif-loader.c:369
EXIF_DATA_OPTION_FOLLOW_SPECIFICATION
@ EXIF_DATA_OPTION_FOLLOW_SPECIFICATION
Fix the EXIF tags to follow the spec.
Definition: exif-data.h:179
exif_content_unref
void exif_content_unref(ExifContent *content)
Decrease reference counter for ExifContent.
Definition: exif-content.c:88
exif_data_log
void exif_data_log(ExifData *data, ExifLog *log)
Set the log message object for all IFDs.
Definition: exif-data.c:1208
exif_data_new
ExifData * exif_data_new(void)
Allocate a new ExifData.
Definition: exif-data.c:93
exif_data_dump
void exif_data_dump(ExifData *data)
Dump all EXIF data to stdout.
Definition: exif-data.c:1121
exif_content_fix
void exif_content_fix(ExifContent *c)
Fix the IFD to bring it into specification.
Definition: exif-content.c:284
exif_mnote_data_load
void exif_mnote_data_load(ExifMnoteData *d, const unsigned char *buf, unsigned int buf_size)
Load the MakerNote data from a memory buffer.
Definition: exif-mnote-data.c:80
exif-content.h
Handling EXIF IFDs.
exif_content_dump
void exif_content_dump(ExifContent *content, unsigned int indent)
Dump contents of the IFD to stdout.
Definition: exif-content.c:120
exif_data_fix
void exif_data_fix(ExifData *d)
Fix the EXIF data to bring it into specification.
Definition: exif-data.c:1317
exif-log.h
Log message infrastructure.
exif_entry_unref
void exif_entry_unref(ExifEntry *entry)
Decrease reference counter for ExifEntry.
Definition: exif-entry.c:145
EXIF_BYTE_ORDER_INTEL
@ EXIF_BYTE_ORDER_INTEL
Little-endian byte order.
Definition: exif-byte-order.h:35
exif_content_new_mem
ExifContent * exif_content_new_mem(ExifMem *)
Reserve memory for and initialize new ExifContent using the specified memory allocator.
Definition: exif-content.c:54
exif-tag.h
Handling EXIF tags.
_ExifEntry::format
ExifFormat format
Type of data in this entry.
Definition: exif-entry.h:48
ExifLoader
struct _ExifLoader ExifLoader
Data used by the loader interface.
Definition: exif-loader.h:35
_ExifContent::parent
ExifData * parent
Data containing this content.
Definition: exif-content.h:46
exif_format_get_size
unsigned char exif_format_get_size(ExifFormat format)
Return the raw size of the given EXIF data type.
Definition: exif-format.c:66
exif_loader_get_data
ExifData * exif_loader_get_data(ExifLoader *loader)
Create an ExifData from the data in the loader.
Definition: exif-loader.c:391
exif_get_short
ExifShort exif_get_short(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifShort value from memory.
Definition: exif-utils.c:102
_ExifData::size
unsigned int size
Number of bytes in thumbnail image at data.
Definition: exif-data.h:55
exif_entry_new_mem
ExifEntry * exif_entry_new_mem(ExifMem *)
Reserve memory for and initialize new ExifEntry using the specified memory allocator.
Definition: exif-entry.c:120
exif_data_get_entry
#define exif_data_get_entry(d, t)
Return an ExifEntry for the given tag if found in any IFD.
Definition: exif-data.h:251
exif_data_get_data_type
ExifDataType exif_data_get_data_type(ExifData *d)
Return the data type for the given ExifData.
Definition: exif-data.c:1332
exif_content_get_ifd
ExifIfd exif_content_get_ifd(ExifContent *c)
Return the IFD number in which the given ExifContent is found.
Definition: exif-content.c:240
ExifByteOrder
ExifByteOrder
Which byte order to use.
Definition: exif-byte-order.h:31
exif_data_option_get_name
const char * exif_data_option_get_name(ExifDataOption o)
Return a short textual description of the given ExifDataOption.
Definition: exif-data.c:1249
exif_data_new_from_data
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:151
exif_data_get_mnote_data
ExifMnoteData * exif_data_get_mnote_data(ExifData *d)
Return the MakerNote data out of the EXIF data.
Definition: exif-data.c:87
ExifMem
struct _ExifMem ExifMem
ExifMem define a memory allocator.
Definition: exif-mem.h:57
exif-mem.h
Define the ExifMem data type and the associated functions.
_ExifEntry::size
unsigned int size
Number of bytes in the buffer at data.
Definition: exif-entry.h:61
exif_content_log
void exif_content_log(ExifContent *content, ExifLog *log)
Set the log message object for this IFD.
Definition: exif-content.c:229
exif-data.h
Defines the ExifData type and the associated functions.
exif_loader_write_file
void exif_loader_write_file(ExifLoader *loader, const char *fname)
Load a file into the given ExifLoader from the filesystem.
Definition: exif-loader.c:107
ExifLong
uint32_t ExifLong
EXIF Unsigned Long data type.
Definition: exif-utils.h:54
_ExifData
Represents the entire EXIF data found in an image.
Definition: exif-data.h:47
_ExifData::ifd
ExifContent * ifd[EXIF_IFD_COUNT]
Data for each IFD.
Definition: exif-data.h:49
exif_data_set_byte_order
void exif_data_set_byte_order(ExifData *data, ExifByteOrder order)
Set the byte order to use for this EXIF data.
Definition: exif-data.c:1192
exif_mem_ref
void exif_mem_ref(ExifMem *)
Refcount an ExifMem.
Definition: exif-mem.c:54
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