libgphoto2 photo camera library (libgphoto2) API
2.5.0
|
00001 00012 #ifndef _gphoto_exif_ 00013 #define _gphoto_exif_ 00014 #include <stdio.h> 00015 #include <stdlib.h> 00016 #include <string.h> 00017 #include <time.h> 00018 #include <sys/time.h> 00019 #include <sys/times.h> 00020 #include <fcntl.h> 00021 00022 00023 /* 00024 * Tag data type information. 00025 */ 00026 typedef enum { 00027 EXIF_NOTYPE = 0, /* placeholder */ 00028 EXIF_BYTE = 1, /* 8-bit unsigned integer */ 00029 EXIF_ASCII = 2, /* 8-bit bytes w/ last byte null */ 00030 EXIF_SHORT = 3, /* 16-bit unsigned integer */ 00031 EXIF_LONG = 4, /* 32-bit unsigned integer */ 00032 EXIF_RATIONAL = 5, /* 64-bit unsigned fraction */ 00033 EXIF_SBYTE = 6, /* !8-bit signed integer */ 00034 EXIF_UNDEFINED = 7, /* !8-bit untyped data */ 00035 EXIF_SSHORT = 8, /* !16-bit signed integer */ 00036 EXIF_SLONG = 9, /* !32-bit signed integer */ 00037 EXIF_SRATIONAL = 10, /* !64-bit signed fraction */ 00038 EXIF_FLOAT = 11, /* !32-bit IEEE floating point */ 00039 EXIF_DOUBLE = 12 /* !64-bit IEEE floating point */ 00040 } EXIFDataType; 00041 00042 00043 typedef struct exif_parser { 00044 unsigned char *header,*data,*ifds[10]; 00045 int ifdtags[10]; /* How many tags in each ifd */ 00046 int ifdcnt; /* Number of IFD's, assumed to be < 10 */ 00047 unsigned int exiflen; 00048 int preparsed,endian; 00049 } exifparser; 00050 00051 typedef struct { 00052 int tag; /* Tag ID, see exif_tags.h */ 00053 EXIFDataType type; /* Tag data type, see exif_tags.h */ 00054 int size; /* Length of the data, in bytes. */ 00055 unsigned char *data; /* The data itself, not an offset */ 00056 int num; /* When type is (s)rational, we */ 00057 int den; /* store the value here... */ 00058 int intval; 00059 } ExifData; 00060 00061 /* 00062 * The same as gpi_exif_get_thumbnail but returns 00063 * also the thumbnail size 00064 */ 00065 unsigned char *gpi_exif_get_thumbnail_and_size(exifparser *exifdat, long *size); 00066 00067 /* 00068 * COMMENT ME 00069 */ 00070 int gpi_exif_stat(exifparser *exifdata); 00071 00072 /* 00073 * Now, all the 'defines' 00074 */ 00075 00076 #define EXIF_InteroperabilityIndex 0x1 00077 #define EXIF_InteroperabilityVersion 0x2 00078 #define EXIF_RelatedImageFileFormat 0x1000 00079 #define EXIF_RelatedImageWidth 0x1001 00080 #define EXIF_RelatedImageLength 0x1002 00081 00082 #define EXIF_NewSubFileType 0xFE 00083 #define EXIF_ImageWidth 0x100 00084 #define EXIF_ImageLength 0x101 00085 #define EXIF_BitsPerSample 0x102 00086 #define EXIF_Compression 0x103 00087 #define EXIF_PhotometricInterpretation 0x106 00088 #define EXIF_FillOrder 0x10A 00089 #define EXIF_DocumentName 0x10D 00090 #define EXIF_ImageDescription 0x10E 00091 #define EXIF_Make 0x10F 00092 #define EXIF_Model 0x110 00093 #define EXIF_StripOffsets 0x111 00094 #define EXIF_Orientation 0x112 00095 #define EXIF_SamplesPerPixel 0x115 00096 #define EXIF_RowsPerStrip 0x116 00097 #define EXIF_StripByteCounts 0x117 00098 #define EXIF_XResolution 0x11A 00099 #define EXIF_YResolution 0x11B 00100 #define EXIF_PlanarConfiguration 0x11C 00101 #define EXIF_ResolutionUnit 0x128 00102 #define EXIF_TransferFunction 0x12D 00103 #define EXIF_Software 0x131 00104 #define EXIF_DateTime 0x132 00105 #define EXIF_Artist 0x13B 00106 #define EXIF_WhitePoint 0x13E 00107 #define EXIF_PrimaryChromaticities 0x13F 00108 #define EXIF_TransferRange 0x156 00109 #define EXIF_JPEGProc 0x200 00110 #define EXIF_JPEGInterchangeFormat 0x201 00111 #define EXIF_JPEGInterchangeFormatLength 0x202 00112 #define EXIF_YCbCrCoefficients 0x211 00113 #define EXIF_YCbCrSubSampling 0x212 00114 #define EXIF_YCbCrPositioning 0x213 00115 #define EXIF_ReferenceBlackWhite 0x214 00116 #define EXIF_CFARepeatPatternDim 0x828D 00117 #define EXIF_CFAPattern 0x828E 00118 #define EXIF_BatteryLevel 0x828F 00119 #define EXIF_Copyright 0x8298 00120 #define EXIF_ExposureTime 0x829A 00121 #define EXIF_FNumber 0x829D 00122 /* Be careful: the next tag's official name is IPTC/NAA but 00123 we can't do a define with a "/" */ 00124 #define EXIF_IPTC_NAA 0x83BB 00125 #define EXIF_ExifOffset 0x8769 00126 #define EXIF_InterColorProfile 0x8773 00127 #define EXIF_ExposureProgram 0x8822 00128 #define EXIF_SpectralSensitivity 0x8824 00129 #define EXIF_GPSInfo 0x8825 00130 #define EXIF_ISOSpeedRatings 0x8827 00131 #define EXIF_OECF 0x8828 00132 #define EXIF_ExifVersion 0x9000 00133 #define EXIF_DateTimeOriginal 0x9003 00134 #define EXIF_DateTimeDigitized 0x9004 00135 #define EXIF_ComponentsConfiguration 0x9101 00136 #define EXIF_CompressedBitsPerPixel 0x9102 00137 #define EXIF_ShutterSpeedValue 0x9201 00138 #define EXIF_ApertureValue 0x9202 00139 #define EXIF_BrightnessValue 0x9203 00140 #define EXIF_ExposureBiasValue 0x9204 00141 #define EXIF_MaxApertureValue 0x9205 00142 #define EXIF_SubjectDistance 0x9206 00143 #define EXIF_MeteringMode 0x9207 00144 #define EXIF_LightSource 0x9208 00145 #define EXIF_Flash 0x9209 00146 #define EXIF_FocalLength 0x920A 00147 #define EXIF_MakerNote 0x927C 00148 #define EXIF_UserComment 0x9286 00149 #define EXIF_SubSecTime 0x9290 00150 #define EXIF_SubSecTimeOriginal 0x9291 00151 #define EXIF_SubSecTimeDigitized 0x9292 00152 #define EXIF_FlashPixVersion 0xA000 00153 #define EXIF_ColorSpace 0xA001 00154 #define EXIF_ExifImageWidth 0xA002 00155 #define EXIF_ExifImageLength 0xA003 00156 #define EXIF_InteroperabilityOffset 0xA005 00157 #define EXIF_FlashEnergy 0xA20B /* 0x920B in TIFF/EP */ 00158 #define EXIF_SpatialFrequencyResponse 0xA20C /* 0x920C - - */ 00159 #define EXIF_FocalPlaneXResolution 0xA20E /* 0x920E - - */ 00160 #define EXIF_FocalPlaneYResolution 0xA20F /* 0x920F - - */ 00161 #define EXIF_FocalPlaneResolutionUnit 0xA210 /* 0x9210 - - */ 00162 #define EXIF_SubjectLocation 0xA214 /* 0x9214 - - */ 00163 #define EXIF_ExposureIndex 0xA215 /* 0x9215 - - */ 00164 #define EXIF_SensingMethod 0xA217 /* 0x9217 - - */ 00165 #define EXIF_FileSource 0xA300 00166 #define EXIF_SceneType 0xA301 00167 00168 #endif /* _gphoto_exif_ */