exif-tag.c File Reference

#include <config.h>
#include <libexif/exif-tag.h>
#include <libexif/i18n.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

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

Defines

#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_GPS   { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }
#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.
ExifTag exif_tag_table_get_tag (unsigned int n)
 

For internal use only.


const char * exif_tag_table_get_name (unsigned int n)
 

For internal use only.


static int match_tag (const void *tag, const void *entry)
 Compares the tag with that in entry.
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.
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.
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.
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.
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.
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.
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.
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.

Variables

static struct TagEntry ExifTagTable []
 Table giving information about each EXIF tag.


Define Documentation

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

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

#define ESL_MMMM   { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }

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

#define ESL_MMMN   { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }

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

#define ESL_NNMM   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }

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

#define ESL_NNMN   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }

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

#define ESL_NNNM   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY }

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

#define ESL_NNNN   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED }

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

#define ESL_NNNO   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL }

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

#define ESL_NNOO   { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }

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

#define ESL_OMON   { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_NOT_RECORDED }

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

#define ESL_OOOO   { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }

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

#define RECORDED

Value:

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

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


Typedef Documentation

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

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


Function Documentation

ExifTag exif_tag_from_name ( const char *  name  ) 

Return the tag ID given its unique textual name.

Parameters:
[in] name tag 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 1082 of file exif-tag.c.

const char* exif_tag_get_description ( ExifTag  tag  ) 

Deprecated:
Use exif_tag_get_description_in_ifd instead

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

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] tag EXIF tag
[in] ifd IFD
Returns:
textual description of the tag, or NULL if the tag is unknown

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

Referenced by exif_tag_get_description().

const char* exif_tag_get_name ( ExifTag  tag  ) 

Deprecated:
Use exif_tag_get_name_in_ifd instead

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

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

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] tag EXIF tag
[in] ifd IFD
Returns:
textual name of the tag, or NULL if the tag is unknown

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

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

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

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

References EXIF_IFD_0, EXIF_IFD_1, EXIF_IFD_COUNT, EXIF_IFD_EXIF, EXIF_IFD_GPS, and EXIF_IFD_INTEROPERABILITY.

Referenced by exif_tag_get_description(), exif_tag_get_name(), and exif_tag_get_title().

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] tag EXIF tag
[in] ifd IFD or EXIF_IFD_COUNT
[in] t data type or EXIF_DATA_TYPE_UNKNOWN
Returns:
the level of support for this tag

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

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

const char* exif_tag_get_title ( ExifTag  tag  ) 

Deprecated:
Use exif_tag_get_title_in_ifd instead

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

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] tag EXIF tag
[in] ifd IFD
Returns:
textual title of the tag, or NULL if the tag is unknown

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

Referenced by exif_tag_get_title().

unsigned int exif_tag_table_count ( void   )  [inline]

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

For internal use only.

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

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

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] tag to find
Returns:
index into table, or -1 if not found

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

References exif_tag_table_count(), ExifTagTable, and match_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().

const char* exif_tag_table_get_name ( unsigned int  n  ) 

For internal use only.

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

Referenced by main().

ExifTag exif_tag_table_get_tag ( unsigned int  n  ) 

For internal use only.

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

Referenced by exif_content_fix(), and main().

static ExifSupportLevel get_support_level_any_type ( ExifTag  tag,
ExifIfd  ifd 
) [inline, static]

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] tag EXIF tag
[in] ifd a valid IFD (not EXIF_IFD_COUNT)
Returns:
the level of support for this tag

Definition at line 1137 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, and TagEntry::name.

Referenced by exif_tag_get_support_level_in_ifd().

static ExifSupportLevel get_support_level_in_ifd ( ExifTag  tag,
ExifIfd  ifd,
ExifDataType  t 
) [inline, static]

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] tag EXIF tag
[in] ifd a valid IFD (not EXIF_IFD_COUNT)
[in] t a valid data type (not EXIF_DATA_TYPE_UNKNOWN)
Returns:
the level of support for this tag

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

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

Referenced by exif_tag_get_support_level_in_ifd().

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

Compares the tag with that in entry.

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

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

Referenced by exif_tag_table_first().


Variable Documentation

struct TagEntry ExifTagTable[] [static]

Table giving information about each EXIF tag.

There may be more than one entry with the same tag value because some tags have different meanings depending on the IFD in which they appear. When there are such duplicate entries, there must be no overlap in their support levels. The entries MUST be sorted in tag order. The name and title are mandatory, but the description may be an empty string. None of the entries may be NULL except the final array terminator.

Referenced by exif_tag_from_name(), exif_tag_get_description_in_ifd(), exif_tag_get_name_in_ifd(), exif_tag_get_title_in_ifd(), exif_tag_table_count(), exif_tag_table_first(), exif_tag_table_get_name(), exif_tag_table_get_tag(), get_support_level_any_type(), and get_support_level_in_ifd().


SourceForge.net Logo Generated by doxygen