XMP_Const.h

Go to the documentation of this file.
00001 #ifndef __XMP_Const_h__
00002 #define __XMP_Const_h__ 1
00003 
00004 /* --------------------------------------------------------------------------------------------- */
00005 /* ** IMPORTANT ** This file must be usable by strict ANSI C compilers. No "//" comments, etc.   */
00006 /* --------------------------------------------------------------------------------------------- */
00007 
00008 /*
00009 // =================================================================================================
00010 // Copyright 2002-2007 Adobe Systems Incorporated
00011 // All Rights Reserved.
00012 //
00013 // NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
00014 // of the Adobe license agreement accompanying it.
00015 // =================================================================================================
00016 */
00017 
00018 #include "XMP_Environment.h"
00019 
00020    #include <stddef.h>
00021 
00022 #if XMP_MacBuild    /* ! No stdint.h on Windows and some UNIXes. */
00023     #include <stdint.h>
00024 #endif
00025 
00026 #if __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 
00037 /* ============================================================================================== */
00038 /* Basic types and constants */
00039 /* ========================= */
00040 
00041 /* The XMP_... types are used on the off chance that the ..._t types present a problem. In that */
00042 /* case only the declarations of the XMP_... types needs to change, not all of the uses. These  */
00043 /* types are used where fixed sizes are required in order to have a known ABI for a DLL build.  */
00044 
00045 #if XMP_MacBuild
00046 
00047     typedef int8_t   XMP_Int8;
00048     typedef int16_t  XMP_Int16;
00049     typedef int32_t  XMP_Int32;
00050     typedef int64_t  XMP_Int64;
00051 
00052     typedef uint8_t  XMP_Uns8;
00053     typedef uint16_t XMP_Uns16;
00054     typedef uint32_t XMP_Uns32;
00055     typedef uint64_t XMP_Uns64;
00056 
00057 #else
00058 
00059     typedef signed char XMP_Int8;
00060     typedef signed short XMP_Int16;
00061     typedef signed long XMP_Int32;
00062     typedef signed long long XMP_Int64;
00063 
00064     typedef unsigned char XMP_Uns8;
00065     typedef unsigned short XMP_Uns16;
00066     typedef unsigned long XMP_Uns32;
00067     typedef unsigned long long XMP_Uns64;
00068 
00069 #endif
00070 
00071 typedef XMP_Uns8 XMP_Bool;
00072 
00073 /* Typedefs to preserve old, unfortunate spellings: */
00074 
00075 #if 0 /* *** Enable after internal compiles work. */
00076 typedef XMP_Int8  XMPInt8;
00077 typedef XMP_Int16 XMPInt16;
00078 typedef XMP_Int32 XMPInt32;
00079 typedef XMP_Int64 XMPInt64;
00080 typedef XMP_Uns8  XMPUns8;
00081 typedef XMP_Uns16 XMPUns16;
00082 typedef XMP_Uns32 XMPUns32;
00083 typedef XMP_Uns64 XMPUns64;
00084 typedef XMP_Bool  XMPBool;
00085 #endif
00086 
00095 typedef struct __XMPMeta__ *        XMPMetaRef;
00096 typedef struct __XMPIterator__ *    XMPIteratorRef;
00097 typedef struct __XMPFiles__ *       XMPFilesRef;
00098 
00099 /* ============================================================================================== */
00100 
00132 typedef const char * XMP_StringPtr;  /* Points to a null terminated UTF-8 string. */
00133 typedef XMP_Uns32    XMP_StringLen;
00134 typedef XMP_Int32    XMP_Index;      /* Signed, sometimes -1 is handy. */
00135 typedef XMP_Uns32    XMP_OptionBits; /* Used as 32 individual bits. */
00136 
00149 #define kXMP_TrueStr  "True"  /* Serialized XMP spellings, not for the type bool. */
00150 #define kXMP_FalseStr "False"
00151 
00156 /* ============================================================================================== */
00157 
00190 struct XMP_DateTime {
00191     XMP_Int32 year;
00192     XMP_Int32 month;      /* 1..12 */
00193     XMP_Int32 day;        /* 1..31 */
00194     XMP_Int32 hour;       /* 0..23 */
00195     XMP_Int32 minute;     /* 0..59 */
00196     XMP_Int32 second;     /* 0..59 */
00197     XMP_Int32 tzSign;     /* -1..+1, 0 means UTC, -1 is west, +1 is east. */
00198     XMP_Int32 tzHour;     /* 0..23 */
00199     XMP_Int32 tzMinute;   /* 0..59 */
00200     XMP_Int32 nanoSecond;
00201 };
00202 
00203 enum {  /* Values used for tzSign field. */
00204     kXMP_TimeWestOfUTC = -1,
00205     kXMP_TimeIsUTC     =  0,
00206     kXMP_TimeEastOfUTC = +1
00207 };
00208 
00209 
00210 /* ============================================================================================== */
00211 /* Standard namespace URI constants */
00212 /* ================================ */
00213 
00273 #define kXMP_NS_XMP        "http://ns.adobe.com/xap/1.0/"
00274 
00275 #define kXMP_NS_XMP_Rights "http://ns.adobe.com/xap/1.0/rights/"
00276 #define kXMP_NS_XMP_MM     "http://ns.adobe.com/xap/1.0/mm/"
00277 #define kXMP_NS_XMP_BJ     "http://ns.adobe.com/xap/1.0/bj/"
00278 
00279 #define kXMP_NS_PDF        "http://ns.adobe.com/pdf/1.3/"
00280 #define kXMP_NS_Photoshop  "http://ns.adobe.com/photoshop/1.0/"
00281 #define kXMP_NS_PSAlbum    "http://ns.adobe.com/album/1.0/"
00282 #define kXMP_NS_EXIF       "http://ns.adobe.com/exif/1.0/"
00283 #define kXMP_NS_EXIF_Aux   "http://ns.adobe.com/exif/1.0/aux/"
00284 #define kXMP_NS_TIFF       "http://ns.adobe.com/tiff/1.0/"
00285 #define kXMP_NS_PNG        "http://ns.adobe.com/png/1.0/"
00286 #define kXMP_NS_SWF        "http://ns.adobe.com/swf/1.0/"
00287 #define kXMP_NS_JPEG       "http://ns.adobe.com/jpeg/1.0/"
00288 #define kXMP_NS_JP2K       "http://ns.adobe.com/jp2k/1.0/"
00289 #define kXMP_NS_CameraRaw  "http://ns.adobe.com/camera-raw-settings/1.0/"
00290 #define kXMP_NS_DM         "http://ns.adobe.com/xmp/1.0/DynamicMedia/"
00291 #define kXMP_NS_ASF        "http://ns.adobe.com/asf/1.0/"
00292 #define kXMP_NS_WAV        "http://ns.adobe.com/xmp/wav/1.0/"
00293 
00294 #define kXMP_NS_XMP_Note   "http://ns.adobe.com/xmp/note/"
00295 
00296 #define kXMP_NS_AdobeStockPhoto "http://ns.adobe.com/StockPhoto/1.0/"
00297 
00342 #define kXMP_NS_XMP_IdentifierQual "http://ns.adobe.com/xmp/Identifier/qual/1.0/"
00343 #define kXMP_NS_XMP_Dimensions     "http://ns.adobe.com/xap/1.0/sType/Dimensions#"
00344 #define kXMP_NS_XMP_Text           "http://ns.adobe.com/xap/1.0/t/"
00345 #define kXMP_NS_XMP_PagedFile      "http://ns.adobe.com/xap/1.0/t/pg/"
00346 #define kXMP_NS_XMP_Graphics       "http://ns.adobe.com/xap/1.0/g/"
00347 #define kXMP_NS_XMP_Image          "http://ns.adobe.com/xap/1.0/g/img/"
00348 #define kXMP_NS_XMP_Font           "http://ns.adobe.com/xap/1.0/sType/Font#"
00349 #define kXMP_NS_XMP_ResourceEvent  "http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
00350 #define kXMP_NS_XMP_ResourceRef    "http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
00351 #define kXMP_NS_XMP_ST_Version     "http://ns.adobe.com/xap/1.0/sType/Version#"
00352 #define kXMP_NS_XMP_ST_Job         "http://ns.adobe.com/xap/1.0/sType/Job#"
00353 #define kXMP_NS_XMP_ManifestItem   "http://ns.adobe.com/xap/1.0/sType/ManifestItem#"
00354 
00355 /* Deprecated constant names */
00356 #define kXMP_NS_XMP_T     "http://ns.adobe.com/xap/1.0/t/"
00357 #define kXMP_NS_XMP_T_PG  "http://ns.adobe.com/xap/1.0/t/pg/"
00358 #define kXMP_NS_XMP_G_IMG "http://ns.adobe.com/xap/1.0/g/img/"
00359 
00389 #define kXMP_NS_DC       "http://purl.org/dc/elements/1.1/"
00390 
00391 #define kXMP_NS_IPTCCore "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"
00392 
00393 #define kXMP_NS_PDFA_Schema    "http://www.aiim.org/pdfa/ns/schema#"
00394 #define kXMP_NS_PDFA_Property  "http://www.aiim.org/pdfa/ns/property#"
00395 #define kXMP_NS_PDFA_Type      "http://www.aiim.org/pdfa/ns/type#"
00396 #define kXMP_NS_PDFA_Field     "http://www.aiim.org/pdfa/ns/field#"
00397 #define kXMP_NS_PDFA_ID        "http://www.aiim.org/pdfa/ns/id/"
00398 #define kXMP_NS_PDFA_Extension "http://www.aiim.org/pdfa/ns/extension/"
00399 
00400 #define kXMP_NS_PDFX           "http://ns.adobe.com/pdfx/1.3/"
00401 #define kXMP_NS_PDFX_ID        "http://www.npes.org/pdfx/ns/id/"
00402 
00403 #define kXMP_NS_RDF      "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
00404 #define kXMP_NS_XML      "http://www.w3.org/XML/1998/namespace"
00405 
00406 
00407 /* ============================================================================================== */
00408 /* Enums and macros used for option bits */
00409 /* ===================================== */
00410 
00411 #define kXMP_ArrayLastItem      ((XMP_Index)(-1L))
00412 #define kXMP_UseNullTermination ((XMP_StringLen)(~0UL))
00413 
00414 #define kXMP_NoOptions          ((XMP_OptionBits)0UL)
00415 
00416 #define XMP_SetOption(var,opt)      var |= (opt)
00417 #define XMP_ClearOption(var,opt)    var &= ~(opt)
00418 #define XMP_TestOption(var,opt)     (((var) & (opt)) != 0)
00419 #define XMP_OptionIsSet(var,opt)    (((var) & (opt)) != 0)
00420 #define XMP_OptionIsClear(var,opt)  (((var) & (opt)) == 0)
00421 
00422 #define XMP_PropIsSimple(opt)       (((opt) & kXMP_PropCompositeMask) == 0)
00423 #define XMP_PropIsStruct(opt)       (((opt) & kXMP_PropValueIsStruct) != 0)
00424 #define XMP_PropIsArray(opt)        (((opt) & kXMP_PropValueIsArray) != 0)
00425 #define XMP_ArrayIsUnordered(opt)   (((opt) & kXMP_PropArrayIsOrdered) == 0)
00426 #define XMP_ArrayIsOrdered(opt)     (((opt) & kXMP_PropArrayIsOrdered) != 0)
00427 #define XMP_ArrayIsAlternate(opt)   (((opt) & kXMP_PropArrayIsAlternate) != 0)
00428 #define XMP_ArrayIsAltText(opt)     (((opt) & kXMP_PropArrayIsAltText) != 0)
00429 
00430 #define XMP_PropHasQualifiers(opt)  (((opt) & kXMP_PropHasQualifiers) != 0)
00431 #define XMP_PropIsQualifier(opt)    (((opt) & kXMP_PropIsQualifier) != 0)
00432 #define XMP_PropHasLang(opt)        (((opt) & kXMP_PropHasLang) != 0)
00433 
00434 #define XMP_NodeIsSchema(opt)       (((opt) & kXMP_SchemaNode) != 0)
00435 #define XMP_PropIsAlias(opt)        (((opt) & kXMP_PropIsAlias) != 0)
00436 
00437 /* ---------------------------------------------------------------------------------------------- */
00438 
00439 enum {  /* Option bits returned from the TXMPMeta::GetXyz functions. */
00440 
00441     /* Options relating to the XML string form of the property value. */
00442     kXMP_PropValueIsURI       = 0x00000002UL,  /* The value is a URI, use rdf:resource attribute. DISCOURAGED */
00443 
00444     /* Options relating to qualifiers attached to a property. */
00445     kXMP_PropHasQualifiers    = 0x00000010UL,  /* The property has qualifiers, includes rdf:type and xml:lang. */
00446     kXMP_PropIsQualifier      = 0x00000020UL,  /* This is a qualifier, includes rdf:type and xml:lang. */
00447     kXMP_PropHasLang          = 0x00000040UL,  /* Implies kXMP_PropHasQualifiers, property has xml:lang. */
00448     kXMP_PropHasType          = 0x00000080UL,  /* Implies kXMP_PropHasQualifiers, property has rdf:type. */
00449 
00450     /* Options relating to the data structure form. */
00451     kXMP_PropValueIsStruct    = 0x00000100UL,  /* The value is a structure with nested fields. */
00452     kXMP_PropValueIsArray     = 0x00000200UL,  /* The value is an array (RDF alt/bag/seq). */
00453     kXMP_PropArrayIsUnordered = kXMP_PropValueIsArray,  /* The item order does not matter. */
00454     kXMP_PropArrayIsOrdered   = 0x00000400UL,  /* Implies kXMP_PropValueIsArray, item order matters. */
00455     kXMP_PropArrayIsAlternate = 0x00000800UL,  /* Implies kXMP_PropArrayIsOrdered, items are alternates. */
00456 
00457     /* Additional struct and array options. */
00458     kXMP_PropArrayIsAltText   = 0x00001000UL,  /* Implies kXMP_PropArrayIsAlternate, items are localized text. */
00459     /* kXMP_InsertBeforeItem  = 0x00004000UL,  ! Used by SetXyz functions. */
00460     /* kXMP_InsertAfterItem   = 0x00008000UL,  ! Used by SetXyz functions. */
00461 
00462     /* Other miscellaneous options. */
00463     kXMP_PropIsAlias          = 0x00010000UL,  /* This property is an alias name for another property. */
00464     kXMP_PropHasAliases       = 0x00020000UL,  /* This property is the base value for a set of aliases. */
00465     kXMP_PropIsInternal       = 0x00040000UL,  /* This property is an "internal" property, owned by applications. */
00466     kXMP_PropIsStable         = 0x00100000UL,  /* This property is not derived from the document content. */
00467     kXMP_PropIsDerived        = 0x00200000UL,  /* This property is derived from the document content. */
00468     /* kXMPUtil_AllowCommas   = 0x10000000UL,  ! Used by TXMPUtils::CatenateArrayItems and ::SeparateArrayItems. */
00469     /* kXMP_DeleteExisting    = 0x20000000UL,  ! Used by TXMPMeta::SetXyz functions to delete any pre-existing property. */
00470     /* kXMP_SchemaNode        = 0x80000000UL,  ! Returned by iterators - #define to avoid warnings */
00471 
00472     /* Masks that are multiple flags. */
00473     kXMP_PropArrayFormMask    = kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText,
00474     kXMP_PropCompositeMask    = kXMP_PropValueIsStruct | kXMP_PropArrayFormMask,  /* Is it simple or composite (array or struct)? */
00475     kXMP_ImplReservedMask     = 0x70000000L   /* Reserved for transient use by the implementation. */
00476 };
00477 
00478 #define kXMP_SchemaNode ((XMP_OptionBits)0x80000000UL)
00479 
00480 enum {  /* Option bits for the TXMPMeta::SetXyz functions. */
00481 
00482     /* Options shared with GetXyz functions. */
00483     /*
00484     kXMP_PropValueIsURI        = 0x00000002UL, DISCOURAGED
00485     kXMP_PropValueIsStruct     = 0x00000100UL,
00486     kXMP_PropValueIsArray      = 0x00000200UL,
00487     kXMP_PropArrayIsOrdered    = 0x00000400UL,
00488     kXMP_PropArrayIsAlternate  = 0x00000800UL,
00489     kXMP_PropArrayIsAltText    = 0x00001000UL,
00490     kXMP_PropValueIsCompact    = 0x00002000UL, RESERVED
00491     */
00492 
00493     /* Options for array item location. */
00494     kXMP_InsertBeforeItem      = 0x00004000UL,  /* Insert a new item before the given index. */
00495     kXMP_InsertAfterItem       = 0x00008000UL,  /* Insert a new item after the given index. */
00496 
00497     /* Miscellaneous options */
00498     kXMP_DeleteExisting        = 0x20000000UL,  /* Delete any pre-existing property. */
00499 
00500     /* Masks that are multiple flags. */
00501     kXMP_PropValueOptionsMask  = kXMP_PropValueIsURI,
00502     kXMP_PropArrayLocationMask = kXMP_InsertBeforeItem | kXMP_InsertAfterItem
00503 
00504 };
00505 
00506 /* ---------------------------------------------------------------------------------------------- */
00507 
00508 enum {  /* Options for TXMPMeta::ParseFromBuffer. */
00509     kXMP_RequireXMPMeta   = 0x0001UL,  /* Require a surrounding x:xmpmeta element. */
00510     kXMP_ParseMoreBuffers = 0x0002UL,  /* This is the not last input buffer for this parse stream. */
00511     kXMP_StrictAliasing   = 0x0004UL   /* Do not reconcile alias differences, throw an exception. */
00512 };
00513 
00514 enum {  /* Options for TXMPMeta::SerializeToBuffer. */
00515 
00516     /* *** Option to remove empty struct/array, or leaf with empty value? */
00517 
00518     kXMP_OmitPacketWrapper   = 0x0010UL,  /* Omit the XML packet wrapper. */
00519     kXMP_ReadOnlyPacket      = 0x0020UL,  /* Default is a writeable packet. */
00520     kXMP_UseCompactFormat    = 0x0040UL,  /* Use a compact form of RDF. */
00521 
00522     kXMP_IncludeThumbnailPad = 0x0100UL,  /* Include a padding allowance for a thumbnail image. */
00523     kXMP_ExactPacketLength   = 0x0200UL,  /* The padding parameter is the overall packet length. */
00524     kXMP_WriteAliasComments  = 0x0400UL,  /* Show aliases as XML comments. */
00525     kXMP_OmitAllFormatting   = 0x0800UL,  /* Omit all formatting whitespace. */
00526 
00527     _XMP_LittleEndian_Bit    = 0x0001UL,  /* ! Don't use directly, see the combined values below! */
00528     _XMP_UTF16_Bit           = 0x0002UL,
00529     _XMP_UTF32_Bit           = 0x0004UL,
00530 
00531     kXMP_EncodingMask        = 0x0007UL,
00532     kXMP_EncodeUTF8          = 0UL,
00533     kXMP_EncodeUTF16Big      = _XMP_UTF16_Bit,
00534     kXMP_EncodeUTF16Little   = _XMP_UTF16_Bit | _XMP_LittleEndian_Bit,
00535     kXMP_EncodeUTF32Big      = _XMP_UTF32_Bit,
00536     kXMP_EncodeUTF32Little   = _XMP_UTF32_Bit | _XMP_LittleEndian_Bit
00537 
00538 };
00539 
00540 /* ---------------------------------------------------------------------------------------------- */
00541 
00542 enum {  /* Options for TXMPIterator construction. */
00543 
00544     kXMP_IterClassMask      = 0x00FFUL,  /* The low 8 bits are an enum of what data structure to iterate. */
00545     kXMP_IterProperties     = 0x0000UL,  /* Iterate the property tree of a TXMPMeta object. */
00546     kXMP_IterAliases        = 0x0001UL,  /* Iterate the global alias table. */
00547     kXMP_IterNamespaces     = 0x0002UL,  /* Iterate the global namespace table. */
00548     kXMP_IterJustChildren   = 0x0100UL,  /* Just do the immediate children of the root, default is subtree. */
00549     kXMP_IterJustLeafNodes  = 0x0200UL,  /* Just do the leaf nodes, default is all nodes in the subtree. */
00550     kXMP_IterJustLeafName   = 0x0400UL,  /* Return just the leaf part of the path, default is the full path. */
00551     kXMP_IterIncludeAliases = 0x0800UL,  /* Include aliases, default is just actual properties. */
00552 
00553     kXMP_IterOmitQualifiers = 0x1000UL   /* Omit all qualifiers. */
00554 
00555 };
00556 
00557 enum {  /* Options for TXMPIterator::Skip. */
00558     kXMP_IterSkipSubtree    = 0x0001UL,  /* Skip the subtree below the current node. */
00559     kXMP_IterSkipSiblings   = 0x0002UL   /* Skip the subtree below and remaining siblings of the current node. */
00560 };
00561 
00562 /* ---------------------------------------------------------------------------------------------- */
00563 
00564 enum {  /* Options for TXMPUtils::CatenateArrayItems and TXMPUtils::SeparateArrayItems. */
00565 
00566     /* Options shared with GetXyz functions. */
00567     /*
00568     kXMP_PropValueIsArray     = 0x00000200UL,
00569     kXMP_PropArrayIsOrdered   = 0x00000400UL,
00570     kXMP_PropArrayIsAlternate = 0x00000800UL,
00571     kXMP_PropArrayIsAltText   = 0x00001000UL,
00572     */
00573 
00574     kXMPUtil_AllowCommas      = 0x10000000UL   /* Allow commas in item values, default is separator. */
00575 
00576 };
00577 
00578 enum {  /* Options for TXMPUtils::RemoveProperties and TXMPUtils::AppendProperties. */
00579     kXMPUtil_DoAllProperties   = 0x0001UL,  /* Do all properties, default is just external properties. */
00580     kXMPUtil_ReplaceOldValues  = 0x0002UL,  /* Replace existing values, default is to leave them. */
00581     kXMPUtil_DeleteEmptyValues = 0x0004UL,  /* Delete properties if the new value is empty. */
00582     kXMPUtil_IncludeAliases    = 0x0800UL   /* == kXMP_IterIncludeAliases */
00583 };
00584 
00585 /* ============================================================================================== */
00586 /* Types and Constants for XMP File Handler */
00587 /* ======================================== */
00588 
00589 enum {
00590 
00591     /* Public file formats. Hex used to avoid gcc warnings. */
00592     /* ! Leave them as big endian. There seems to be no decent way on UNIX to determine the target */
00593     /* ! endianness at compile time. Forcing it on the client isn't acceptable.                    */
00594 
00595     kXMP_PDFFile             = 0x50444620UL,  /* 'PDF ' */
00596     kXMP_PostScriptFile      = 0x50532020UL,  /* 'PS  ', general PostScript following DSC conventions. */
00597     kXMP_EPSFile             = 0x45505320UL,  /* 'EPS ', encapsulated PostScript. */
00598 
00599     kXMP_JPEGFile            = 0x4A504547UL,  /* 'JPEG' */
00600     kXMP_JPEG2KFile          = 0x4A505820UL,  /* 'JPX ', ISO 15444-1 */
00601     kXMP_TIFFFile            = 0x54494646UL,  /* 'TIFF' */
00602     kXMP_GIFFile             = 0x47494620UL,  /* 'GIF ' */
00603     kXMP_PNGFile             = 0x504E4720UL,  /* 'PNG ' */
00604     
00605     kXMP_SWFFile             = 0x53574620UL,  /* 'SWF ' */
00606     kXMP_FLAFile             = 0x464C4120UL,  /* 'FLA ' */
00607     kXMP_FLVFile             = 0x464C5620UL,  /* 'FLV ' */
00608 
00609     kXMP_MOVFile             = 0x4D4F5620UL,  /* 'MOV ', Quicktime */
00610     kXMP_AVIFile             = 0x41564920UL,  /* 'AVI ' */
00611     kXMP_CINFile             = 0x43494E20UL,  /* 'CIN ', Cineon */
00612     kXMP_WAVFile             = 0x57415620UL,  /* 'WAV ' */
00613     kXMP_MP3File             = 0x4D503320UL,  /* 'MP3 ' */
00614     kXMP_SESFile             = 0x53455320UL,  /* 'SES ', Audition session */
00615     kXMP_CELFile             = 0x43454C20UL,  /* 'CEL ', Audition loop */
00616     kXMP_MPEGFile            = 0x4D504547UL,  /* 'MPEG' */
00617     kXMP_MPEG2File           = 0x4D503220UL,  /* 'MP2 ' */
00618     kXMP_MPEG4File           = 0x4D503420UL,  /* 'MP4 ', ISO 14494-12 and -14 */
00619     kXMP_WMAVFile            = 0x574D4156UL,  /* 'WMAV', Windows Media Audio and Video */
00620     kXMP_AIFFFile            = 0x41494646UL,  /* 'AIFF' */
00621 
00622     kXMP_HTMLFile            = 0x48544D4CUL,  /* 'HTML' */
00623     kXMP_XMLFile             = 0x584D4C20UL,  /* 'XML ' */
00624     kXMP_TextFile            = 0x74657874UL,  /* 'text' */
00625 
00626     /* Adobe application file formats. */
00627 
00628     kXMP_PhotoshopFile       = 0x50534420UL,  /* 'PSD ' */
00629     kXMP_IllustratorFile     = 0x41492020UL,  /* 'AI  ' */
00630     kXMP_InDesignFile        = 0x494E4444UL,  /* 'INDD' */
00631     kXMP_AEProjectFile       = 0x41455020UL,  /* 'AEP ' */
00632     kXMP_AEProjTemplateFile  = 0x41455420UL,  /* 'AET ', After Effects Project Template */
00633     kXMP_AEFilterPresetFile  = 0x46465820UL,  /* 'FFX ' */
00634     kXMP_EncoreProjectFile   = 0x4E434F52UL,  /* 'NCOR' */
00635     kXMP_PremiereProjectFile = 0x5052504AUL,  /* 'PRPJ' */
00636     kXMP_PremiereTitleFile   = 0x5052544CUL,  /* 'PRTL' */
00637 
00638     /* Catch all. */
00639 
00640     kXMP_UnknownFile         = 0x20202020UL   /* '    ' */
00641 
00642 };
00643 typedef XMP_Uns32 XMP_FileFormat;
00644 
00645 /* ---------------------------------------------------------------------------------------------- */
00646 
00647 enum {
00648     kXMP_CharLittleEndianMask = 1,
00649     kXMP_Char16BitMask        = 2,  /* Don't use these directly. */
00650     kXMP_Char32BitMask        = 4
00651 };
00652 
00653 enum {  /* The values allow easy testing for 16/32 bit and big/little endian. */
00654     kXMP_Char8Bit        = 0,
00655     kXMP_Char16BitBig    = kXMP_Char16BitMask,
00656     kXMP_Char16BitLittle = kXMP_Char16BitMask | kXMP_CharLittleEndianMask,
00657     kXMP_Char32BitBig    = kXMP_Char32BitMask,
00658     kXMP_Char32BitLittle = kXMP_Char32BitMask | kXMP_CharLittleEndianMask,
00659     kXMP_CharUnknown     = 1 /* ! A bit of a hack, for variable or not-yet-known cases. */
00660 };
00661 
00662 #define XMP_CharFormIs16Bit(f)         ( ((int)(f) & kXMP_Char16BitMask) != 0 )
00663 #define XMP_CharFormIs32Bit(f)         ( ((int)(f) & kXMP_Char32BitMask) != 0 )
00664 
00665 #define XMP_CharFormIsBigEndian(f)     ( ((int)(f) & kXMP_CharLittleEndianMask) == 0 )
00666 #define XMP_CharFormIsLittleEndian(f)  ( ((int)(f) & kXMP_CharLittleEndianMask) != 0 )
00667 
00668 #define XMP_GetCharSize(f)             ( ((int)(f)&6) == 0 ? 1 : (int)(f)&6 )
00669 
00670 #define XMP_CharToSerializeForm(cf)    ( (XMP_OptionBits)(cf) )
00671 #define XMP_CharFromSerializeForm(sf)  ( (XMP_Uns8)(sf) )
00672 
00673 struct XMP_PacketInfo {
00674     XMP_Int64 offset;
00675     XMP_Int32 length;
00676     XMP_Int32 padSize;   /* Zero if unknown. */
00677     XMP_Uns8  charForm;
00678     XMP_Bool  writeable;
00679     XMP_Uns8  pad1, pad2;
00680     #if __cplusplus
00681         XMP_PacketInfo() : offset(0), length(0), padSize(0), charForm(0), writeable(0), pad1(0), pad2(0) {};
00682     #endif
00683 };
00684 #if ! __cplusplus
00685     typedef struct XMP_PacketInfo XMP_PacketInfo;
00686 #endif
00687 enum { kXMP_PacketInfoVersion = 3 };
00688 
00689 /* ---------------------------------------------------------------------------------------------- */
00690 
00691 enum {  /* Values for XMP_ThumbnailInfo.tnailFormat. */
00692     kXMP_UnknownTNail = 0, /* The thumbnail data has an unknown format. */
00693     kXMP_JPEGTNail    = 1, /* The thumbnail data is a JPEG stream, presumably compressed. */
00694     kXMP_TIFFTNail    = 2, /* The thumbnail data is a TIFF stream, presumably uncompressed. */
00695     kXMP_PShopTNail   = 3  /* The thumbnail data is in the format of Photoshop Image Resource 1036. */
00696 };
00697 
00698 struct XMP_ThumbnailInfo {
00699     XMP_FileFormat   fileFormat;  /* The format of the containing file. */
00700     XMP_Uns32        fullWidth, fullHeight;    /* Full image size in pixels. */
00701     XMP_Uns32        tnailWidth, tnailHeight;  /* Thumbnail image size in pixels. */
00702     XMP_Uns16        fullOrientation, tnailOrientation;  /* Orientation of full image and thumbnail, as defined by Exif for tag 274. */
00703     const XMP_Uns8 * tnailImage;   /* Raw data from the host file, valid for life of the owning XMPFiles object. Do not modify! */
00704     XMP_Uns32        tnailSize;    /* The size in bytes of the tnailImage data. */
00705     XMP_Uns8         tnailFormat;  /* The format of the tnailImage data. */
00706     XMP_Uns8         pad1, pad2, pad3;
00707     #if __cplusplus
00708         XMP_ThumbnailInfo() : fileFormat(kXMP_UnknownFile), fullWidth(0), fullHeight(0),
00709                               tnailWidth(0), tnailHeight(0), fullOrientation(0), tnailOrientation(0),
00710                               tnailImage(0), tnailSize(0), tnailFormat(kXMP_UnknownTNail) {};
00711     #endif
00712 };
00713 #if ! __cplusplus
00714     typedef struct XMP_ThumbnailInfo XMP_ThumbnailInfo;
00715 #endif
00716 enum { kXMP_ThumbnailInfoVersion = 1 };
00717 
00718 /* ---------------------------------------------------------------------------------------------- */
00719 
00720 #define kXMPFiles_UnknownOffset ((XMP_Int64)-1)
00721 #define kXMPFiles_UnknownLength ((XMP_Int32)-1)
00722 
00723 enum {  /* Options for Initialize. */
00724     kXMPFiles_NoQuickTimeInit = 0x0001 /* Don't initialize QuickTime, the client will. */
00725 };
00726 
00727 enum {  /* Options for GetFormatInfo. */ 
00728     kXMPFiles_CanInjectXMP        = 0x00000001, /* Can inject first-time XMP into an existing file. */
00729     kXMPFiles_CanExpand           = 0x00000002, /* Can expand XMP or other metadata in an existing file. */
00730     kXMPFiles_CanRewrite          = 0x00000004, /* Can copy one file to another, writing new metadata. */
00731     kXMPFiles_PrefersInPlace      = 0x00000008, /* Can expand, but prefers in-place update. */
00732     kXMPFiles_CanReconcile        = 0x00000010, /* Supports reconciliation between XMP and other forms. */
00733     kXMPFiles_AllowsOnlyXMP       = 0x00000020, /* Allows access to just the XMP, ignoring other forms. */
00734     kXMPFiles_ReturnsRawPacket    = 0x00000040, /* File handler returns raw XMP packet information. */
00735     kXMPFiles_ReturnsTNail        = 0x00000080, /* File handler returns native thumbnail. */
00736     kXMPFiles_HandlerOwnsFile     = 0x00000100, /* The file handler does the file open and close. */
00737     kXMPFiles_AllowsSafeUpdate    = 0x00000200, /* The file handler allows crash-safe file updates. */
00738     kXMPFiles_NeedsReadOnlyPacket = 0x00000400, /* The file format needs the XMP packet to be read-only. */
00739     kXMPFiles_UsesSidecarXMP      = 0x00000800  /* The file handler uses a "sidecar" file for the XMP. */
00740 };
00741 
00742 enum {  /* Options for OpenFile. */
00743     kXMPFiles_OpenForRead           = 0x00000001, /* Open for read-only access. */
00744     kXMPFiles_OpenForUpdate         = 0x00000002, /* Open for reading and writing. */
00745     kXMPFiles_OpenOnlyXMP           = 0x00000004, /* Only the XMP is wanted, allows space/time optimizations. */
00746     kXMPFiles_OpenCacheTNail        = 0x00000008, /* Cache thumbnail if possible, GetThumbnail will be called. */
00747     kXMPFiles_OpenStrictly          = 0x00000010, /* Be strict about locating XMP and reconciling with other forms. */
00748     kXMPFiles_OpenUseSmartHandler   = 0x00000020, /* Require the use of a smart handler. */
00749     kXMPFiles_OpenUsePacketScanning = 0x00000040, /* Force packet scanning, don't use a smart handler. */
00750     kXMPFiles_OpenLimitedScanning   = 0x00000080, /* Only packet scan files "known" to need scanning. */
00751     kXMPFiles_OpenInBackground      = 0x10000000  /* Set if calling from background thread. */
00752 };
00753 
00754 /* A note about kXMPFiles_OpenInBackground. The XMPFiles handler for .mov files currently uses      */
00755 /* QuickTime. On Macintosh, calls to Enter/ExitMovies versus Enter/ExitMoviesOnThread must be made. */
00756 /* This option is used to signal background use so that the .mov handler can behave appropriately.  */
00757 
00758 enum {  /* Options for CloseFile. */
00759     kXMPFiles_UpdateSafely = 0x0001 /* Write into a temporary file and swap for crash safety. */
00760 };
00761 
00762 /* ============================================================================================== */
00763 /* Exception codes */
00764 /* =============== */
00765 
00779 #if ! __cplusplus
00780 
00781     typedef struct XMP_Error {
00782         XMP_Int32     id;
00783         XMP_StringPtr errMsg;
00784     } XMP_Error;
00785 
00786 #else
00787 
00788     class XMP_Error {
00789     public:
00790         XMP_Error ( XMP_Int32 _id, XMP_StringPtr _errMsg ) : id(_id), errMsg(_errMsg) {};
00791         inline XMP_Int32     GetID() const     { return id; };
00792         inline XMP_StringPtr GetErrMsg() const { return errMsg; };
00793     private:
00794         XMP_Int32     id;
00795         XMP_StringPtr errMsg;
00796     };
00797 
00798 #endif
00799 
00800 enum {
00801 
00802     /* More or less generic error codes. */
00803     kXMPErr_Unknown          =   0,
00804     kXMPErr_TBD              =   1,
00805     kXMPErr_Unavailable      =   2,
00806     kXMPErr_BadObject        =   3,
00807     kXMPErr_BadParam         =   4,
00808     kXMPErr_BadValue         =   5,
00809     kXMPErr_AssertFailure    =   6,
00810     kXMPErr_EnforceFailure   =   7,
00811     kXMPErr_Unimplemented    =   8,
00812     kXMPErr_InternalFailure  =   9,
00813     kXMPErr_Deprecated       =  10,
00814     kXMPErr_ExternalFailure  =  11,
00815     kXMPErr_UserAbort        =  12,
00816     kXMPErr_StdException     =  13,
00817     kXMPErr_UnknownException =  14,
00818     kXMPErr_NoMemory         =  15,
00819 
00820     /* More specific parameter error codes.  */
00821     kXMPErr_BadSchema        = 101,
00822     kXMPErr_BadXPath         = 102,
00823     kXMPErr_BadOptions       = 103,
00824     kXMPErr_BadIndex         = 104,
00825     kXMPErr_BadIterPosition  = 105,
00826     kXMPErr_BadParse         = 106,
00827     kXMPErr_BadSerialize     = 107,
00828     kXMPErr_BadFileFormat    = 108,
00829     kXMPErr_NoFileHandler    = 109,
00830     kXMPErr_TooLargeForJPEG  = 110,
00831 
00832     /* File format and internal structure error codes. */
00833     kXMPErr_BadXML           = 201,
00834     kXMPErr_BadRDF           = 202,
00835     kXMPErr_BadXMP           = 203,
00836     kXMPErr_EmptyIterator    = 204,
00837     kXMPErr_BadUnicode       = 205,
00838     kXMPErr_BadTIFF          = 206,
00839     kXMPErr_BadJPEG          = 207,
00840     kXMPErr_BadPSD           = 208,
00841     kXMPErr_BadPSIR          = 209,
00842     kXMPErr_BadIPTC          = 210,
00843     kXMPErr_BadMPEG          = 211
00844 
00845 };
00846 
00852 /* ============================================================================================== */
00853 /* Client callbacks */
00854 /* ================ */
00855 
00856 
00880 typedef XMP_Int32 XMP_Status;
00881 
00882 typedef XMP_Status (* XMP_TextOutputProc) ( void *        refCon,
00883                                             XMP_StringPtr buffer,
00884                                             XMP_StringLen bufferSize );
00885 
00891 /* ============================================================================================== */
00892 /* Stuff with no better place to be */
00893 /* ================================ */
00894 
00895 typedef struct XMP_VersionInfo {
00896     XMP_Uns8      major;    /* The primary release number, the "1" in version "1.2.3". */
00897     XMP_Uns8      minor;    /* The secondary release number, the "2" in version "1.2.3". */
00898     XMP_Uns8      micro;    /* The tertiary release number, the "3" in version "1.2.3". */
00899     XMP_Bool      isDebug;  /* Really a 0/1 bool value. True if this is a debug build. */
00900     XMP_Uns32     build;    /* A rolling build number, monotonically increasing in a release. */
00901     XMP_Uns32     flags;    /* Individual feature implementation flags. */
00902     XMP_StringPtr message;  /* A comprehensive version information string. */
00903 } XMP_VersionInfo;
00904 
00905 typedef bool (* XMP_AbortProc) ( void * arg );  /* Used by SXMPFiles::SetAbortProc. */
00906 
00907 /* ============================================================================================== */
00908 
00909 #if __cplusplus
00910 } /* extern "C" */
00911 #endif
00912 
00913 #endif  /* __XMP_Const_h__ */

Generated on Thu May 3 14:54:57 2007 for Adobe XMP Toolkit by  doxygen 1.5.1