EXIF library (libexif) Internals  0.6.24
exif-tag.c File Reference
#include <config.h>
#include <libexif/exif-tag.h>
#include <libexif/i18n.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for exif-tag.c:

Go to the source code of this file.

Data Structures

struct  TagEntry
 Table giving information about each EXIF tag. More...
 

Macros

#define ESL_NNNN   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
 
#define ESL_OOOO   { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }
 
#define ESL_MMMN   { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
 
#define ESL_MMMM   { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }
 
#define ESL_OMON   { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
 
#define ESL_NNOO   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }
 
#define ESL_NNMN   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
 
#define ESL_NNMM   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }
 
#define ESL_NNNM   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY }
 
#define ESL_NNNO   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL }
 
#define ESL_UUUU   { EXIF_SUPPORT_LEVEL_UNKNOWN, EXIF_SUPPORT_LEVEL_UNKNOWN, EXIF_SUPPORT_LEVEL_UNKNOWN, EXIF_SUPPORT_LEVEL_UNKNOWN }
 
#define ESL_GPS   { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }
 
#define ESL_UNKNOWN   { ESL_UUUU, ESL_UUUU, ESL_UUUU, ESL_UUUU, ESL_UUUU }
 
#define RECORDED
 

Typedefs

typedef const char *(* get_stuff_func) (ExifTag tag, ExifIfd ifd)
 

Functions

unsigned int exif_tag_table_count (void)
 Return the number of entries in the EXIF tag table, including the terminating NULL entry. More...
 
ExifTag exif_tag_table_get_tag (unsigned int n)
 
const char * exif_tag_table_get_name (unsigned int n)
 
static int match_tag (const void *tag, const void *entry)
 Compares the tag with that in entry. More...
 
static int exif_tag_table_first (ExifTag tag)
 Finds the first entry in the EXIF tag table with the given tag number using a binary search. More...
 
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. More...
 
const char * exif_tag_get_title_in_ifd (ExifTag tag, ExifIfd ifd)
 Return a textual title of the given tag when found in the given IFD. More...
 
const char * exif_tag_get_description_in_ifd (ExifTag tag, ExifIfd ifd)
 Return a verbose textual description of the given tag when found in the given IFD. More...
 
static const char * exif_tag_get_stuff (ExifTag tag, get_stuff_func func)
 
const char * exif_tag_get_name (ExifTag tag)
 
const char * exif_tag_get_title (ExifTag tag)
 
const char * exif_tag_get_description (ExifTag tag)
 
ExifTag exif_tag_from_name (const char *name)
 Return the tag ID given its unique textual name. More...
 
static ExifSupportLevel get_support_level_in_ifd (ExifTag tag, ExifIfd ifd, ExifDataType t)
 Return the support level of a tag in the given IFD with the given data type. More...
 
static ExifSupportLevel get_support_level_any_type (ExifTag tag, ExifIfd ifd)
 Return the support level of a tag in the given IFD, regardless of the data type. More...
 
ExifSupportLevel exif_tag_get_support_level_in_ifd (ExifTag tag, ExifIfd ifd, ExifDataType t)
 Return whether the given tag is mandatory or not in the given IFD and data type according to the EXIF specification. More...
 

Variables

static const struct TagEntry ExifTagTable []
 

Macro Definition Documentation

◆ ESL_GPS

#define ESL_GPS   { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }

Definition at line 40 of file exif-tag.c.

◆ ESL_MMMM

◆ ESL_MMMN

◆ ESL_NNMM

◆ ESL_NNMN

◆ ESL_NNNM

◆ ESL_NNNN

◆ ESL_NNNO

◆ ESL_NNOO

◆ ESL_OMON

◆ ESL_OOOO

◆ ESL_UNKNOWN

#define ESL_UNKNOWN   { ESL_UUUU, ESL_UUUU, ESL_UUUU, ESL_UUUU, ESL_UUUU }

Definition at line 41 of file exif-tag.c.

◆ ESL_UUUU

◆ RECORDED

#define RECORDED
Value:
@ EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR
@ EXIF_DATA_TYPE_COMPRESSED
@ EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY
@ EXIF_DATA_TYPE_UNCOMPRESSED_YCC
ExifIfd ifd
Definition: exif-ifd.c:28
static const struct TagEntry ExifTagTable[]
@ EXIF_SUPPORT_LEVEL_NOT_RECORDED
This tag is not allowed in the given IFD.
Definition: exif-tag.h:213
ExifSupportLevel esl[EXIF_IFD_COUNT][EXIF_DATA_TYPE_COUNT]
indexed by the types [ExifIfd][ExifDataType]
Definition: exif-tag.c:61

Definition at line 1031 of file exif-tag.c.

Typedef Documentation

◆ get_stuff_func

typedef const char*(* get_stuff_func) (ExifTag tag, ExifIfd ifd)

Definition at line 1122 of file exif-tag.c.

Function Documentation

◆ exif_tag_from_name()

ExifTag exif_tag_from_name ( const char *  name)

Return the tag ID given its unique textual name.

Parameters
[in]nametag name
Returns
tag ID, or 0 if tag not found
Note
The tag not found value cannot be distinguished from a legitimate tag number 0.

Definition at line 1167 of file exif-tag.c.

References ExifTagTable, name, TagEntry::name, and TagEntry::tag.

◆ exif_tag_get_description()

const char* exif_tag_get_description ( ExifTag  tag)
Deprecated:
Use exif_tag_get_description_in_ifd instead

Definition at line 1159 of file exif-tag.c.

References exif_tag_get_description_in_ifd(), exif_tag_get_stuff(), and tag.

Here is the call graph for this function:

◆ exif_tag_get_description_in_ifd()

const char* exif_tag_get_description_in_ifd ( ExifTag  tag,
ExifIfd  ifd 
)

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

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

Definition at line 1083 of file exif-tag.c.

References _, bindtextdomain, description, EXIF_IFD_COUNT, exif_tag_table_first(), ExifTagTable, ifd, TagEntry::name, RECORDED, and tag.

Referenced by exif_tag_get_description().

Here is the call graph for this function:

◆ exif_tag_get_name()

const char* exif_tag_get_name ( ExifTag  tag)
Deprecated:
Use exif_tag_get_name_in_ifd instead

Definition at line 1147 of file exif-tag.c.

References exif_tag_get_name_in_ifd(), exif_tag_get_stuff(), and tag.

Referenced by content_foreach_func(), exif_content_add_entry(), exif_data_load_data_content(), and exif_data_load_data_entry().

Here is the call graph for this function:

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

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

Definition at line 1038 of file exif-tag.c.

References EXIF_IFD_COUNT, exif_tag_table_first(), ExifTagTable, ifd, TagEntry::name, RECORDED, and tag.

Referenced by exif_content_fix(), exif_data_load_data_content(), exif_entry_dump(), exif_entry_fix(), exif_tag_get_name(), and name().

Here is the call graph for this function:

◆ exif_tag_get_stuff()

static const char* exif_tag_get_stuff ( ExifTag  tag,
get_stuff_func  func 
)
static

◆ exif_tag_get_support_level_in_ifd()

ExifSupportLevel exif_tag_get_support_level_in_ifd ( ExifTag  tag,
ExifIfd  ifd,
ExifDataType  t 
)

Return whether the given tag is mandatory or not in the given IFD and data type according to the EXIF specification.

If the IFD given is EXIF_IFD_COUNT, the result is EXIF_SUPPORT_LEVEL_UNKNOWN. If the data type is EXIF_DATA_TYPE_UNKNOWN, the result is EXIF_SUPPORT_LEVEL_UNKNOWN unless the support level is the same for all data types.

Parameters
[in]tagEXIF tag
[in]ifdIFD or EXIF_IFD_COUNT
[in]tdata type or EXIF_DATA_TYPE_UNKNOWN
Returns
the level of support for this tag

Definition at line 1256 of file exif-tag.c.

References EXIF_DATA_TYPE_COUNT, EXIF_IFD_COUNT, EXIF_SUPPORT_LEVEL_UNKNOWN, get_support_level_any_type(), get_support_level_in_ifd(), ifd, and tag.

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

Here is the call graph for this function:

◆ exif_tag_get_title()

const char* exif_tag_get_title ( ExifTag  tag)
Deprecated:
Use exif_tag_get_title_in_ifd instead

Definition at line 1153 of file exif-tag.c.

References exif_tag_get_stuff(), exif_tag_get_title_in_ifd(), and tag.

Here is the call graph for this function:

◆ exif_tag_get_title_in_ifd()

const char* exif_tag_get_title_in_ifd ( ExifTag  tag,
ExifIfd  ifd 
)

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

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

Definition at line 1060 of file exif-tag.c.

References _, bindtextdomain, EXIF_IFD_COUNT, exif_tag_table_first(), ExifTagTable, ifd, TagEntry::name, RECORDED, tag, and title.

Referenced by exif_tag_get_title().

Here is the call graph for this function:

◆ exif_tag_table_count()

unsigned int exif_tag_table_count ( void  )

Return the number of entries in the EXIF tag table, including the terminating NULL entry.

Definition at line 973 of file exif-tag.c.

References ExifTagTable.

Referenced by exif_content_fix(), exif_tag_table_first(), exif_tag_table_get_name(), exif_tag_table_get_tag(), and main().

◆ exif_tag_table_first()

static int exif_tag_table_first ( ExifTag  tag)
static

Finds the first entry in the EXIF tag table with the given tag number using a binary search.

Parameters
[in]tagto find
Returns
index into table, or -1 if not found

Definition at line 1011 of file exif-tag.c.

References exif_tag_table_count(), ExifTagTable, match_tag(), and tag.

Referenced by exif_tag_get_description_in_ifd(), exif_tag_get_name_in_ifd(), exif_tag_get_title_in_ifd(), get_support_level_any_type(), and get_support_level_in_ifd().

Here is the call graph for this function:

◆ exif_tag_table_get_name()

const char* exif_tag_table_get_name ( unsigned int  n)

Definition at line 986 of file exif-tag.c.

References exif_tag_table_count(), ExifTagTable, and TagEntry::name.

Referenced by main().

Here is the call graph for this function:

◆ exif_tag_table_get_tag()

ExifTag exif_tag_table_get_tag ( unsigned int  n)

Definition at line 980 of file exif-tag.c.

References exif_tag_table_count(), ExifTagTable, and TagEntry::tag.

Referenced by exif_content_fix(), and main().

Here is the call graph for this function:

◆ get_support_level_any_type()

static ExifSupportLevel get_support_level_any_type ( ExifTag  tag,
ExifIfd  ifd 
)
inlinestatic

Return the support level of a tag in the given IFD, regardless of the data type.

If the support level varies depending on the data type, this function returns EXIF_SUPPORT_LEVEL_UNKNOWN. If the tag is not specified in the EXIF standard, this function returns EXIF_SUPPORT_LEVEL_UNKNOWN.

Parameters
[in]tagEXIF tag
[in]ifda valid IFD (not EXIF_IFD_COUNT)
Returns
the level of support for this tag

Definition at line 1222 of file exif-tag.c.

References TagEntry::esl, EXIF_DATA_TYPE_COUNT, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_UNKNOWN, exif_tag_table_first(), ExifTagTable, ifd, TagEntry::name, and tag.

Referenced by exif_tag_get_support_level_in_ifd().

Here is the call graph for this function:

◆ get_support_level_in_ifd()

static ExifSupportLevel get_support_level_in_ifd ( ExifTag  tag,
ExifIfd  ifd,
ExifDataType  t 
)
inlinestatic

Return the support level of a tag in the given IFD with the given data type.

If the tag is not specified in the EXIF standard, this function returns EXIF_SUPPORT_LEVEL_NOT_RECORDED.

Parameters
[in]tagEXIF tag
[in]ifda valid IFD (not EXIF_IFD_COUNT)
[in]ta valid data type (not EXIF_DATA_TYPE_UNKNOWN)
Returns
the level of support for this tag

Definition at line 1192 of file exif-tag.c.

References TagEntry::esl, EXIF_SUPPORT_LEVEL_NOT_RECORDED, exif_tag_table_first(), ExifTagTable, ifd, TagEntry::name, and tag.

Referenced by exif_tag_get_support_level_in_ifd().

Here is the call graph for this function:

◆ match_tag()

static int match_tag ( const void *  tag,
const void *  entry 
)
static

Compares the tag with that in entry.

Parameters
[in]tagpointer to integer tag value
[in]entrypointer to a struct TagEntry
Returns
0 if tags are equal, <0 if tag < entry, >0 if tag > entry

Definition at line 998 of file exif-tag.c.

References tag.

Referenced by exif_tag_table_first().

Variable Documentation

◆ ExifTagTable


libexif Generated by doxygen