00001 #ifndef _gphoto_exif_
00002 #define _gphoto_exif_
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <string.h>
00006 #include <time.h>
00007 #include <sys/time.h>
00008 #include <sys/times.h>
00009 #include <fcntl.h>
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 typedef enum {
00026 EXIF_NOTYPE = 0,
00027 EXIF_BYTE = 1,
00028 EXIF_ASCII = 2,
00029 EXIF_SHORT = 3,
00030 EXIF_LONG = 4,
00031 EXIF_RATIONAL = 5,
00032 EXIF_SBYTE = 6,
00033 EXIF_UNDEFINED = 7,
00034 EXIF_SSHORT = 8,
00035 EXIF_SLONG = 9,
00036 EXIF_SRATIONAL = 10,
00037 EXIF_FLOAT = 11,
00038 EXIF_DOUBLE = 12
00039 } EXIFDataType;
00040
00041
00042 typedef struct exif_parser {
00043 char *header,*data,*ifds[10];
00044 int ifdtags[10];
00045 int ifdcnt;
00046 unsigned int exiflen;
00047 int preparsed,endian;
00048 } exifparser;
00049
00050 typedef struct {
00051 int tag;
00052 EXIFDataType type;
00053 int size;
00054 char *data;
00055 int num;
00056 int den;
00057 int intval;
00058 } ExifData;
00059
00060 extern int exif_debug;
00061
00062
00063
00064
00065 int exif_parse_data(exifparser *exifdat);
00066
00067
00068
00069
00070 int gpi_exif_get_field( int tag_number, int ifd, exifparser *exifdat, ExifData *tag_data);
00071
00072
00073
00074
00075 int gpi_exif_get_int_field( int tag_number, int ifd, exifparser *exifdat);
00076
00077
00078
00079
00080 char * gpi_exif_get_ascii_field( int tag_number, int ifd, exifparser *exifdat);
00081
00082
00083
00084
00085 char *gpi_exif_get_tagname(int tag_number);
00086
00087
00088
00089
00090
00091 unsigned char *gpi_exif_get_thumbnail(exifparser *exifdat);
00092
00093
00094
00095
00096
00097 unsigned char *gpi_exif_get_thumbnail_and_size(exifparser *exifdat, long *size);
00098
00099
00100
00101
00102 int gpe_get_comment(exifparser *exifdat, char *comment);
00103
00104
00105
00106
00107 int gpe_set_comment(exifparser *exifdat, char *comment);
00108
00109
00110
00111
00112 int gpi_exif_stat(exifparser *exifdata);
00113 int gpe_dump_exif(exifparser *exifdata);
00114
00115
00116
00117
00118
00119 #define EXIF_InteroperabilityIndex 0x1
00120 #define EXIF_InteroperabilityVersion 0x2
00121 #define EXIF_RelatedImageFileFormat 0x1000
00122 #define EXIF_RelatedImageWidth 0x1001
00123 #define EXIF_RelatedImageLength 0x1002
00124
00125 #define EXIF_NewSubFileType 0xFE
00126 #define EXIF_ImageWidth 0x100
00127 #define EXIF_ImageLength 0x101
00128 #define EXIF_BitsPerSample 0x102
00129 #define EXIF_Compression 0x103
00130 #define EXIF_PhotometricInterpretation 0x106
00131 #define EXIF_FillOrder 0x10A
00132 #define EXIF_DocumentName 0x10D
00133 #define EXIF_ImageDescription 0x10E
00134 #define EXIF_Make 0x10F
00135 #define EXIF_Model 0x110
00136 #define EXIF_StripOffsets 0x111
00137 #define EXIF_Orientation 0x112
00138 #define EXIF_SamplesPerPixel 0x115
00139 #define EXIF_RowsPerStrip 0x116
00140 #define EXIF_StripByteCounts 0x117
00141 #define EXIF_XResolution 0x11A
00142 #define EXIF_YResolution 0x11B
00143 #define EXIF_PlanarConfiguration 0x11C
00144 #define EXIF_ResolutionUnit 0x128
00145 #define EXIF_TransferFunction 0x12D
00146 #define EXIF_Software 0x131
00147 #define EXIF_DateTime 0x132
00148 #define EXIF_Artist 0x13B
00149 #define EXIF_WhitePoint 0x13E
00150 #define EXIF_PrimaryChromaticities 0x13F
00151 #define EXIF_TransferRange 0x156
00152 #define EXIF_JPEGProc 0x200
00153 #define EXIF_JPEGInterchangeFormat 0x201
00154 #define EXIF_JPEGInterchangeFormatLength 0x202
00155 #define EXIF_YCbCrCoefficients 0x211
00156 #define EXIF_YCbCrSubSampling 0x212
00157 #define EXIF_YCbCrPositioning 0x213
00158 #define EXIF_ReferenceBlackWhite 0x214
00159 #define EXIF_CFARepeatPatternDim 0x828D
00160 #define EXIF_CFAPattern 0x828E
00161 #define EXIF_BatteryLevel 0x828F
00162 #define EXIF_Copyright 0x8298
00163 #define EXIF_ExposureTime 0x829A
00164 #define EXIF_FNumber 0x829D
00165
00166
00167 #define EXIF_IPTC_NAA 0x83BB
00168 #define EXIF_ExifOffset 0x8769
00169 #define EXIF_InterColorProfile 0x8773
00170 #define EXIF_ExposureProgram 0x8822
00171 #define EXIF_SpectralSensitivity 0x8824
00172 #define EXIF_GPSInfo 0x8825
00173 #define EXIF_ISOSpeedRatings 0x8827
00174 #define EXIF_OECF 0x8828
00175 #define EXIF_ExifVersion 0x9000
00176 #define EXIF_DateTimeOriginal 0x9003
00177 #define EXIF_DateTimeDigitized 0x9004
00178 #define EXIF_ComponentsConfiguration 0x9101
00179 #define EXIF_CompressedBitsPerPixel 0x9102
00180 #define EXIF_ShutterSpeedValue 0x9201
00181 #define EXIF_ApertureValue 0x9202
00182 #define EXIF_BrightnessValue 0x9203
00183 #define EXIF_ExposureBiasValue 0x9204
00184 #define EXIF_MaxApertureValue 0x9205
00185 #define EXIF_SubjectDistance 0x9206
00186 #define EXIF_MeteringMode 0x9207
00187 #define EXIF_LightSource 0x9208
00188 #define EXIF_Flash 0x9209
00189 #define EXIF_FocalLength 0x920A
00190 #define EXIF_MakerNote 0x927C
00191 #define EXIF_UserComment 0x9286
00192 #define EXIF_SubSecTime 0x9290
00193 #define EXIF_SubSecTimeOriginal 0x9291
00194 #define EXIF_SubSecTimeDigitized 0x9292
00195 #define EXIF_FlashPixVersion 0xA000
00196 #define EXIF_ColorSpace 0xA001
00197 #define EXIF_ExifImageWidth 0xA002
00198 #define EXIF_ExifImageLength 0xA003
00199 #define EXIF_InteroperabilityOffset 0xA005
00200 #define EXIF_FlashEnergy 0xA20B
00201 #define EXIF_SpatialFrequencyResponse 0xA20C
00202 #define EXIF_FocalPlaneXResolution 0xA20E
00203 #define EXIF_FocalPlaneYResolution 0xA20F
00204 #define EXIF_FocalPlaneResolutionUnit 0xA210
00205 #define EXIF_SubjectLocation 0xA214
00206 #define EXIF_ExposureIndex 0xA215
00207 #define EXIF_SensingMethod 0xA217
00208 #define EXIF_FileSource 0xA300
00209 #define EXIF_SceneType 0xA301
00210
00211 #endif