Home | History | Annotate | Download | only in libexif
      1 /* exif-tag.c
      2  *
      3  * Copyright (c) 2001 Lutz Mueller <lutz (at) users.sourceforge.net>
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Lesser General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Lesser General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Lesser General Public
     16  * License along with this library; if not, write to the
     17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA  02110-1301  USA.
     19  */
     20 
     21 #include <config.h>
     22 
     23 #include <libexif/exif-tag.h>
     24 #include <libexif/i18n.h>
     25 
     26 #include <stdlib.h>
     27 #include <string.h>
     28 
     29 #define ESL_NNNN { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
     30 #define ESL_OOOO { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }
     31 #define ESL_MMMN { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
     32 #define ESL_MMMM { EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }
     33 #define ESL_OMON { EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
     34 #define ESL_NNOO { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL, EXIF_SUPPORT_LEVEL_OPTIONAL }
     35 #define ESL_NNMN { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_NOT_RECORDED }
     36 #define ESL_NNMM { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY, EXIF_SUPPORT_LEVEL_MANDATORY }
     37 #define ESL_NNNM { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_MANDATORY }
     38 #define ESL_NNNO { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL }
     39 #define ESL_GPS { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }
     40 
     41 /*!
     42  * Table giving information about each EXIF tag.
     43  * There may be more than one entry with the same tag value because some tags
     44  * have different meanings depending on the IFD in which they appear.
     45  * When there are such duplicate entries, there must be no overlap in their
     46  * support levels.
     47  * The entries MUST be sorted in tag order.
     48  * The name and title are mandatory, but the description may be an empty
     49  * string. None of the entries may be NULL except the final array terminator.
     50  */
     51 static const struct TagEntry {
     52 	/*! Tag ID. There may be duplicate tags when the same number is used for
     53 	 * different meanings in different IFDs. */
     54 	ExifTag tag;
     55 	const char *name;
     56 	const char *title;
     57 	const char *description;
     58 	/*! indexed by the types [ExifIfd][ExifDataType] */
     59 	ExifSupportLevel esl[EXIF_IFD_COUNT][EXIF_DATA_TYPE_COUNT];
     60 } ExifTagTable[] = {
     61 #ifndef NO_VERBOSE_TAG_STRINGS
     62 	{EXIF_TAG_GPS_VERSION_ID, "GPSVersionID", N_("GPS Tag Version"),
     63 	 N_("Indicates the version of <GPSInfoIFD>. The version is given "
     64 	    "as 2.0.0.0. This tag is mandatory when <GPSInfo> tag is "
     65 	    "present. (Note: The <GPSVersionID> tag is given in bytes, "
     66 	    "unlike the <ExifVersion> tag. When the version is "
     67 	    "2.0.0.0, the tag value is 02000000.H)."), ESL_GPS},
     68 	{EXIF_TAG_INTEROPERABILITY_INDEX, "InteroperabilityIndex",
     69 	 N_("Interoperability Index"),
     70 	 N_("Indicates the identification of the Interoperability rule. "
     71 	    "Use \"R98\" for stating ExifR98 Rules. Four bytes used "
     72 	    "including the termination code (NULL). see the separate "
     73 	    "volume of Recommended Exif Interoperability Rules (ExifR98) "
     74 	    "for other tags used for ExifR98."),
     75 	 { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO } },
     76 	{EXIF_TAG_GPS_LATITUDE_REF, "GPSLatitudeRef", N_("North or South Latitude"),
     77 	 N_("Indicates whether the latitude is north or south latitude. The "
     78 	    "ASCII value 'N' indicates north latitude, and 'S' is south "
     79 	    "latitude."), ESL_GPS},
     80 	{EXIF_TAG_INTEROPERABILITY_VERSION, "InteroperabilityVersion",
     81 	 N_("Interoperability Version"), "",
     82 	 { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO } },
     83 	{EXIF_TAG_GPS_LATITUDE, "GPSLatitude", N_("Latitude"),
     84 	 N_("Indicates the latitude. The latitude is expressed as three "
     85 	    "RATIONAL values giving the degrees, minutes, and seconds, "
     86 	    "respectively. When degrees, minutes and seconds are expressed, "
     87 	    "the format is dd/1,mm/1,ss/1. When degrees and minutes are used "
     88 	    "and, for example, fractions of minutes are given up to two "
     89 	    "decimal places, the format is dd/1,mmmm/100,0/1."),
     90 	 ESL_GPS},
     91 	{EXIF_TAG_GPS_LONGITUDE_REF, "GPSLongitudeRef", N_("East or West Longitude"),
     92 	 N_("Indicates whether the longitude is east or west longitude. "
     93 	    "ASCII 'E' indicates east longitude, and 'W' is west "
     94 	    "longitude."), ESL_GPS},
     95 	{EXIF_TAG_GPS_LONGITUDE, "GPSLongitude", N_("Longitude"),
     96 	 N_("Indicates the longitude. The longitude is expressed as three "
     97 	    "RATIONAL values giving the degrees, minutes, and seconds, "
     98 	    "respectively. When degrees, minutes and seconds are expressed, "
     99 	    "the format is ddd/1,mm/1,ss/1. When degrees and minutes are "
    100 	    "used and, for example, fractions of minutes are given up to "
    101 	    "two decimal places, the format is ddd/1,mmmm/100,0/1."),
    102 	 ESL_GPS},
    103 	{EXIF_TAG_GPS_ALTITUDE_REF, "GPSAltitudeRef", N_("Altitude Reference"),
    104 	 N_("Indicates the altitude used as the reference altitude. If the "
    105 	    "reference is sea level and the altitude is above sea level, 0 "
    106 	    "is given. If the altitude is below sea level, a value of 1 is given "
    107 	    "and the altitude is indicated as an absolute value in the "
    108 	    "GSPAltitude tag. The reference unit is meters. Note that this tag "
    109 	    "is BYTE type, unlike other reference tags."), ESL_GPS},
    110 	{EXIF_TAG_GPS_ALTITUDE, "GPSAltitude", N_("Altitude"),
    111 	 N_("Indicates the altitude based on the reference in GPSAltitudeRef. "
    112 	    "Altitude is expressed as one RATIONAL value. The reference unit "
    113 	    "is meters."), ESL_GPS},
    114 	{EXIF_TAG_GPS_TIME_STAMP, "GPSTimeStamp", N_("GPS Time (Atomic Clock)"),
    115          N_("Indicates the time as UTC (Coordinated Universal Time). "
    116 	    "TimeStamp is expressed as three RATIONAL values giving "
    117             "the hour, minute, and second."), ESL_GPS},
    118 	{EXIF_TAG_GPS_SATELLITES, "GPSSatellites", N_("GPS Satellites"),
    119          N_("Indicates the GPS satellites used for measurements. This "
    120             "tag can be used to describe the number of satellites, their ID "
    121             "number, angle of elevation, azimuth, SNR and other information "
    122             "in ASCII notation. The format is not specified. If the GPS "
    123             "receiver is incapable of taking measurements, value of the tag "
    124             "shall be set to NULL."), ESL_GPS},
    125 	{EXIF_TAG_GPS_STATUS, "GPSStatus", N_("GPS Receiver Status"),
    126          N_("Indicates the status of the GPS receiver when the image is "
    127             "recorded. 'A' means measurement is in progress, and 'V' means "
    128             "the measurement is Interoperability."), ESL_GPS},
    129 	{EXIF_TAG_GPS_MEASURE_MODE, "GPSMeasureMode", N_("GPS Measurement Mode"),
    130          N_("Indicates the GPS measurement mode. '2' means "
    131             "two-dimensional measurement and '3' means three-dimensional "
    132             "measurement is in progress."), ESL_GPS},
    133 	{EXIF_TAG_GPS_DOP, "GPSDOP", N_("Measurement Precision"),
    134          N_("Indicates the GPS DOP (data degree of precision). An HDOP "
    135             "value is written during two-dimensional measurement, and PDOP "
    136             "during three-dimensional measurement."), ESL_GPS},
    137 	{EXIF_TAG_GPS_SPEED_REF, "GPSSpeedRef", N_("Speed Unit"),
    138          N_("Indicates the unit used to express the GPS receiver speed "
    139             "of movement. 'K', 'M' and 'N' represent kilometers per hour, "
    140             "miles per hour, and knots."), ESL_GPS},
    141 	{EXIF_TAG_GPS_SPEED, "GPSSpeed", N_("Speed of GPS Receiver"),
    142 	 N_("Indicates the speed of GPS receiver movement."), ESL_GPS},
    143 	{EXIF_TAG_GPS_TRACK_REF, "GPSTrackRef", N_("Reference for direction of movement"),
    144          N_("Indicates the reference for giving the direction of GPS "
    145             "receiver movement. 'T' denotes true direction and 'M' is "
    146             "magnetic direction."), ESL_GPS},
    147 	{EXIF_TAG_GPS_TRACK, "GPSTrack", N_("Direction of Movement"),
    148          N_("Indicates the direction of GPS receiver movement. The range "
    149             "of values is from 0.00 to 359.99."), ESL_GPS},
    150 	{EXIF_TAG_GPS_IMG_DIRECTION_REF, "GPSImgDirectionRef", N_("GPS Image Direction Reference"),
    151 	 N_("Indicates the reference for giving the direction of the image when it is captured. "
    152 	    "'T' denotes true direction and 'M' is magnetic direction."), ESL_GPS},
    153 	{EXIF_TAG_GPS_IMG_DIRECTION, "GPSImgDirection", N_("GPS Image Direction"),
    154 	 N_("Indicates the direction of the image when it was captured. The range of values is "
    155 	    "from 0.00 to 359.99."), ESL_GPS},
    156 	{EXIF_TAG_GPS_MAP_DATUM, "GPSMapDatum", N_("Geodetic Survey Data Used"),
    157          N_("Indicates the geodetic survey data used by the GPS "
    158             "receiver. If the survey data is restricted to Japan, the value "
    159             "of this tag is 'TOKYO' or 'WGS-84'. If a GPS Info tag is "
    160             "recorded, it is strongly recommended that this tag be recorded."), ESL_GPS},
    161 	{EXIF_TAG_GPS_DEST_LATITUDE_REF, "GPSDestLatitudeRef", N_("Reference For Latitude of Destination"),
    162          N_("Indicates whether the latitude of the destination point is "
    163             "north or south latitude. The ASCII value 'N' indicates north "
    164             "latitude, and 'S' is south latitude."), ESL_GPS},
    165 	{EXIF_TAG_GPS_DEST_LATITUDE, "GPSDestLatitude", N_("Latitude of Destination"),
    166          N_("Indicates the latitude of the destination point. The "
    167             "latitude is expressed as three RATIONAL values giving the "
    168             "degrees, minutes, and seconds, respectively. If latitude is "
    169             "expressed as degrees, minutes and seconds, a typical format "
    170             "would be dd/1,mm/1,ss/1. When degrees and minutes are used and, "
    171             "for example, fractions of minutes are given up to two decimal "
    172             "places, the format would be dd/1,mmmm/100,0/1."), ESL_GPS},
    173 	{EXIF_TAG_GPS_DEST_LONGITUDE_REF, "GPSDestLongitudeRef", N_("Reference for Longitude of Destination"),
    174          N_("Indicates whether the longitude of the destination point is "
    175             "east or west longitude. ASCII 'E' indicates east longitude, and "
    176             "'W' is west longitude."), ESL_GPS},
    177 	{EXIF_TAG_GPS_DEST_LONGITUDE, "GPSDestLongitude", N_("Longitude of Destination"),
    178          N_("Indicates the longitude of the destination point. The "
    179             "longitude is expressed as three RATIONAL values giving the "
    180             "degrees, minutes, and seconds, respectively. If longitude is "
    181             "expressed as degrees, minutes and seconds, a typical format "
    182             "would be ddd/1,mm/1,ss/1. When degrees and minutes are used "
    183             "and, for example, fractions of minutes are given up to two "
    184             "decimal places, the format would be ddd/1,mmmm/100,0/1."),
    185          ESL_GPS},
    186 	{EXIF_TAG_GPS_DEST_BEARING_REF, "GPSDestBearingRef", N_("Reference for Bearing of Destination"),
    187          N_("Indicates the reference used for giving the bearing to "
    188             "the destination point. 'T' denotes true direction and 'M' is "
    189             "magnetic direction."), ESL_GPS},
    190 	{EXIF_TAG_GPS_DEST_BEARING, "GPSDestBearing", N_("Bearing of Destination"),
    191          N_("Indicates the bearing to the destination point. The range "
    192             "of values is from 0.00 to 359.99."), ESL_GPS},
    193 	{EXIF_TAG_GPS_DEST_DISTANCE_REF, "GPSDestDistanceRef", N_("Reference for Distance to Destination"),
    194          N_("Indicates the unit used to express the distance to the "
    195             "destination point. 'K', 'M' and 'N' represent kilometers, miles "
    196             "and nautical miles."), ESL_GPS},
    197 	{EXIF_TAG_GPS_DEST_DISTANCE, "GPSDestDistance", N_("Distance to Destination"),
    198 	 N_("Indicates the distance to the destination point."), ESL_GPS},
    199 	{EXIF_TAG_GPS_PROCESSING_METHOD, "GPSProcessingMethod", N_("Name of GPS Processing Method"),
    200          N_("A character string recording the name of the method used "
    201             "for location finding. The first byte indicates the character "
    202             "code used, and this is followed by the name "
    203             "of the method. Since the Type is not ASCII, NULL termination is "
    204             "not necessary."), ESL_GPS},
    205 	{EXIF_TAG_GPS_AREA_INFORMATION, "GPSAreaInformation", N_("Name of GPS Area"),
    206          N_("A character string recording the name of the GPS area. The "
    207             "first byte indicates the character code used, "
    208             "and this is followed by the name of the GPS area. Since "
    209             "the Type is not ASCII, NULL termination is not necessary."), ESL_GPS},
    210 	{EXIF_TAG_GPS_DATE_STAMP, "GPSDateStamp", N_("GPS Date"),
    211          N_("A character string recording date and time information "
    212             "relative to UTC (Coordinated Universal Time). The format is "
    213             "\"YYYY:MM:DD\". The length of the string is 11 bytes including "
    214             "NULL."), ESL_GPS},
    215 	{EXIF_TAG_GPS_DIFFERENTIAL, "GPSDifferential", N_("GPS Differential Correction"),
    216          N_("Indicates whether differential correction is applied to the "
    217             "GPS receiver."), ESL_GPS},
    218 	/* Not in EXIF 2.2 */
    219 	{EXIF_TAG_NEW_SUBFILE_TYPE, "NewSubfileType",
    220 	 N_("New Subfile Type"), N_("A general indication of the kind of data "
    221 	    "contained in this subfile.")},
    222 	{EXIF_TAG_IMAGE_WIDTH, "ImageWidth", N_("Image Width"),
    223 	 N_("The number of columns of image data, equal to the number of "
    224 	    "pixels per row. In JPEG compressed data a JPEG marker is "
    225 	    "used instead of this tag."),
    226 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    227 	{EXIF_TAG_IMAGE_LENGTH, "ImageLength", N_("Image Length"),
    228 	 N_("The number of rows of image data. In JPEG compressed data a "
    229 	    "JPEG marker is used instead of this tag."),
    230 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    231 	{EXIF_TAG_BITS_PER_SAMPLE, "BitsPerSample", N_("Bits per Sample"),
    232 	 N_("The number of bits per image component. In this standard each "
    233 	    "component of the image is 8 bits, so the value for this "
    234 	    "tag is 8. See also <SamplesPerPixel>. In JPEG compressed data "
    235 	    "a JPEG marker is used instead of this tag."),
    236 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    237 	{EXIF_TAG_COMPRESSION, "Compression", N_("Compression"),
    238 	 N_("The compression scheme used for the image data. When a "
    239 	    "primary image is JPEG compressed, this designation is "
    240 	    "not necessary and is omitted. When thumbnails use JPEG "
    241 	    "compression, this tag value is set to 6."),
    242 	 { ESL_MMMN, ESL_MMMM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    243 	{EXIF_TAG_PHOTOMETRIC_INTERPRETATION, "PhotometricInterpretation",
    244 	 N_("Photometric Interpretation"),
    245 	 N_("The pixel composition. In JPEG compressed data a JPEG "
    246 	    "marker is used instead of this tag."),
    247 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    248 	/* Not in EXIF 2.2 */
    249 	{EXIF_TAG_FILL_ORDER, "FillOrder", N_("Fill Order"), ""},
    250 	/* Not in EXIF 2.2 */
    251 	{EXIF_TAG_DOCUMENT_NAME, "DocumentName", N_("Document Name"), ""},
    252 	{EXIF_TAG_IMAGE_DESCRIPTION, "ImageDescription",
    253 	 N_("Image Description"),
    254 	 N_("A character string giving the title of the image. It may be "
    255 	    "a comment such as \"1988 company picnic\" or "
    256 	    "the like. Two-bytes character codes cannot be used. "
    257 	    "When a 2-bytes code is necessary, the Exif Private tag "
    258 	    "<UserComment> is to be used."),
    259 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    260 	{EXIF_TAG_MAKE, "Make", N_("Manufacturer"),
    261 	 N_("The manufacturer of the recording "
    262 	    "equipment. This is the manufacturer of the DSC, scanner, "
    263 	    "video digitizer or other equipment that generated the "
    264 	    "image. When the field is left blank, it is treated as "
    265 	    "unknown."),
    266 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    267 	{EXIF_TAG_MODEL, "Model", N_("Model"),
    268 	 N_("The model name or model number of the equipment. This is the "
    269 	    "model name or number of the DSC, scanner, video digitizer "
    270 	    "or other equipment that generated the image. When the field "
    271 	    "is left blank, it is treated as unknown."),
    272 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    273 	{EXIF_TAG_STRIP_OFFSETS, "StripOffsets", N_("Strip Offsets"),
    274 	 N_("For each strip, the byte offset of that strip. It is "
    275 	    "recommended that this be selected so the number of strip "
    276 	    "bytes does not exceed 64 Kbytes. With JPEG compressed "
    277 	    "data this designation is not needed and is omitted. See also "
    278 	    "<RowsPerStrip> and <StripByteCounts>."),
    279 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    280 	{EXIF_TAG_ORIENTATION, "Orientation", N_("Orientation"),
    281 	 N_("The image orientation viewed in terms of rows and columns."),
    282 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    283 	{EXIF_TAG_SAMPLES_PER_PIXEL, "SamplesPerPixel",
    284 	 N_("Samples per Pixel"),
    285 	 N_("The number of components per pixel. Since this standard applies "
    286 	    "to RGB and YCbCr images, the value set for this tag is 3. "
    287 	    "In JPEG compressed data a JPEG marker is used instead of this "
    288 	    "tag."),
    289 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    290 	{EXIF_TAG_ROWS_PER_STRIP, "RowsPerStrip", N_("Rows per Strip"),
    291 	 N_("The number of rows per strip. This is the number of rows "
    292 	    "in the image of one strip when an image is divided into "
    293 	    "strips. With JPEG compressed data this designation is not "
    294 	    "needed and is omitted. See also <StripOffsets> and "
    295 	    "<StripByteCounts>."),
    296 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    297 	{EXIF_TAG_STRIP_BYTE_COUNTS, "StripByteCounts", N_("Strip Byte Count"),
    298 	 N_("The total number of bytes in each strip. With JPEG compressed "
    299 	    "data this designation is not needed and is omitted."),
    300 	 { ESL_MMMN, ESL_MMMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    301 	{EXIF_TAG_X_RESOLUTION, "XResolution", N_("X-Resolution"),
    302 	 N_("The number of pixels per <ResolutionUnit> in the <ImageWidth> "
    303 	    "direction. When the image resolution is unknown, 72 [dpi] "
    304 	    "is designated."),
    305 	 { ESL_MMMM, ESL_MMMM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    306 	{EXIF_TAG_Y_RESOLUTION, "YResolution", N_("Y-Resolution"),
    307 	 N_("The number of pixels per <ResolutionUnit> in the <ImageLength> "
    308 	    "direction. The same value as <XResolution> is designated."),
    309 	 { ESL_MMMM, ESL_MMMM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    310 	{EXIF_TAG_PLANAR_CONFIGURATION, "PlanarConfiguration",
    311 	 N_("Planar Configuration"),
    312 	 N_("Indicates whether pixel components are recorded in a chunky "
    313 	    "or planar format. In JPEG compressed files a JPEG marker "
    314 	    "is used instead of this tag. If this field does not exist, "
    315 	    "the TIFF default of 1 (chunky) is assumed."),
    316 	 { ESL_OMON, ESL_OMON, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    317 	{EXIF_TAG_RESOLUTION_UNIT, "ResolutionUnit", N_("Resolution Unit"),
    318 	 N_("The unit for measuring <XResolution> and <YResolution>. The same "
    319 	    "unit is used for both <XResolution> and <YResolution>. If "
    320 	    "the image resolution is unknown, 2 (inches) is designated."),
    321 	 { ESL_MMMM, ESL_MMMM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    322 	{EXIF_TAG_TRANSFER_FUNCTION, "TransferFunction",
    323 	 N_("Transfer Function"),
    324 	 N_("A transfer function for the image, described in tabular style. "
    325 	    "Normally this tag is not necessary, since color space is "
    326 	    "specified in the color space information tag (<ColorSpace>)."),
    327 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    328 	{EXIF_TAG_SOFTWARE, "Software", N_("Software"),
    329 	 N_("This tag records the name and version of the software or "
    330 	    "firmware of the camera or image input device used to "
    331 	    "generate the image. The detailed format is not specified, but "
    332 	    "it is recommended that the example shown below be "
    333 	    "followed. When the field is left blank, it is treated as "
    334 	    "unknown."),
    335 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    336 	{EXIF_TAG_DATE_TIME, "DateTime", N_("Date and Time"),
    337 	 N_("The date and time of image creation. In this standard "
    338 	    "(EXIF-2.1) it is the date and time the file was changed."),
    339 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    340 	{EXIF_TAG_ARTIST, "Artist", N_("Artist"),
    341 	 N_("This tag records the name of the camera owner, photographer or "
    342 	    "image creator. The detailed format is not specified, but it is "
    343 	    "recommended that the information be written as in the example "
    344 	    "below for ease of Interoperability. When the field is "
    345 	    "left blank, it is treated as unknown."),
    346 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    347 	{EXIF_TAG_WHITE_POINT, "WhitePoint", N_("White Point"),
    348 	 N_("The chromaticity of the white point of the image. Normally "
    349 	    "this tag is not necessary, since color space is specified "
    350 	    "in the color space information tag (<ColorSpace>)."),
    351 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    352 	{EXIF_TAG_PRIMARY_CHROMATICITIES, "PrimaryChromaticities",
    353 	 N_("Primary Chromaticities"),
    354 	 N_("The chromaticity of the three primary colors of the image. "
    355 	    "Normally this tag is not necessary, since color space is "
    356 	    "specified in the color space information tag (<ColorSpace>)."),
    357 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    358 	/* Not in EXIF 2.2 */
    359 	{EXIF_TAG_SUB_IFDS, "SubIFDs", "SubIFD Offsets", N_("Defined by Adobe Corporation "
    360 	    "to enable TIFF Trees within a TIFF file.")},
    361 	/* Not in EXIF 2.2 */
    362 	{EXIF_TAG_TRANSFER_RANGE, "TransferRange", N_("Transfer Range"), ""},
    363 	/* Not in EXIF 2.2 */
    364 	{EXIF_TAG_JPEG_PROC, "JPEGProc", "JPEGProc", ""},
    365 	{EXIF_TAG_JPEG_INTERCHANGE_FORMAT, "JPEGInterchangeFormat",
    366 	 N_("JPEG Interchange Format"),
    367 	 N_("The offset to the start byte (SOI) of JPEG compressed "
    368 	    "thumbnail data. This is not used for primary image "
    369 	    "JPEG data."),
    370 	 { ESL_NNNN, ESL_NNNM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    371 	{EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
    372 	 "JPEGInterchangeFormatLength", N_("JPEG Interchange Format Length"),
    373 	 N_("The number of bytes of JPEG compressed thumbnail data. This "
    374 	    "is not used for primary image JPEG data. JPEG thumbnails "
    375 	    "are not divided but are recorded as a continuous JPEG "
    376 	    "bitstream from SOI to EOI. Appn and COM markers should "
    377 	    "not be recorded. Compressed thumbnails must be recorded in no "
    378 	    "more than 64 Kbytes, including all other data to be "
    379 	    "recorded in APP1."),
    380 	 { ESL_NNNN, ESL_NNNM, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    381 	{EXIF_TAG_YCBCR_COEFFICIENTS, "YCbCrCoefficients",
    382 	 N_("YCbCr Coefficients"),
    383 	 N_("The matrix coefficients for transformation from RGB to YCbCr "
    384 	    "image data. No default is given in TIFF; but here the "
    385 	    "value given in \"Color Space Guidelines\", is used "
    386 	    "as the default. The color space is declared in a "
    387 	    "color space information tag, with the default being the value "
    388 	    "that gives the optimal image characteristics "
    389 	    "Interoperability this condition."),
    390 	 { ESL_NNOO, ESL_NNOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    391 	{EXIF_TAG_YCBCR_SUB_SAMPLING, "YCbCrSubSampling",
    392 	 N_("YCbCr Sub-Sampling"),
    393 	 N_("The sampling ratio of chrominance components in relation to the "
    394 	    "luminance component. In JPEG compressed data a JPEG marker "
    395 	    "is used instead of this tag."),
    396 	 { ESL_NNMN, ESL_NNMN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    397 	{EXIF_TAG_YCBCR_POSITIONING, "YCbCrPositioning",
    398 	 N_("YCbCr Positioning"),
    399 	 N_("The position of chrominance components in relation to the "
    400 	    "luminance component. This field is designated only for "
    401 	    "JPEG compressed data or uncompressed YCbCr data. The TIFF "
    402 	    "default is 1 (centered); but when Y:Cb:Cr = 4:2:2 it is "
    403 	    "recommended in this standard that 2 (co-sited) be used to "
    404 	    "record data, in order to improve the image quality when viewed "
    405 	    "on TV systems. When this field does not exist, the reader shall "
    406 	    "assume the TIFF default. In the case of Y:Cb:Cr = 4:2:0, the "
    407 	    "TIFF default (centered) is recommended. If the reader "
    408 	    "does not have the capability of supporting both kinds of "
    409 	    "<YCbCrPositioning>, it shall follow the TIFF default regardless "
    410 	    "of the value in this field. It is preferable that readers "
    411 	    "be able to support both centered and co-sited positioning."),
    412 	 { ESL_NNMM, ESL_NNOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    413 	{EXIF_TAG_REFERENCE_BLACK_WHITE, "ReferenceBlackWhite",
    414 	 N_("Reference Black/White"),
    415 	 N_("The reference black point value and reference white point "
    416 	    "value. No defaults are given in TIFF, but the values "
    417 	    "below are given as defaults here. The color space is declared "
    418 	    "in a color space information tag, with the default "
    419 	    "being the value that gives the optimal image characteristics "
    420 	    "Interoperability these conditions."),
    421 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    422 	/* Not in EXIF 2.2 */
    423 	{EXIF_TAG_XML_PACKET, "XMLPacket", N_("XML Packet"), N_("XMP Metadata")},
    424 	/* Not in EXIF 2.2 */
    425 	{EXIF_TAG_RELATED_IMAGE_FILE_FORMAT, "RelatedImageFileFormat",
    426 	 "RelatedImageFileFormat", ""},
    427 	/* Not in EXIF 2.2 */
    428 	{EXIF_TAG_RELATED_IMAGE_WIDTH, "RelatedImageWidth",
    429 	 "RelatedImageWidth", ""},
    430 	/* Not in EXIF 2.2 */
    431 	{EXIF_TAG_RELATED_IMAGE_LENGTH, "RelatedImageLength",
    432 	 "RelatedImageLength", ""},
    433 	/* Not in EXIF 2.2 */
    434 	{EXIF_TAG_CFA_REPEAT_PATTERN_DIM, "CFARepeatPatternDim",
    435 	 "CFARepeatPatternDim", ""},
    436 	/* Not in EXIF 2.2 */
    437 	{EXIF_TAG_CFA_PATTERN, "CFAPattern",
    438 	 N_("CFA Pattern"),
    439 	 N_("Indicates the color filter array (CFA) geometric pattern of the "
    440 	    "image sensor when a one-chip color area sensor is used. "
    441 	    "It does not apply to all sensing methods.")},
    442 	/* Not in EXIF 2.2 */
    443 	{EXIF_TAG_BATTERY_LEVEL, "BatteryLevel", N_("Battery Level"), ""},
    444 	{EXIF_TAG_COPYRIGHT, "Copyright", N_("Copyright"),
    445 	 N_("Copyright information. In this standard the tag is used to "
    446 	    "indicate both the photographer and editor copyrights. It is "
    447 	    "the copyright notice of the person or organization claiming "
    448 	    "rights to the image. The Interoperability copyright "
    449 	    "statement including date and rights should be written in this "
    450 	    "field; e.g., \"Copyright, John Smith, 19xx. All rights "
    451 	    "reserved.\". In this standard the field records both the "
    452 	    "photographer and editor copyrights, with each recorded in a "
    453 	    "separate part of the statement. When there is a clear "
    454 	    "distinction between the photographer and editor copyrights, "
    455 	    "these are to be written in the order of photographer followed "
    456 	    "by editor copyright, separated by NULL (in this case, "
    457 	    "since the statement also ends with a NULL, there are two NULL "
    458 	    "codes) (see example 1). When only the photographer is given, "
    459 	    "it is terminated by one NULL code (see example 2). When only "
    460 	    "the editor copyright is given, "
    461 	    "the photographer copyright part consists of one space followed "
    462 	    "by a terminating NULL code, then the editor copyright is given "
    463 	    "(see example 3). When the field is left blank, it is treated "
    464 	    "as unknown."),
    465 	 { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    466 	{EXIF_TAG_EXPOSURE_TIME, "ExposureTime", N_("Exposure Time"),
    467 	 N_("Exposure time, given in seconds (sec)."),
    468 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    469 	{EXIF_TAG_FNUMBER, "FNumber", N_("F-Number"),
    470 	 N_("The F number."),
    471 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    472 	/* Not in EXIF 2.2 */
    473 	{EXIF_TAG_IPTC_NAA, "IPTC/NAA", "IPTC/NAA", ""},
    474 	/* Not in EXIF 2.2 */
    475 	{EXIF_TAG_IMAGE_RESOURCES, "ImageResources", N_("Image Resources Block"), ""},
    476 	{EXIF_TAG_EXIF_IFD_POINTER, "ExifIfdPointer", "ExifIFDPointer",
    477 	 N_("A pointer to the Exif IFD. Interoperability, Exif IFD has the "
    478 	    "same structure as that of the IFD specified in TIFF. "
    479 	    "ordinarily, however, it does not contain image data as in "
    480 	    "the case of TIFF."),
    481 	 { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    482 	/* Not in EXIF 2.2 */
    483 	{EXIF_TAG_INTER_COLOR_PROFILE, "InterColorProfile",
    484 	 "InterColorProfile", ""},
    485 	{EXIF_TAG_EXPOSURE_PROGRAM, "ExposureProgram", N_("Exposure Program"),
    486 	 N_("The class of the program used by the camera to set exposure "
    487 	    "when the picture is taken."),
    488 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    489 	{EXIF_TAG_SPECTRAL_SENSITIVITY, "SpectralSensitivity",
    490 	 N_("Spectral Sensitivity"),
    491 	 N_("Indicates the spectral sensitivity of each channel of the "
    492 	    "camera used. The tag value is an ASCII string compatible "
    493 	    "with the standard developed by the ASTM Technical Committee."),
    494 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    495 	{EXIF_TAG_GPS_INFO_IFD_POINTER, "GPSInfoIFDPointer",
    496 	 N_("GPS Info IFD Pointer"),
    497 	 N_("A pointer to the GPS Info IFD. The "
    498 	    "Interoperability structure of the GPS Info IFD, like that of "
    499 	    "Exif IFD, has no image data."),
    500 	 { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    501 
    502 	{EXIF_TAG_ISO_SPEED_RATINGS, "ISOSpeedRatings",
    503 	 N_("ISO Speed Ratings"),
    504 	 N_("Indicates the ISO Speed and ISO Latitude of the camera or "
    505 	    "input device as specified in ISO 12232."),
    506 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    507 	{EXIF_TAG_OECF, "OECF", N_("Opto-Electronic Conversion Function"),
    508 	 N_("Indicates the Opto-Electronic Conversion Function (OECF) "
    509 	    "specified in ISO 14524. <OECF> is the relationship between "
    510 	    "the camera optical input and the image values."),
    511 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    512 	/* Not in EXIF 2.2 */
    513 	{EXIF_TAG_TIME_ZONE_OFFSET, "TimeZoneOffset", N_("Time Zone Offset"),
    514 	 N_("Encodes time zone of camera clock relative to GMT.")},
    515 	{EXIF_TAG_EXIF_VERSION, "ExifVersion", N_("Exif Version"),
    516 	 N_("The version of this standard supported. Nonexistence of this "
    517 	    "field is taken to mean nonconformance to the standard."),
    518 	 { ESL_NNNN, ESL_NNNN, ESL_MMMM, ESL_NNNN, ESL_NNNN } },
    519 	{EXIF_TAG_DATE_TIME_ORIGINAL, "DateTimeOriginal",
    520 	 N_("Date and Time (Original)"),
    521 	 N_("The date and time when the original image data was generated. "
    522 	    "For a digital still camera "
    523 	    "the date and time the picture was taken are recorded."),
    524 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    525 	{EXIF_TAG_DATE_TIME_DIGITIZED, "DateTimeDigitized",
    526 	 N_("Date and Time (Digitized)"),
    527 	 N_("The date and time when the image was stored as digital data."),
    528 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    529 	{EXIF_TAG_COMPONENTS_CONFIGURATION, "ComponentsConfiguration",
    530 	 N_("Components Configuration"),
    531 	 N_("Information specific to compressed data. The channels of "
    532 	    "each component are arranged in order from the 1st "
    533 	    "component to the 4th. For uncompressed data the data "
    534 	    "arrangement is given in the <PhotometricInterpretation> tag. "
    535 	    "However, since <PhotometricInterpretation> can only "
    536 	    "express the order of Y, Cb and Cr, this tag is provided "
    537 	    "for cases when compressed data uses components other than "
    538 	    "Y, Cb, and Cr and to enable support of other sequences."),
    539 	 { ESL_NNNN, ESL_NNNN, ESL_NNNM, ESL_NNNN, ESL_NNNN } },
    540 	{EXIF_TAG_COMPRESSED_BITS_PER_PIXEL, "CompressedBitsPerPixel",
    541 	 N_("Compressed Bits per Pixel"),
    542 	 N_("Information specific to compressed data. The compression mode "
    543 	    "used for a compressed image is indicated in unit bits "
    544 	    "per pixel."),
    545 	 { ESL_NNNN, ESL_NNNN, ESL_NNNO, ESL_NNNN, ESL_NNNN } },
    546 	{EXIF_TAG_SHUTTER_SPEED_VALUE, "ShutterSpeedValue", N_("Shutter Speed"),
    547 	 N_("Shutter speed. The unit is the APEX (Additive System of "
    548 	    "Photographic Exposure) setting."),
    549 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    550 	{EXIF_TAG_APERTURE_VALUE, "ApertureValue", N_("Aperture"),
    551 	 N_("The lens aperture. The unit is the APEX value."),
    552 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    553 	{EXIF_TAG_BRIGHTNESS_VALUE, "BrightnessValue", N_("Brightness"),
    554 	 N_("The value of brightness. The unit is the APEX value. "
    555 	    "Ordinarily it is given in the range of -99.99 to 99.99."),
    556 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    557 	{EXIF_TAG_EXPOSURE_BIAS_VALUE, "ExposureBiasValue",
    558 	 N_("Exposure Bias"),
    559 	 N_("The exposure bias. The units is the APEX value. Ordinarily "
    560 	    "it is given in the range of -99.99 to 99.99."),
    561 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    562 	{EXIF_TAG_MAX_APERTURE_VALUE, "MaxApertureValue", N_("Maximum Aperture Value"),
    563 	 N_("The smallest F number of the lens. The unit is the APEX value. "
    564 	    "Ordinarily it is given in the range of 00.00 to 99.99, "
    565 	    "but it is not limited to this range."),
    566 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    567 	{EXIF_TAG_SUBJECT_DISTANCE, "SubjectDistance",
    568 	 N_("Subject Distance"),
    569 	 N_("The distance to the subject, given in meters."),
    570 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    571 	{EXIF_TAG_METERING_MODE, "MeteringMode", N_("Metering Mode"),
    572 	 N_("The metering mode."),
    573 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    574 	{EXIF_TAG_LIGHT_SOURCE, "LightSource", N_("Light Source"),
    575 	 N_("The kind of light source."),
    576 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    577 	{EXIF_TAG_FLASH, "Flash", N_("Flash"),
    578 	 N_("This tag is recorded when an image is taken using a strobe "
    579 	    "light (flash)."),
    580 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    581 	{EXIF_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal Length"),
    582 	 N_("The actual focal length of the lens, in mm. Conversion is not "
    583 	    "made to the focal length of a 35 mm film camera."),
    584 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    585 	{EXIF_TAG_SUBJECT_AREA, "SubjectArea", N_("Subject Area"),
    586 	 N_("This tag indicates the location and area of the main subject "
    587 	    "in the overall scene."),
    588 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    589 	/* Not in EXIF 2.2 */
    590 	{EXIF_TAG_TIFF_EP_STANDARD_ID, "TIFF/EPStandardID", N_("TIFF/EP Standard ID"), ""},
    591 	{EXIF_TAG_MAKER_NOTE, "MakerNote", N_("Maker Note"),
    592 	 N_("A tag for manufacturers of Exif writers to record any desired "
    593 	    "information. The contents are up to the manufacturer."),
    594 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    595 	{EXIF_TAG_USER_COMMENT, "UserComment", N_("User Comment"),
    596 	 N_("A tag for Exif users to write keywords or comments on the image "
    597 	    "besides those in <ImageDescription>, and without the "
    598 	    "character code limitations of the <ImageDescription> tag. The "
    599 	    "character code used in the <UserComment> tag is identified "
    600 	    "based on an ID code in a fixed 8-byte area at the start of "
    601 	    "the tag data area. The unused portion of the area is padded "
    602 	    "with NULL (\"00.h\"). ID codes are assigned by means of "
    603 	    "registration. The designation method and references for each "
    604 	    "character code are defined in the specification. The value of "
    605 	    "CountN is determined based on the 8 bytes in the character code "
    606 	    "area and the number of bytes in the user comment part. Since "
    607 	    "the TYPE is not ASCII, NULL termination is not necessary. "
    608 	    "The ID code for the <UserComment> area may be a Defined code "
    609 	    "such as JIS or ASCII, or may be Undefined. The Undefined name "
    610 	    "is UndefinedText, and the ID code is filled with 8 bytes of all "
    611 	    "\"NULL\" (\"00.H\"). An Exif reader that reads the "
    612 	    "<UserComment> tag must have a function for determining the "
    613 	    "ID code. This function is not required in Exif readers that "
    614 	    "do not use the <UserComment> tag. "
    615 	    "When a <UserComment> area is set aside, it is recommended that "
    616 	    "the ID code be ASCII and that the following user comment "
    617 	    "part be filled with blank characters [20.H]."),
    618 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    619 	{EXIF_TAG_SUB_SEC_TIME, "SubsecTime", N_("Sub-second Time"),
    620 	 N_("A tag used to record fractions of seconds for the "
    621 	    "<DateTime> tag."),
    622 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    623 	{EXIF_TAG_SUB_SEC_TIME_ORIGINAL, "SubSecTimeOriginal",
    624 	 N_("Sub-second Time (Original)"),
    625 	 N_("A tag used to record fractions of seconds for the "
    626 	    "<DateTimeOriginal> tag."),
    627 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    628 	{EXIF_TAG_SUB_SEC_TIME_DIGITIZED, "SubSecTimeDigitized",
    629 	 N_("Sub-second Time (Digitized)"),
    630 	 N_("A tag used to record fractions of seconds for the "
    631 	    "<DateTimeDigitized> tag."),
    632 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    633 	/* Not in EXIF 2.2 (Microsoft extension) */
    634 	{EXIF_TAG_XP_TITLE, "XPTitle", N_("XP Title"),
    635 	 N_("A character string giving the title of the image, encoded in "
    636 	    "UTF-16LE."),
    637 	 { ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    638 	/* Not in EXIF 2.2 (Microsoft extension) */
    639 	{EXIF_TAG_XP_COMMENT, "XPComment", N_("XP Comment"),
    640 	 N_("A character string containing a comment about the image, encoded "
    641 	    "in UTF-16LE."),
    642 	 { ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    643 	/* Not in EXIF 2.2 (Microsoft extension) */
    644 	{EXIF_TAG_XP_AUTHOR, "XPAuthor", N_("XP Author"),
    645 	 N_("A character string containing the name of the image creator, "
    646 	    "encoded in UTF-16LE."),
    647 	 { ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    648 	/* Not in EXIF 2.2 (Microsoft extension) */
    649 	{EXIF_TAG_XP_KEYWORDS, "XPKeywords", N_("XP Keywords"),
    650 	 N_("A character string containing key words describing the image, "
    651 	    "encoded in UTF-16LE."),
    652 	 { ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    653 	/* Not in EXIF 2.2 (Microsoft extension) */
    654 	{EXIF_TAG_XP_SUBJECT, "XPSubject", N_("XP Subject"),
    655 	 N_("A character string giving the image subject, encoded in "
    656 	    "UTF-16LE."),
    657 	 { ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    658 	{EXIF_TAG_FLASH_PIX_VERSION, "FlashPixVersion", "FlashPixVersion",
    659 	 N_("The FlashPix format version supported by a FPXR file."),
    660 	 { ESL_NNNN, ESL_NNNN, ESL_MMMM, ESL_NNNN, ESL_NNNN } },
    661 	{EXIF_TAG_COLOR_SPACE, "ColorSpace", N_("Color Space"),
    662 	 N_("The color space information tag is always "
    663 	    "recorded as the color space specifier. Normally sRGB (=1) "
    664 	    "is used to define the color space based on the PC monitor "
    665 	    "conditions and environment. If a color space other than "
    666 	    "sRGB is used, Uncalibrated (=FFFF.H) is set. Image data "
    667 	    "recorded as Uncalibrated can be treated as sRGB when it is "
    668 	    "converted to FlashPix."),
    669 	 { ESL_NNNN, ESL_NNNN, ESL_MMMM, ESL_NNNN, ESL_NNNN } },
    670 	{EXIF_TAG_PIXEL_X_DIMENSION, "PixelXDimension", N_("Pixel X Dimension"),
    671 	 N_("Information specific to compressed data. When a "
    672 	    "compressed file is recorded, the valid width of the "
    673 	    "meaningful image must be recorded in this tag, whether or "
    674 	    "not there is padding data or a restart marker. This tag "
    675 	    "should not exist in an uncompressed file."),
    676 	 { ESL_NNNN, ESL_NNNN, ESL_NNNM, ESL_NNNN, ESL_NNNN } },
    677 	{EXIF_TAG_PIXEL_Y_DIMENSION, "PixelYDimension", N_("Pixel Y Dimension"),
    678 	 N_("Information specific to compressed data. When a compressed "
    679 	    "file is recorded, the valid height of the meaningful image "
    680 	    "must be recorded in this tag, whether or not there is padding "
    681 	    "data or a restart marker. This tag should not exist in an "
    682 	    "uncompressed file. "
    683 	    "Since data padding is unnecessary in the vertical direction, "
    684 	    "the number of lines recorded in this valid image height tag "
    685 	    "will in fact be the same as that recorded in the SOF."),
    686 	 { ESL_NNNN, ESL_NNNN, ESL_NNNM, ESL_NNNN, ESL_NNNN } },
    687 	{EXIF_TAG_RELATED_SOUND_FILE, "RelatedSoundFile",
    688 	 N_("Related Sound File"),
    689 	 N_("This tag is used to record the name of an audio file related "
    690 	    "to the image data. The only relational information "
    691 	    "recorded here is the Exif audio file name and extension (an "
    692 	    "ASCII string consisting of 8 characters + '.' + 3 "
    693 	    "characters). The path is not recorded. Stipulations on audio "
    694 	    "and file naming conventions are defined in the specification. "
    695 	    "When using this tag, audio files must be recorded in "
    696 	    "conformance to the Exif audio format. Writers are also allowed "
    697 	    "to store the data such as Audio within APP2 as FlashPix "
    698 	    "extension stream data. "
    699 	    "The mapping of Exif image files and audio files is done "
    700 	    "in any of three ways, [1], [2] and [3]. If multiple files "
    701 	    "are mapped to one file as in [2] or [3], the above "
    702 	    "format is used to record just one audio file name. If "
    703 	    "there are multiple audio files, the first recorded file is "
    704 	    "given. In the case of [3], for example, for the "
    705 	    "Exif image file \"DSC00001.JPG\" only  \"SND00001.WAV\" is "
    706 	    "given as the related Exif audio file. When there are three "
    707 	    "Exif audio files \"SND00001.WAV\", \"SND00002.WAV\" and "
    708 	    "\"SND00003.WAV\", the Exif image file name for each of them, "
    709 	    "\"DSC00001.JPG\", is indicated. By combining multiple "
    710 	    "relational information, a variety of playback possibilities "
    711 	    "can be supported. The method of using relational information "
    712 	    "is left to the implementation on the playback side. Since this "
    713 	    "information is an ASCII character string, it is terminated by "
    714 	    "NULL. When this tag is used to map audio files, the relation "
    715 	    "of the audio file to image data must also be indicated on the "
    716 	    "audio file end."),
    717 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    718 	{EXIF_TAG_INTEROPERABILITY_IFD_POINTER, "InteroperabilityIFDPointer",
    719 	 N_("Interoperability IFD Pointer"),
    720 	 N_("Interoperability IFD is composed of tags which stores the "
    721 	    "information to ensure the Interoperability and pointed "
    722 	    "by the following tag located in Exif IFD. "
    723 	    "The Interoperability structure of Interoperability IFD is "
    724 	    "the same as TIFF defined IFD structure "
    725 	    "but does not contain the "
    726 	    "image data characteristically compared with normal TIFF "
    727 	    "IFD."),
    728 	 { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
    729 	{EXIF_TAG_FLASH_ENERGY, "FlashEnergy", N_("Flash Energy"),
    730 	 N_("Indicates the strobe energy at the time the image is "
    731 	    "captured, as measured in Beam Candle Power Seconds (BCPS)."),
    732 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    733 	{EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE, "SpatialFrequencyResponse",
    734 	 N_("Spatial Frequency Response"),
    735 	 N_("This tag records the camera or input device spatial frequency "
    736 	    "table and SFR values in the direction of image width, "
    737 	    "image height, and diagonal direction, as specified in ISO "
    738 	    "12233."),
    739 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    740 	{EXIF_TAG_FOCAL_PLANE_X_RESOLUTION, "FocalPlaneXResolution",
    741 	 N_("Focal Plane X-Resolution"),
    742 	 N_("Indicates the number of pixels in the image width (X) direction "
    743 	    "per <FocalPlaneResolutionUnit> on the camera focal plane."),
    744 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    745 	{EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION, "FocalPlaneYResolution",
    746 	 N_("Focal Plane Y-Resolution"),
    747 	 N_("Indicates the number of pixels in the image height (V) direction "
    748 	    "per <FocalPlaneResolutionUnit> on the camera focal plane."),
    749 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    750 	{EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT, "FocalPlaneResolutionUnit",
    751 	 N_("Focal Plane Resolution Unit"),
    752 	 N_("Indicates the unit for measuring <FocalPlaneXResolution> and "
    753 	    "<FocalPlaneYResolution>. This value is the same as the "
    754 	    "<ResolutionUnit>."),
    755 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    756 	{EXIF_TAG_SUBJECT_LOCATION, "SubjectLocation",
    757 	 N_("Subject Location"),
    758 	 N_("Indicates the location of the main subject in the scene. The "
    759 	    "value of this tag represents the pixel at the center of the "
    760 	    "main subject relative to the left edge, prior to rotation "
    761 	    "processing as per the <Rotation> tag. The first value "
    762 	    "indicates the X column number and the second indicates "
    763 	    "the Y row number."),
    764 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    765 	{EXIF_TAG_EXPOSURE_INDEX, "ExposureIndex", N_("Exposure Index"),
    766 	 N_("Indicates the exposure index selected on the camera or "
    767 	    "input device at the time the image is captured."),
    768 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    769 	{EXIF_TAG_SENSING_METHOD, "SensingMethod", N_("Sensing Method"),
    770 	 N_("Indicates the image sensor type on the camera or input "
    771 	    "device."),
    772 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    773 	{EXIF_TAG_FILE_SOURCE, "FileSource", N_("File Source"),
    774 	 N_("Indicates the image source. If a DSC recorded the image, "
    775 	    "the tag value of this tag always be set to 3, indicating "
    776 	    "that the image was recorded on a DSC."),
    777 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    778 	{EXIF_TAG_SCENE_TYPE, "SceneType", N_("Scene Type"),
    779 	 N_("Indicates the type of scene. If a DSC recorded the image, "
    780 	    "this tag value must always be set to 1, indicating that the "
    781 	    "image was directly photographed."),
    782 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    783 	{EXIF_TAG_NEW_CFA_PATTERN, "CFAPattern",
    784 	 N_("CFA Pattern"),
    785 	 N_("Indicates the color filter array (CFA) geometric pattern of the "
    786 	    "image sensor when a one-chip color area sensor is used. "
    787 	    "It does not apply to all sensing methods."),
    788 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    789 	{EXIF_TAG_CUSTOM_RENDERED, "CustomRendered", N_("Custom Rendered"),
    790 	 N_("This tag indicates the use of special processing on image "
    791 	    "data, such as rendering geared to output. When special "
    792 	    "processing is performed, the reader is expected to disable "
    793 	    "or minimize any further processing."),
    794 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    795 	{EXIF_TAG_EXPOSURE_MODE, "ExposureMode", N_("Exposure Mode"),
    796 	 N_("This tag indicates the exposure mode set when the image was "
    797 	    "shot. In auto-bracketing mode, the camera shoots a series of "
    798 	    "frames of the same scene at different exposure settings."),
    799 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    800 	{EXIF_TAG_WHITE_BALANCE, "WhiteBalance", N_("White Balance"),
    801 	 N_("This tag indicates the white balance mode set when the image "
    802 	    "was shot."),
    803 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    804 	{EXIF_TAG_DIGITAL_ZOOM_RATIO, "DigitalZoomRatio",
    805 	 N_("Digital Zoom Ratio"),
    806 	 N_("This tag indicates the digital zoom ratio when the image was "
    807 	    "shot. If the numerator of the recorded value is 0, this "
    808 	    "indicates that digital zoom was not used."),
    809 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    810 	{EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM, "FocalLengthIn35mmFilm",
    811 	 N_("Focal Length in 35mm Film"),
    812 	 N_("This tag indicates the equivalent focal length assuming a "
    813 	    "35mm film camera, in mm. A value of 0 means the focal "
    814 	    "length is unknown. Note that this tag differs from the "
    815 	    "FocalLength tag."),
    816 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    817 	{EXIF_TAG_SCENE_CAPTURE_TYPE, "SceneCaptureType",
    818 	 N_("Scene Capture Type"),
    819 	 N_("This tag indicates the type of scene that was shot. It can "
    820 	    "also be used to record the mode in which the image was "
    821 	    "shot. Note that this differs from the scene type "
    822 	    "<SceneType> tag."),
    823 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    824 	{EXIF_TAG_GAIN_CONTROL, "GainControl", N_("Gain Control"),
    825 	 N_("This tag indicates the degree of overall image gain "
    826 	    "adjustment."),
    827 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    828 	{EXIF_TAG_CONTRAST, "Contrast", N_("Contrast"),
    829 	 N_("This tag indicates the direction of contrast processing "
    830 	    "applied by the camera when the image was shot."),
    831 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    832 	{EXIF_TAG_SATURATION, "Saturation", N_("Saturation"),
    833 	 N_("This tag indicates the direction of saturation processing "
    834 	    "applied by the camera when the image was shot."),
    835 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    836 	{EXIF_TAG_SHARPNESS, "Sharpness", N_("Sharpness"),
    837 	 N_("This tag indicates the direction of sharpness processing "
    838 	    "applied by the camera when the image was shot."),
    839 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    840 	{EXIF_TAG_DEVICE_SETTING_DESCRIPTION, "DeviceSettingDescription",
    841 	 N_("Device Setting Description"),
    842 	 N_("This tag indicates information on the picture-taking "
    843 	    "conditions of a particular camera model. The tag is used "
    844 	    "only to indicate the picture-taking conditions in the "
    845 	    "reader."),
    846 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    847 	{EXIF_TAG_SUBJECT_DISTANCE_RANGE, "SubjectDistanceRange",
    848 	 N_("Subject Distance Range"),
    849 	 N_("This tag indicates the distance to the subject."),
    850 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    851 	{EXIF_TAG_IMAGE_UNIQUE_ID, "ImageUniqueID", N_("Image Unique ID"),
    852 	 N_("This tag indicates an identifier assigned uniquely to "
    853 	    "each image. It is recorded as an ASCII string equivalent "
    854 	    "to hexadecimal notation and 128-bit fixed length."),
    855 	 { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    856 	/* Not in EXIF 2.2 */
    857 	{EXIF_TAG_GAMMA, "Gamma", N_("Gamma"),
    858 	 N_("Indicates the value of coefficient gamma.")},
    859 	/* Not in EXIF 2.2 */
    860 	{EXIF_TAG_PRINT_IMAGE_MATCHING, "PrintImageMatching", N_("PRINT Image Matching"),
    861 	 N_("Related to Epson's PRINT Image Matching technology")},
    862 	/* Not in EXIF 2.2 (from the Microsoft HD Photo specification) */
    863 	{EXIF_TAG_PADDING, "Padding", N_("Padding"),
    864 	 N_("This tag reserves space that can be reclaimed later when "
    865             "additional metadata are added. New metadata can be written "
    866             "in place by replacing this tag with a smaller data element "
    867             "and using the reclaimed space to store the new or expanded "
    868             "metadata tags."),
    869 	 { ESL_OOOO, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
    870 #endif
    871 	{0, NULL, NULL, NULL}
    872 };
    873 
    874 /* For now, do not use these functions. */
    875 
    876 /*!
    877  * Return the number of entries in the EXIF tag table, including the
    878  * terminating NULL entry.
    879  */
    880 inline unsigned int
    881 exif_tag_table_count (void)
    882 {
    883 	return sizeof (ExifTagTable) / sizeof (ExifTagTable[0]);
    884 }
    885 
    886 
    887 ExifTag
    888 exif_tag_table_get_tag (unsigned int n)
    889 {
    890 	return (n < exif_tag_table_count ()) ? ExifTagTable[n].tag : 0;
    891 }
    892 
    893 const char *
    894 exif_tag_table_get_name (unsigned int n)
    895 {
    896 	return (n < exif_tag_table_count ()) ? ExifTagTable[n].name : NULL;
    897 }
    898 
    899 /*!
    900  * Compares the tag with that in entry.
    901  * \param[in] tag pointer to integer tag value
    902  * \param[in] entry pointer to a struct TagEntry
    903  * \return 0 if tags are equal, <0 if tag < entry, >0 if tag > entry
    904  */
    905 static int
    906 match_tag(const void *tag, const void *entry)
    907 {
    908 	return *(int*)tag - ((struct TagEntry *)entry)->tag;
    909 }
    910 
    911 
    912 /*!
    913  * Finds the first entry in the EXIF tag table with the given tag number
    914  * using a binary search.
    915  * \param[in] tag to find
    916  * \return index into table, or -1 if not found
    917  */
    918 static int
    919 exif_tag_table_first(ExifTag tag)
    920 {
    921 	int i;
    922 	struct TagEntry *entry = bsearch(&tag, ExifTagTable,
    923 		exif_tag_table_count()-1, sizeof(struct TagEntry), match_tag);
    924 	if (!entry)
    925 		return -1;	/* Not found */
    926 
    927 	/* Calculate index of found entry */
    928 	i = entry - ExifTagTable;
    929 
    930 	/* There may be other entries with the same tag number, so search
    931 	 * backwards to find the first
    932 	 */
    933 	while ((i > 0) && (ExifTagTable[i-1].tag == tag)) {
    934 		--i;
    935 	}
    936 	return i;
    937 }
    938 
    939 #define RECORDED \
    940 ((ExifTagTable[i].esl[ifd][EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY] != EXIF_SUPPORT_LEVEL_NOT_RECORDED) || \
    941  (ExifTagTable[i].esl[ifd][EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR] != EXIF_SUPPORT_LEVEL_NOT_RECORDED) || \
    942  (ExifTagTable[i].esl[ifd][EXIF_DATA_TYPE_UNCOMPRESSED_YCC] != EXIF_SUPPORT_LEVEL_NOT_RECORDED) || \
    943  (ExifTagTable[i].esl[ifd][EXIF_DATA_TYPE_COMPRESSED] != EXIF_SUPPORT_LEVEL_NOT_RECORDED))
    944 
    945 const char *
    946 exif_tag_get_name_in_ifd (ExifTag tag, ExifIfd ifd)
    947 {
    948 	unsigned int i;
    949 	int first;
    950 
    951 	if (ifd >= EXIF_IFD_COUNT)
    952 		return NULL;
    953 	first = exif_tag_table_first(tag);
    954 	if (first < 0)
    955 		return NULL;
    956 
    957 	for (i = first; ExifTagTable[i].name; i++) {
    958 		if (ExifTagTable[i].tag == tag) {
    959 		   if (RECORDED)
    960 			   break;
    961 		} else
    962 			return NULL; /* Recorded tag not found in the table */
    963 	}
    964 	return ExifTagTable[i].name;
    965 }
    966 
    967 const char *
    968 exif_tag_get_title_in_ifd (ExifTag tag, ExifIfd ifd)
    969 {
    970 	unsigned int i;
    971 	int first;
    972 
    973 	if (ifd >= EXIF_IFD_COUNT)
    974 		return NULL;
    975 	first = exif_tag_table_first(tag);
    976 	if (first < 0)
    977 		return NULL;
    978 
    979 	for (i = first; ExifTagTable[i].name; i++) {
    980 		if (ExifTagTable[i].tag == tag) {
    981 		   if (RECORDED)
    982 			   break;
    983 		} else
    984 			return NULL; /* Recorded tag not found in the table */
    985 	}
    986 	/* FIXME: This belongs to somewhere else. */
    987 	/* libexif should use the default system locale.
    988 	 * If an application specifically requires UTF-8, then we
    989 	 * must give the application a way to tell libexif that.
    990 	 *
    991 	 * bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    992 	 */
    993 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
    994 	return _(ExifTagTable[i].title);
    995 }
    996 
    997 const char *
    998 exif_tag_get_description_in_ifd (ExifTag tag, ExifIfd ifd)
    999 {
   1000 	unsigned int i;
   1001 	int first;
   1002 
   1003 	if (ifd >= EXIF_IFD_COUNT)
   1004 		return NULL;
   1005 	first = exif_tag_table_first(tag);
   1006 	if (first < 0)
   1007 		return NULL;
   1008 
   1009 	for (i = first; ExifTagTable[i].name; i++) {
   1010 		if (ExifTagTable[i].tag == tag) {
   1011 			if (RECORDED)
   1012 				break;
   1013 		} else
   1014 			return NULL; /* Recorded tag not found in the table */
   1015 	}
   1016 
   1017 	/* GNU gettext acts strangely when given an empty string */
   1018 	if (!ExifTagTable[i].description || !*ExifTagTable[i].description)
   1019 		return "";
   1020 
   1021 	/* libexif should use the default system locale.
   1022 	 * If an application specifically requires UTF-8, then we
   1023 	 * must give the application a way to tell libexif that.
   1024 	 *
   1025 	 * bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   1026 	 */
   1027 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
   1028 	return _(ExifTagTable[i].description);
   1029 }
   1030 
   1031 
   1032 /**********************************************************************
   1033  * convenience functions
   1034  **********************************************************************/
   1035 
   1036 /* generic part: iterate through IFD list and return first result */
   1037 typedef const char * (*get_stuff_func) (ExifTag tag, ExifIfd ifd);
   1038 
   1039 static const char *
   1040 exif_tag_get_stuff (ExifTag tag, get_stuff_func func)
   1041 {
   1042 	/* Search IFDs in this order, in decreasing order of number of valid tags */
   1043 	static const ExifIfd ifds[EXIF_IFD_COUNT] = {
   1044 		EXIF_IFD_EXIF,
   1045 		EXIF_IFD_0,
   1046 		EXIF_IFD_1,
   1047 		EXIF_IFD_INTEROPERABILITY,
   1048 		EXIF_IFD_GPS
   1049 	};
   1050 	int i;
   1051 	for (i=0; i<EXIF_IFD_COUNT; i++) {
   1052 		const char *result = func(tag, ifds[i]);
   1053 		if (result != NULL) {
   1054 			return result;
   1055 		}
   1056 	}
   1057 	return (const char *) NULL;
   1058 }
   1059 
   1060 /* explicit functions */
   1061 const char *
   1062 exif_tag_get_name (ExifTag tag)
   1063 {
   1064 	return exif_tag_get_stuff(tag, exif_tag_get_name_in_ifd);
   1065 }
   1066 
   1067 const char *
   1068 exif_tag_get_title (ExifTag tag)
   1069 {
   1070 	return exif_tag_get_stuff(tag, exif_tag_get_title_in_ifd);
   1071 }
   1072 
   1073 const char *
   1074 exif_tag_get_description (ExifTag tag)
   1075 {
   1076 	return exif_tag_get_stuff(tag, exif_tag_get_description_in_ifd);
   1077 }
   1078 
   1079 
   1080 
   1081 ExifTag
   1082 exif_tag_from_name (const char *name)
   1083 {
   1084 	unsigned int i;
   1085 	unsigned int result=0;
   1086 
   1087 	if (!name) return 0;
   1088 
   1089 	for (i = 0; ExifTagTable[i].name; i++)
   1090 		if (!strcmp (ExifTagTable[i].name, name))  {
   1091 		  	result = ExifTagTable[i].tag;
   1092 		  	break;
   1093 		}
   1094 	return result;
   1095 }
   1096 
   1097 /*! Return the support level of a tag in the given IFD with the given data
   1098  * type. If the tag is not specified in the EXIF standard, this function
   1099  * returns EXIF_SUPPORT_LEVEL_NOT_RECORDED.
   1100  *
   1101  * \param[in] tag EXIF tag
   1102  * \param[in] ifd a valid IFD (not EXIF_IFD_COUNT)
   1103  * \param[in] t a valid data type (not EXIF_DATA_TYPE_UNKNOWN)
   1104  * \return the level of support for this tag
   1105  */
   1106 static inline ExifSupportLevel
   1107 get_support_level_in_ifd (ExifTag tag, ExifIfd ifd, ExifDataType t)
   1108 {
   1109 	unsigned int i;
   1110 	int first = exif_tag_table_first(tag);
   1111 	if (first < 0)
   1112 		return EXIF_SUPPORT_LEVEL_NOT_RECORDED;
   1113 
   1114 	for (i = first; ExifTagTable[i].name; i++) {
   1115 		if (ExifTagTable[i].tag == tag) {
   1116 			const ExifSupportLevel supp = ExifTagTable[i].esl[ifd][t];
   1117 			if (supp != EXIF_SUPPORT_LEVEL_NOT_RECORDED)
   1118 				return supp;
   1119 			/* Try looking for another entry */
   1120 		} else {
   1121 			break; /* We've reached the end of the matching tags */
   1122 		}
   1123 	}
   1124 	return EXIF_SUPPORT_LEVEL_NOT_RECORDED;
   1125 }
   1126 
   1127 /*! Return the support level of a tag in the given IFD, regardless of the
   1128  * data type. If the support level varies depending on the data type, this
   1129  * function returns EXIF_SUPPORT_LEVEL_UNKNOWN. If the tag is not specified
   1130  * in the EXIF standard, this function returns EXIF_SUPPORT_LEVEL_UNKNOWN.
   1131  *
   1132  * \param[in] tag EXIF tag
   1133  * \param[in] ifd a valid IFD (not EXIF_IFD_COUNT)
   1134  * \return the level of support for this tag
   1135  */
   1136 static inline ExifSupportLevel
   1137 get_support_level_any_type (ExifTag tag, ExifIfd ifd)
   1138 {
   1139 	unsigned int i;
   1140 	int first = exif_tag_table_first(tag);
   1141 	if (first < 0)
   1142 		return EXIF_SUPPORT_LEVEL_UNKNOWN;
   1143 
   1144 	for (i = first; ExifTagTable[i].name; i++) {
   1145 		if (ExifTagTable[i].tag == tag) {
   1146 			/*
   1147 			 * Check whether the support level is the same for all possible
   1148 			 * data types and isn't marked not recorded.
   1149 			 */
   1150 			const ExifSupportLevel supp = ExifTagTable[i].esl[ifd][0];
   1151 			/* If level is not recorded, keep searching for another */
   1152 			if (supp != EXIF_SUPPORT_LEVEL_NOT_RECORDED) {
   1153 				unsigned int dt;
   1154 				for (dt = 0; dt < EXIF_DATA_TYPE_COUNT; ++dt) {
   1155 					if (ExifTagTable[i].esl[ifd][dt] != supp)
   1156 						break;
   1157 				}
   1158 				if (dt == EXIF_DATA_TYPE_COUNT)
   1159 					/* Support level is always the same, so return it */
   1160 					return supp;
   1161 			}
   1162 			/* Keep searching the table for another tag for our IFD */
   1163 		} else {
   1164 			break; /* We've reached the end of the matching tags */
   1165 		}
   1166 	}
   1167 	return EXIF_SUPPORT_LEVEL_UNKNOWN;
   1168 }
   1169 
   1170 ExifSupportLevel
   1171 exif_tag_get_support_level_in_ifd (ExifTag tag, ExifIfd ifd, ExifDataType t)
   1172 {
   1173 	if (ifd >= EXIF_IFD_COUNT)
   1174 		return EXIF_SUPPORT_LEVEL_UNKNOWN;
   1175 
   1176 	if (t >= EXIF_DATA_TYPE_COUNT)
   1177 		return get_support_level_any_type (tag, ifd);
   1178 
   1179 	return get_support_level_in_ifd (tag, ifd, t);
   1180 }
   1181