DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_xmp.h00001 /*****************************************************************************/ 00002 // Copyright 2006-2008 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/workarea/stern/camera_raw/dng_sdk/source/dng_xmp.h#17 $ */ 00010 /* $DateTime: 2008/11/04 11:10:05 $ */ 00011 /* $Change: 518908 $ */ 00012 /* $Author: stern $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_xmp__ 00017 #define __dng_xmp__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_classes.h" 00022 #include "dng_types.h" 00023 #include "dng_xmp_sdk.h" 00024 00025 /*****************************************************************************/ 00026 00027 class dng_xmp 00028 { 00029 00030 protected: 00031 00032 // Sync option bits. 00033 00034 enum 00035 { 00036 ignoreXMP = 1, // Force XMP values to match non-XMP 00037 preferXMP = 2, // Prefer XMP values if conflict 00038 preferNonXMP = 4, // Prefer non-XMP values if conflict 00039 requireASCII = 8 // Non-XMP values must be ASCII 00040 }; 00041 00042 dng_memory_allocator &fAllocator; 00043 00044 dng_xmp_sdk *fSDK; 00045 00046 public: 00047 00048 dng_xmp (dng_memory_allocator &allocator); 00049 00050 dng_xmp (const dng_xmp &xmp); 00051 00052 virtual ~dng_xmp (); 00053 00054 void Parse (dng_host &host, 00055 const void *buffer, 00056 uint32 count); 00057 00058 dng_memory_block * Serialize (bool asPacket = false, 00059 uint32 targetBytes = 0, 00060 uint32 padBytes = 4096, 00061 bool forJPEG = false) const; 00062 00063 void PackageForJPEG (AutoPtr<dng_memory_block> &stdBlock, 00064 AutoPtr<dng_memory_block> &extBlock, 00065 dng_string &extDigest) const; 00066 00067 void MergeFromJPEG (const dng_xmp &xmp); 00068 00069 bool HasMeta () const; 00070 00071 bool Exists (const char *ns, 00072 const char *path) const; 00073 00074 bool HasNameSpace (const char *ns) const; 00075 00076 bool IteratePaths (IteratePathsCallback *callback, 00077 void *callbackData, 00078 const char *ns = 0, 00079 const char *path = 0); 00080 00081 void Remove (const char *ns, 00082 const char *path); 00083 00084 void RemoveProperties (const char *ns); 00085 00086 void Set (const char *ns, 00087 const char *path, 00088 const char *text); 00089 00090 bool GetString (const char *ns, 00091 const char *path, 00092 dng_string &s) const; 00093 00094 void SetString (const char *ns, 00095 const char *path, 00096 const dng_string &s); 00097 00098 bool GetStringList (const char *ns, 00099 const char *path, 00100 dng_string_list &list) const; 00101 00102 void SetStringList (const char *ns, 00103 const char *path, 00104 const dng_string_list &list, 00105 bool isBag = false); 00106 00107 void SetStructField (const char *ns, 00108 const char *path, 00109 const char *fieldNS, 00110 const char *fieldName, 00111 const dng_string &s); 00112 00113 void SetStructField (const char *ns, 00114 const char *path, 00115 const char *fieldNS, 00116 const char *fieldName, 00117 const char *s); 00118 00119 void DeleteStructField (const char *ns, 00120 const char *path, 00121 const char *fieldNS, 00122 const char *fieldName); 00123 00124 bool GetStructField (const char *ns, 00125 const char *path, 00126 const char *fieldNS, 00127 const char *fieldName, 00128 dng_string &s) const; 00129 00130 void SetAltLangDefault (const char *ns, 00131 const char *path, 00132 const dng_string &s); 00133 00134 bool GetAltLangDefault (const char *ns, 00135 const char *path, 00136 dng_string &s) const; 00137 00138 bool GetBoolean (const char *ns, 00139 const char *path, 00140 bool &x) const; 00141 00142 void SetBoolean (const char *ns, 00143 const char *path, 00144 bool x); 00145 00146 bool Get_int32 (const char *ns, 00147 const char *path, 00148 int32 &x) const; 00149 00150 void Set_int32 (const char *ns, 00151 const char *path, 00152 int32 x, 00153 bool usePlus = false); 00154 00155 bool Get_uint32 (const char *ns, 00156 const char *path, 00157 uint32 &x) const; 00158 00159 void Set_uint32 (const char *ns, 00160 const char *path, 00161 uint32 x); 00162 00163 bool Get_real64 (const char *ns, 00164 const char *path, 00165 real64 &x) const; 00166 00167 void Set_real64 (const char *ns, 00168 const char *path, 00169 real64 x, 00170 uint32 places = 6, 00171 bool trim = true, 00172 bool usePlus = false); 00173 00174 bool Get_urational (const char *ns, 00175 const char *path, 00176 dng_urational &r) const; 00177 00178 void Set_urational (const char *ns, 00179 const char *path, 00180 const dng_urational &r); 00181 00182 bool Get_srational (const char *ns, 00183 const char *path, 00184 dng_srational &r) const; 00185 00186 void Set_srational (const char *ns, 00187 const char *path, 00188 const dng_srational &r); 00189 00190 bool GetFingerprint (const char *ns, 00191 const char *path, 00192 dng_fingerprint &print) const; 00193 00194 void SetFingerprint (const char *ns, 00195 const char *path, 00196 const dng_fingerprint &print); 00197 00198 dng_fingerprint GetIPTCDigest () const; 00199 00200 void SetIPTCDigest (dng_fingerprint &digest); 00201 00202 void IngestIPTC (dng_negative &negative, 00203 bool xmpIsNewer = false); 00204 00205 void RebuildIPTC (dng_negative &negative, 00206 bool padForTIFF, 00207 bool forceUTF8); 00208 00209 virtual void SyncExif (dng_exif &exif, 00210 const dng_exif *originalExif = NULL, 00211 bool doingUpdateFromXMP = false); 00212 00213 void ValidateStringList (const char *ns, 00214 const char *path); 00215 00216 void ValidateMetadata (); 00217 00218 void UpdateDateTime (const dng_date_time_info &dt); 00219 00220 void UpdateExifDates (dng_exif &exif); 00221 00222 bool HasOrientation () const; 00223 00224 dng_orientation GetOrientation () const; 00225 00226 void ClearOrientation (); 00227 00228 void SetOrientation (const dng_orientation &orientation); 00229 00230 void SyncOrientation (dng_negative &negative, 00231 bool xmpIsMaster); 00232 00233 void ClearImageInfo (); 00234 00235 void SetImageSize (const dng_point &size); 00236 00237 void SetSampleInfo (uint32 samplesPerPixel, 00238 uint32 bitsPerSample); 00239 00240 void SetPhotometricInterpretation (uint32 pi); 00241 00242 void SetResolution (const dng_resolution &res); 00243 00244 void ComposeArrayItemPath (const char *ns, 00245 const char *arrayName, 00246 int32 itemNumber, 00247 dng_string &s) const; 00248 00249 void ComposeStructFieldPath (const char *ns, 00250 const char *structName, 00251 const char *fieldNS, 00252 const char *fieldName, 00253 dng_string &s) const; 00254 00255 int32 CountArrayItems (const char *ns, 00256 const char *path) const; 00257 00258 void AppendArrayItem (const char *ns, 00259 const char *arrayName, 00260 const char *itemValue, 00261 bool isBag = true, 00262 bool propIsStruct = false); 00263 00264 static dng_string EncodeFingerprint (const dng_fingerprint &f); 00265 00266 static dng_fingerprint DecodeFingerprint (const dng_string &s); 00267 00268 protected: 00269 00270 static void TrimDecimal (char *s); 00271 00272 static dng_string EncodeGPSVersion (uint32 version); 00273 00274 static uint32 DecodeGPSVersion (const dng_string &s); 00275 00276 static dng_string EncodeGPSCoordinate (const dng_string &ref, 00277 const dng_urational *coord); 00278 00279 static void DecodeGPSCoordinate (const dng_string &s, 00280 dng_string &ref, 00281 dng_urational *coord); 00282 00283 static dng_string EncodeGPSDateTime (const dng_string &dateStamp, 00284 const dng_urational *timeStamp); 00285 00286 static void DecodeGPSDateTime (const dng_string &s, 00287 dng_string &dateStamp, 00288 dng_urational *timeStamp); 00289 00290 bool SyncString (const char *ns, 00291 const char *path, 00292 dng_string &s, 00293 uint32 options = 0); 00294 00295 void SyncStringList (const char *ns, 00296 const char *path, 00297 dng_string_list &list, 00298 bool isBag = false, 00299 uint32 options = 0); 00300 00301 bool SyncAltLangDefault (const char *ns, 00302 const char *path, 00303 dng_string &s, 00304 uint32 options = 0); 00305 00306 void Sync_uint32 (const char *ns, 00307 const char *path, 00308 uint32 &x, 00309 bool isDefault = false, 00310 uint32 options = 0); 00311 00312 void Sync_uint32_array (const char *ns, 00313 const char *path, 00314 uint32 *data, 00315 uint32 &count, 00316 uint32 maxCount, 00317 uint32 options = 0); 00318 00319 void Sync_urational (const char *ns, 00320 const char *path, 00321 dng_urational &r, 00322 uint32 options = 0); 00323 00324 void Sync_srational (const char *ns, 00325 const char *path, 00326 dng_srational &r, 00327 uint32 options = 0); 00328 00329 void SyncIPTC (dng_iptc &iptc, 00330 uint32 options); 00331 00332 void SyncFlash (uint32 &flashState, 00333 uint32 &flashMask, 00334 uint32 options); 00335 00336 private: 00337 00338 // Hidden assignment operator. 00339 00340 dng_xmp & operator= (const dng_xmp &xmp); 00341 00342 }; 00343 00344 /*****************************************************************************/ 00345 00346 #endif 00347 00348 /*****************************************************************************/ |