EXIF library (libexif) API 0.6.22
exif-data.h File Reference

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

#include <libexif/exifutil.h>
#include <libexif/exifbyte.h>
#include <libexif/exifdata.h>
#include <libexif/exififd.h>
#include <libexif/exiflog.h>
#include <libexif/exiftag.h>
#include <libexif/exifcont.h>
#include <libexif/exifnote.h>
#include <libexif/exifmem.h>

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.
 

Typedefs

typedef struct _ExifData ExifData
 Represents the entire EXIF data found in an image.
 
typedef struct _ExifDataPrivate ExifDataPrivate
 
typedef void EXIF_CALLBACK(* 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 , 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

 EXIF_API (ExifData *) exif_data_new(void)
 Allocate a new ExifData.
 
 EXIF_API (void) exif_data_load_data(ExifData *data
 Load the ExifData structure from the raw JPEG or EXIF data in the given memory buffer.
 
 EXIF_API (ExifByteOrder) exif_data_get_byte_order(ExifData *data)
 Return the byte order in use by this EXIF structure.
 
 exif_enum (ExifByteOrder) order)
 
 EXIF_API (ExifMnoteData *) exif_data_get_mnote_data(ExifData *d)
 Return the MakerNote data out of the EXIF data.
 
 EXIF_API (const char *) exif_data_option_get_name(exif_enum(ExifDataOption) o)
 Return a short textual description of the given ExifDataOption.
 
 exif_enum (ExifDataOption) o)
 
 exif_enum (ExifDataType) dt)
 
 EXIF_API (ExifDataType) exif_data_get_data_type(ExifData *d)
 Return the data type for the given ExifData.
 

Variables

uint32_t size
 
const unsigned char * d
 
unsigned char uint32_t * ds
 
ExifDataForeachContentFunc func
 
ExifDataForeachContentFunc void * user_data
 
ExifLog * log
 

Detailed Description

Defines the ExifData type and the associated functions.

Macro Definition Documentation

◆ exif_data_get_entry

#define exif_data_get_entry (   d,
 
)
Value:
(exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \
exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)

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

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.

Function Documentation

◆ EXIF_API() [1/6]

EXIF_API ( const char *  )

Return a short textual description of the given ExifDataOption.

Return a verbose textual description of the given ExifDataOption.

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

Return a short textual description of the given ExifDataOption.

Return a short, localized, textual name for the given byte order.

This is meant for display to the user. The format of each tag is subject to change between locales and in newer versions of libexif. Users who require the tag data in an unambiguous form should access the data members of the ExifEntry structure directly.

Warning
The character set of the returned string may be in the encoding of the current locale or the native encoding of the camera.
Bug:
The EXIF_TAG_XP_* tags are currently always returned in UTF-8, regardless of locale, and code points above U+FFFF are not supported.
Parameters
[in]entryEXIF entry
[out]valbuffer in which to store value; if entry is valid and maxlen > 0 then this string will be NUL-terminated
[in]maxlenlength of the buffer val
Returns
val pointer

Return a short textual description of the given ExifDataOption.

Return a short, localized, textual name for the given byte order.

Returns verbose textual description of the given MakerNote tag.

Returns textual title of the given MakerNote tag.

The name is a short, unique (within this type of MakerNote), non-localized text string containing only US-ASCII alphanumeric characters.

Parameters
[in]dMakerNote data
[in]nindex of the entry within the MakerNote data
Returns
textual name of the tag or NULL on error

The title is a short, localized textual description of the tag.

Parameters
[in]dMakerNote data
[in]nindex of the entry within the MakerNote data
Returns
textual name of the tag or NULL on error
Parameters
[in]dMakerNote data
[in]nindex of the entry within the MakerNote data
Returns
textual description of the tag or NULL on error

Return a short textual description of the given ExifDataOption.

Return a short, localized, textual name for the given byte order.

Return a verbose textual description of the given tag when found in the given IFD.

Return a textual title of the given tag when found in the given IFD.

The name is a short, unique, non-localized text string containing only US-ASCII alphanumeric characters.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual name of the tag, or NULL if the tag is unknown

The title is a short, localized description of the tag.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual title of the tag, or NULL if the tag is unknown

The description is a verbose, localized description of the tag.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual description of the tag, or NULL if the tag is unknown
Deprecated:
Use exif_tag_get_name_in_ifd instead
Deprecated:
Use exif_tag_get_title_in_ifd instead
Deprecated:
Use exif_tag_get_description_in_ifd instead

Return a short textual description of the given ExifDataOption.

Return a short, localized, textual name for the given byte order.

This is meant for display to the user. The format of each tag is subject to change between locales and in newer versions of libexif. Users who require the tag data in an unambiguous form should access the data members of the ExifEntry structure directly.

Warning
The character set of the returned string may be in the encoding of the current locale or the native encoding of the camera.
Bug:
The EXIF_TAG_XP_* tags are currently always returned in UTF-8, regardless of locale, and code points above U+FFFF are not supported.
Parameters
[in]entryEXIF entry
[out]valbuffer in which to store value; if entry is valid and maxlen > 0 then this string will be NUL-terminated
[in]maxlenlength of the buffer val
Returns
val pointer

Return a short textual description of the given ExifDataOption.

Return a short, localized, textual name for the given byte order.

Return a verbose textual description of the given tag when found in the given IFD.

Return a textual title of the given tag when found in the given IFD.

The name is a short, unique, non-localized text string containing only US-ASCII alphanumeric characters.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual name of the tag, or NULL if the tag is unknown

The title is a short, localized description of the tag.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual title of the tag, or NULL if the tag is unknown

The description is a verbose, localized description of the tag.

Parameters
[in]tagEXIF tag
[in]ifdIFD
Returns
textual description of the tag, or NULL if the tag is unknown
Deprecated:
Use exif_tag_get_name_in_ifd instead
Deprecated:
Use exif_tag_get_title_in_ifd instead
Deprecated:
Use exif_tag_get_description_in_ifd instead

◆ EXIF_API() [2/6]

EXIF_API ( ExifByteOrder  )

Return the byte order in use by this EXIF structure.

Parameters
[in]dataEXIF data
Returns
byte order

◆ EXIF_API() [3/6]

EXIF_API ( ExifData )

Allocate a new ExifData.

Create an ExifData from the data in the loader.

Allocate a new ExifData and load EXIF data from a memory buffer.

Allocate a new ExifData and load EXIF data from a JPEG file.

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

Uses an ExifLoader internally to do the loading.

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

◆ EXIF_API() [4/6]

EXIF_API ( ExifDataType  )

Return the data type for the given ExifData.

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

◆ EXIF_API() [5/6]

EXIF_API ( ExifMnoteData )

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

◆ EXIF_API() [6/6]

EXIF_API ( void  )

Load the ExifData structure from the raw JPEG or EXIF data in the given memory buffer.

Set the log message object for all IFDs.

Dump all EXIF data to stdout.

Set the data type for the given ExifData.

Clear the given option on the given ExifData.

Set the given option on the given ExifData.

Execute a function on each IFD in turn.

Fix the EXIF data to bring it into specification.

Set the byte order to use for this EXIF data.

Store raw EXIF data representing the ExifData structure into a 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

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

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

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
[in]dataEXIF data over which to iterate
[in]funcfunction to call for each entry
[in]user_datadata to pass into func on each call
[in]dEXIF data
[in]ooption
[in]dEXIF data
[in]dtdata type

This is intended for diagnostic purposes only.

Parameters
[in]dataEXIF data
[in]dataEXIF data
[in]logExifLog