Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * EXIF metadata parser
  3.  * Copyright (c) 2013 Thilo Borgmann <thilo.borgmann _at_ mail.de>
  4.  *
  5.  * This file is part of FFmpeg.
  6.  *
  7.  * FFmpeg is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * FFmpeg is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with FFmpeg; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20.  */
  21.  
  22. /**
  23.  * @file
  24.  * EXIF metadata parser
  25.  * @author Thilo Borgmann <thilo.borgmann _at_ mail.de>
  26.  */
  27.  
  28. #ifndef AVCODEC_EXIF_H
  29. #define AVCODEC_EXIF_H
  30.  
  31. #include "avcodec.h"
  32. #include "bytestream.h"
  33. #include "tiff.h"
  34.  
  35. #define EXIF_MAX_IFD_RECURSION 2
  36. #define EXIF_TAG_NAME_LENGTH   32
  37.  
  38. struct exif_tag {
  39.     char      name[EXIF_TAG_NAME_LENGTH];
  40.     uint16_t  id;
  41. };
  42.  
  43. static const struct exif_tag tag_list[] = { // JEITA CP-3451 EXIF specification:
  44.     {"GPSVersionID",               0x00}, // <- Table 12 GPS Attribute Information
  45.     {"GPSLatitudeRef",             0x01},
  46.     {"GPSLatitude",                0x02},
  47.     {"GPSLongitudeRef",            0x03},
  48.     {"GPSLongitude",               0x04},
  49.     {"GPSAltitudeRef",             0x05},
  50.     {"GPSAltitude",                0x06},
  51.     {"GPSTimeStamp",               0x07},
  52.     {"GPSSatellites",              0x08},
  53.     {"GPSStatus",                  0x09},
  54.     {"GPSMeasureMode",             0x0A},
  55.     {"GPSDOP",                     0x0B},
  56.     {"GPSSpeedRef",                0x0C},
  57.     {"GPSSpeed",                   0x0D},
  58.     {"GPSTrackRef",                0x0E},
  59.     {"GPSTrack",                   0x0F},
  60.     {"GPSImgDirectionRef",         0x10},
  61.     {"GPSImgDirection",            0x11},
  62.     {"GPSMapDatum",                0x12},
  63.     {"GPSDestLatitudeRef",         0x13},
  64.     {"GPSDestLatitude",            0x14},
  65.     {"GPSDestLongitudeRef",        0x15},
  66.     {"GPSDestLongitude",           0x16},
  67.     {"GPSDestBearingRef",          0x17},
  68.     {"GPSDestBearing",             0x18},
  69.     {"GPSDestDistanceRef",         0x19},
  70.     {"GPSDestDistance",            0x1A},
  71.     {"GPSProcessingMethod",        0x1B},
  72.     {"GPSAreaInformation",         0x1C},
  73.     {"GPSDateStamp",               0x1D},
  74.     {"GPSDifferential",            0x1E},
  75.     {"ImageWidth",                 0x100}, // <- Table 3 TIFF Rev. 6.0 Attribute Information Used in Exif
  76.     {"ImageLength",                0x101},
  77.     {"BitsPerSample",              0x102},
  78.     {"Compression",                0x103},
  79.     {"PhotometricInterpretation",  0x106},
  80.     {"Orientation",                0x112},
  81.     {"SamplesPerPixel",            0x115},
  82.     {"PlanarConfiguration",        0x11C},
  83.     {"YCbCrSubSampling",           0x212},
  84.     {"YCbCrPositioning",           0x213},
  85.     {"XResolution",                0x11A},
  86.     {"YResolution",                0x11B},
  87.     {"ResolutionUnit",             0x128},
  88.     {"StripOffsets",               0x111},
  89.     {"RowsPerStrip",               0x116},
  90.     {"StripByteCounts",            0x117},
  91.     {"JPEGInterchangeFormat",      0x201},
  92.     {"JPEGInterchangeFormatLength",0x202},
  93.     {"TransferFunction",           0x12D},
  94.     {"WhitePoint",                 0x13E},
  95.     {"PrimaryChromaticities",      0x13F},
  96.     {"YCbCrCoefficients",          0x211},
  97.     {"ReferenceBlackWhite",        0x214},
  98.     {"DateTime",                   0x132},
  99.     {"ImageDescription",           0x10E},
  100.     {"Make",                       0x10F},
  101.     {"Model",                      0x110},
  102.     {"Software",                   0x131},
  103.     {"Artist",                     0x13B},
  104.     {"Copyright",                  0x8298},
  105.     {"ExifVersion",                0x9000}, // <- Table 4 Exif IFD Attribute Information (1)
  106.     {"FlashpixVersion",            0xA000},
  107.     {"ColorSpace",                 0xA001},
  108.     {"ComponentsConfiguration",    0x9101},
  109.     {"CompressedBitsPerPixel",     0x9102},
  110.     {"PixelXDimension",            0xA002},
  111.     {"PixelYDimension",            0xA003},
  112.     {"MakerNote",                  0x927C},
  113.     {"UserComment",                0x9286},
  114.     {"RelatedSoundFile",           0xA004},
  115.     {"DateTimeOriginal",           0x9003},
  116.     {"DateTimeDigitized",          0x9004},
  117.     {"SubSecTime",                 0x9290},
  118.     {"SubSecTimeOriginal",         0x9291},
  119.     {"SubSecTimeDigitized",        0x9292},
  120.     {"ImageUniqueID",              0xA420},
  121.     {"ExposureTime",               0x829A}, // <- Table 5 Exif IFD Attribute Information (2)
  122.     {"FNumber",                    0x829D},
  123.     {"ExposureProgram",            0x8822},
  124.     {"SpectralSensitivity",        0x8824},
  125.     {"ISOSpeedRatings",            0x8827},
  126.     {"OECF",                       0x8828},
  127.     {"ShutterSpeedValue",          0x9201},
  128.     {"ApertureValue",              0x9202},
  129.     {"BrightnessValue",            0x9203},
  130.     {"ExposureBiasValue",          0x9204},
  131.     {"MaxApertureValue",           0x9205},
  132.     {"SubjectDistance",            0x9206},
  133.     {"MeteringMode",               0x9207},
  134.     {"LightSource",                0x9208},
  135.     {"Flash",                      0x9209},
  136.     {"FocalLength",                0x920A},
  137.     {"SubjectArea",                0x9214},
  138.     {"FlashEnergy",                0xA20B},
  139.     {"SpatialFrequencyResponse",   0xA20C},
  140.     {"FocalPlaneXResolution",      0xA20E},
  141.     {"FocalPlaneYResolution",      0xA20F},
  142.     {"FocalPlaneResolutionUnit",   0xA210},
  143.     {"SubjectLocation",            0xA214},
  144.     {"ExposureIndex",              0xA215},
  145.     {"SensingMethod",              0xA217},
  146.     {"FileSource",                 0xA300},
  147.     {"SceneType",                  0xA301},
  148.     {"CFAPattern",                 0xA302},
  149.     {"CustomRendered",             0xA401},
  150.     {"ExposureMode",               0xA402},
  151.     {"WhiteBalance",               0xA403},
  152.     {"DigitalZoomRatio",           0xA404},
  153.     {"FocalLengthIn35mmFilm",      0xA405},
  154.     {"SceneCaptureType",           0xA406},
  155.     {"GainControl",                0xA407},
  156.     {"Contrast",                   0xA408},
  157.     {"Saturation",                 0xA409},
  158.     {"Sharpness",                  0xA40A},
  159.     {"DeviceSettingDescription",   0xA40B},
  160.     {"SubjectDistanceRange",       0xA40C}
  161. //    {"InteroperabilityIndex",      0x1}, // <- Table 13 Interoperability IFD Attribute Information
  162. //    {"",                           0x0}
  163. };
  164.  
  165. /** Recursively decodes all IFD's and
  166.  *  adds included TAGS into the metadata dictionary. */
  167. int ff_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le,
  168.                        int depth, AVDictionary **metadata);
  169.  
  170. #endif /* AVCODEC_EXIF_H */
  171.