EXIF library (libexif) Internals  0.6.24
exif-data.h File Reference

Defines the ExifData type and the associated functions. More...

Include dependency graph for exif-data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _ExifData
 Represents the entire EXIF data found in an image. More...
 

Macros

#define exif_data_get_entry(d, t)
 Return an ExifEntry for the given tag if found in any IFD. More...
 

Typedefs

typedef struct _ExifData ExifData
 Represents the entire EXIF data found in an image. More...
 
typedef struct _ExifDataPrivate ExifDataPrivate
 
typedef void(* ExifDataForeachContentFunc) (ExifContent *, void *user_data)
 

Enumerations

enum  ExifDataOption { EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0 , EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1 , EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2 }
 Options to configure the behaviour of ExifData. More...
 

Functions

ExifDataexif_data_new (void)
 Allocate a new ExifData. More...
 
ExifDataexif_data_new_mem (ExifMem *)
 Allocate a new ExifData using the given memory allocator. More...
 
ExifDataexif_data_new_from_file (const char *path)
 Allocate a new ExifData and load EXIF data from a JPEG file. More...
 
ExifDataexif_data_new_from_data (const unsigned char *data, unsigned int size)
 Allocate a new ExifData and load EXIF data from a memory buffer. More...
 
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. More...
 
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. More...
 
void exif_data_ref (ExifData *data)
 
void exif_data_unref (ExifData *data)
 
void exif_data_free (ExifData *data)
 
ExifByteOrder exif_data_get_byte_order (ExifData *data)
 Return the byte order in use by this EXIF structure. More...
 
void exif_data_set_byte_order (ExifData *data, ExifByteOrder order)
 Set the byte order to use for this EXIF data. More...
 
ExifMnoteDataexif_data_get_mnote_data (ExifData *d)
 Return the MakerNote data out of the EXIF data. More...
 
void exif_data_fix (ExifData *d)
 Fix the EXIF data to bring it into specification. More...
 
void exif_data_foreach_content (ExifData *data, ExifDataForeachContentFunc func, void *user_data)
 Execute a function on each IFD in turn. More...
 
const char * exif_data_option_get_name (ExifDataOption o)
 Return a short textual description of the given ExifDataOption. More...
 
const char * exif_data_option_get_description (ExifDataOption o)
 Return a verbose textual description of the given ExifDataOption. More...
 
void exif_data_set_option (ExifData *d, ExifDataOption o)
 Set the given option on the given ExifData. More...
 
void exif_data_unset_option (ExifData *d, ExifDataOption o)
 Clear the given option on the given ExifData. More...
 
void exif_data_set_data_type (ExifData *d, ExifDataType dt)
 Set the data type for the given ExifData. More...
 
ExifDataType exif_data_get_data_type (ExifData *d)
 Return the data type for the given ExifData. More...
 
void exif_data_dump (ExifData *data)
 Dump all EXIF data to stdout. More...
 
void exif_data_log (ExifData *data, ExifLog *log)
 Set the log message object for all IFDs. More...
 

Detailed Description

Defines the ExifData type and the associated functions.

Definition in file exif-data.h.

Macro Definition Documentation

◆ exif_data_get_entry

#define exif_data_get_entry (   d,
 
)
Value:
exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
ExifEntry * exif_content_get_entry(ExifContent *content, ExifTag tag)
Return the ExifEntry in this IFD corresponding to the given tag.
Definition: exif-content.c:202
ExifIfd ifd
Definition: exif-ifd.c:28
@ EXIF_IFD_GPS
Definition: exif-ifd.h:33
@ EXIF_IFD_INTEROPERABILITY
Definition: exif-ifd.h:34
@ EXIF_IFD_EXIF
Definition: exif-ifd.h:32
@ EXIF_IFD_1
Definition: exif-ifd.h:31
@ EXIF_IFD_0
Definition: exif-ifd.h:30

Return an ExifEntry for the given tag if found in any IFD.

Each IFD is searched in turn and the first containing a tag with this number is returned.

Parameters
[in]dExifData
[in]tExifTag
Returns
ExifEntry* if found, else NULL if not found

Definition at line 251 of file exif-data.h.

Typedef Documentation

◆ ExifData

typedef struct _ExifData ExifData

Represents the entire EXIF data found in an image.

Definition at line 1 of file exif-data.h.

◆ ExifDataForeachContentFunc

typedef void(* ExifDataForeachContentFunc) (ExifContent *, void *user_data)

Definition at line 161 of file exif-data.h.

◆ ExifDataPrivate

Definition at line 1 of file exif-data.h.

Enumeration Type Documentation

◆ ExifDataOption

Options to configure the behaviour of ExifData.

Enumerator
EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS 

Act as though unknown tags are not present.

EXIF_DATA_OPTION_FOLLOW_SPECIFICATION 

Fix the EXIF tags to follow the spec.

EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE 

Leave the MakerNote alone, which could cause it to be corrupted.

Definition at line 174 of file exif-data.h.

Function Documentation

◆ exif_data_dump()

void exif_data_dump ( ExifData data)

Dump all EXIF data to stdout.

This is intended for diagnostic purposes only.

Parameters
[in]dataEXIF data

Definition at line 1146 of file exif-data.c.

References _ExifContent::count, _ExifData::data, exif_content_dump(), EXIF_IFD_COUNT, exif_ifd_get_name(), _ExifData::ifd, and _ExifData::size.

Referenced by data_null_test(), and main().

Here is the call graph for this function:

◆ exif_data_fix()

void exif_data_fix ( ExifData d)

Fix the EXIF data to bring it into specification.

Call exif_content_fix on each IFD to fix existing entries, create any new entries that are mandatory but do not yet exist, and remove any entries that are not allowed.

Parameters
[in,out]dEXIF data

Definition at line 1342 of file exif-data.c.

References exif_data_foreach_content(), and fix_func().

Referenced by data_null_test(), entry_null_test(), exif_data_load_data(), and main().

Here is the call graph for this function:

◆ exif_data_foreach_content()

void exif_data_foreach_content ( ExifData data,
ExifDataForeachContentFunc  func,
void *  user_data 
)

Execute a function on each IFD in turn.

Parameters
[in]dataEXIF data over which to iterate
[in]funcfunction to call for each entry
[in]user_datadata to pass into func on each call

Definition at line 1182 of file exif-data.c.

Referenced by data_null_test(), exif_data_fix(), exif_data_set_byte_order(), main(), and test_parse().

◆ exif_data_free()

void exif_data_free ( ExifData data)

Definition at line 1109 of file exif-data.c.

References _ExifData::data, exif_content_unref(), EXIF_IFD_COUNT, exif_log_unref(), exif_mem_free(), exif_mem_unref(), exif_mnote_data_unref(), _ExifData::ifd, _ExifDataPrivate::log, _ExifDataPrivate::md, _ExifDataPrivate::mem, and _ExifData::priv.

Referenced by exif_data_new_mem(), and exif_data_unref().

Here is the call graph for this function:

◆ exif_data_get_byte_order()

ExifByteOrder exif_data_get_byte_order ( ExifData data)

Return the byte order in use by this EXIF structure.

Parameters
[in]dataEXIF data
Returns
byte order

Definition at line 1173 of file exif-data.c.

References _ExifDataPrivate::order, and _ExifData::priv.

Referenced by data_null_test(), exif_entry_fix(), exif_entry_format_value(), exif_entry_get_value(), exif_entry_initialize(), main(), test_exif_data(), and test_parse().

◆ exif_data_get_data_type()

ExifDataType exif_data_get_data_type ( ExifData d)

Return the data type for the given ExifData.

Parameters
[in]dEXIF data
Returns
data type, or EXIF_DATA_TYPE_UNKNOWN on error

Definition at line 1357 of file exif-data.c.

References _ExifDataPrivate::data_type, EXIF_DATA_TYPE_UNKNOWN, and _ExifData::priv.

Referenced by data_null_test(), exif_content_fix(), and remove_not_recorded().

◆ exif_data_get_mnote_data()

ExifMnoteData* exif_data_get_mnote_data ( ExifData d)

Return the MakerNote data out of the EXIF data.

Only certain MakerNote formats that are recognized by libexif are supported. The pointer references a member of the ExifData structure and must NOT be freed by the caller.

Parameters
[in]dEXIF data
Returns
MakerNote data, or NULL if not found or not supported

Definition at line 90 of file exif-data.c.

References _ExifDataPrivate::md, and _ExifData::priv.

Referenced by data_null_test(), dump_makernote(), and test_exif_data().

◆ 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.

If the EXIF data contains a recognized MakerNote, it is loaded and stored as well for later retrieval by exif_data_get_mnote_data. If the EXIF_DATA_OPTION_FOLLOW_SPECIFICATION option has been set on this ExifData, then the tags are automatically fixed after loading (by calling exif_data_fix).

Parameters
[in,out]dataEXIF data
[in]dpointer to raw JPEG or EXIF data
[in]sizenumber of bytes of data at d

Definition at line 844 of file exif-data.c.

References _, EXIF_BYTE_ORDER_INTEL, EXIF_BYTE_ORDER_MOTOROLA, exif_data_fix(), exif_data_load_data_content(), EXIF_DATA_OPTION_FOLLOW_SPECIFICATION, exif_get_long(), exif_get_short(), EXIF_IFD_0, EXIF_IFD_1, exif_log(), EXIF_LOG_CODE_CORRUPT_DATA, EXIF_LOG_CODE_DEBUG, ExifHeader, interpret_maker_note(), JPEG_MARKER_APP1, JPEG_MARKER_SOI, _ExifDataPrivate::log, LOG_TOO_SMALL, _ExifDataPrivate::options, _ExifDataPrivate::order, and _ExifData::priv.

Referenced by data_null_test(), exif_data_new_from_data(), and exif_loader_get_data().

Here is the call graph for this function:

◆ exif_data_log()

void exif_data_log ( ExifData data,
ExifLog log 
)

Set the log message object for all IFDs.

Parameters
[in]dataEXIF data
[in]logExifLog

Definition at line 1233 of file exif-data.c.

References exif_content_log(), EXIF_IFD_COUNT, exif_log_ref(), exif_log_unref(), _ExifData::ifd, _ExifDataPrivate::log, and _ExifData::priv.

Referenced by data_null_test(), exif_loader_get_data(), main(), and test_parse().

Here is the call graph for this function:

◆ exif_data_new()

ExifData* exif_data_new ( void  )

Allocate a new ExifData.

The ExifData contains an empty ExifContent for each IFD and the default set of options, which has EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS and EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.

Returns
allocated ExifData, or NULL on error

Definition at line 96 of file exif-data.c.

References exif_data_new_mem(), exif_mem_new_default(), and exif_mem_unref().

Referenced by data_null_test(), entry_null_test(), exif_data_new_from_data(), and main().

Here is the call graph for this function:

◆ 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.

Parameters
[in]datapointer to raw JPEG or EXIF data
[in]sizenumber of bytes of data at data
Returns
allocated ExifData, or NULL on error

Definition at line 154 of file exif-data.c.

References exif_data_load_data(), exif_data_new(), and size.

Referenced by data_null_test(), main(), and test_parse().

Here is the call graph for this function:

◆ 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.

Uses an ExifLoader internally to do the loading.

Parameters
[in]pathfilename including path
Returns
allocated ExifData, or NULL on error

Definition at line 1075 of file exif-data.c.

References exif_loader_get_data(), exif_loader_new(), exif_loader_unref(), and exif_loader_write_file().

Referenced by main(), and test_parse().

Here is the call graph for this function:

◆ exif_data_new_mem()

ExifData* exif_data_new_mem ( ExifMem mem)

Allocate a new ExifData using the given memory allocator.

The ExifData contains an empty ExifContent for each IFD and the default set of options, which has EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS and EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.

Returns
allocated ExifData, or NULL on error

Definition at line 107 of file exif-data.c.

References exif_content_new_mem(), exif_data_free(), EXIF_DATA_OPTION_FOLLOW_SPECIFICATION, EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS, exif_data_set_data_type(), exif_data_set_option(), EXIF_DATA_TYPE_COUNT, EXIF_IFD_COUNT, exif_mem_alloc(), exif_mem_free(), exif_mem_ref(), _ExifData::ifd, _ExifDataPrivate::mem, _ExifContent::parent, _ExifData::priv, and _ExifDataPrivate::ref_count.

Referenced by data_null_test(), exif_data_new(), and exif_loader_get_data().

Here is the call graph for this function:

◆ exif_data_option_get_description()

const char* exif_data_option_get_description ( ExifDataOption  o)

Return a verbose textual description of the given ExifDataOption.

Parameters
[in]ooption
Returns
verbose localized textual description of the option, or NULL if unknown

Definition at line 1285 of file exif-data.c.

References _, description, exif_data_option, and option.

◆ exif_data_option_get_name()

const char* exif_data_option_get_name ( ExifDataOption  o)

Return a short textual description of the given ExifDataOption.

Parameters
[in]ooption
Returns
localized textual description of the option, or NULL if unknown

Definition at line 1274 of file exif-data.c.

References _, exif_data_option, name, and option.

◆ exif_data_ref()

void exif_data_ref ( ExifData data)

Definition at line 1089 of file exif-data.c.

References _ExifData::priv, and _ExifDataPrivate::ref_count.

Referenced by data_null_test().

◆ 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.

The buffer is allocated by this function and must subsequently be freed by the caller using the matching free function as used by the ExifMem in use by this ExifData.

Parameters
[in]dataEXIF data
[out]dpointer to buffer pointer containing raw EXIF data on return
[out]dspointer to variable to hold the number of bytes of data at d, or set to 0 on error

Definition at line 1030 of file exif-data.c.

References EXIF_BYTE_ORDER_INTEL, exif_data_alloc(), exif_data_save_data_content(), EXIF_IFD_0, exif_log(), EXIF_LOG_CODE_DEBUG, exif_set_long(), exif_set_short(), ExifHeader, _ExifData::ifd, _ExifDataPrivate::log, _ExifDataPrivate::order, and _ExifData::priv.

Referenced by data_null_test(), main(), and test_parse().

Here is the call graph for this function:

◆ 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.

If any tags already exist (including MakerNote tags) they are are converted to the specified byte order.

Parameters
[in,out]dataEXIF data
[in]orderbyte order

Definition at line 1217 of file exif-data.c.

References content_set_byte_order(), exif_data_foreach_content(), exif_mnote_data_set_byte_order(), _ExifDataPrivate::md, _ByteOrderChangeData::new, _ByteOrderChangeData::old, _ExifDataPrivate::order, and _ExifData::priv.

Referenced by data_null_test(), main(), and test_parse().

Here is the call graph for this function:

◆ exif_data_set_data_type()

void exif_data_set_data_type ( ExifData d,
ExifDataType  dt 
)

Set the data type for the given ExifData.

Parameters
[in]dEXIF data
[in]dtdata type

Definition at line 1348 of file exif-data.c.

References _ExifDataPrivate::data_type, and _ExifData::priv.

Referenced by data_null_test(), exif_data_new_mem(), and main().

◆ exif_data_set_option()

void exif_data_set_option ( ExifData d,
ExifDataOption  o 
)

Set the given option on the given ExifData.

Parameters
[in]dEXIF data
[in]ooption

Definition at line 1296 of file exif-data.c.

References _ExifDataPrivate::options, and _ExifData::priv.

Referenced by data_null_test(), and exif_data_new_mem().

◆ exif_data_unref()

void exif_data_unref ( ExifData data)

Definition at line 1098 of file exif-data.c.

References exif_data_free(), _ExifData::priv, and _ExifDataPrivate::ref_count.

Referenced by data_null_test(), entry_null_test(), main(), test_exif_data(), and test_parse().

Here is the call graph for this function:

◆ exif_data_unset_option()

void exif_data_unset_option ( ExifData d,
ExifDataOption  o 
)

Clear the given option on the given ExifData.

Parameters
[in]dEXIF data
[in]ooption

Definition at line 1305 of file exif-data.c.

References _ExifDataPrivate::options, and _ExifData::priv.

Referenced by data_null_test().


libexif Generated by doxygen