diff options
author | Kinan Hakim <kinan@google.com> | 2015-12-18 14:42:01 +0100 |
---|---|---|
committer | Kinan Hakim <kinan@google.com> | 2015-12-22 17:48:51 +0000 |
commit | 327c6d5fa60ff1df8a421499edff3c6445a9d2e6 (patch) | |
tree | f191d3ab4a5ac67c41c004df98ba8348470dc858 /source | |
parent | 6e09dfbee0b1643a5cb2b32d0399c1a0c69551a0 (diff) | |
download | dng_sdk-327c6d5fa60ff1df8a421499edff3c6445a9d2e6.tar.gz |
Add Android.mk and exclude xmp.
Change-Id: Idbe400dbff847ee4ee0faeededc7132473f1d6af
Diffstat (limited to 'source')
-rw-r--r-- | source/RawEnvironment.h | 16 | ||||
-rw-r--r-- | source/dng_host.cpp | 7 | ||||
-rw-r--r-- | source/dng_host.h | 4 | ||||
-rw-r--r-- | source/dng_image_writer.cpp | 27 | ||||
-rw-r--r-- | source/dng_negative.cpp | 38 | ||||
-rw-r--r-- | source/dng_negative.h | 16 | ||||
-rw-r--r-- | source/dng_validate.cpp | 15 | ||||
-rw-r--r-- | source/dng_xmp.cpp | 2 | ||||
-rw-r--r-- | source/dng_xmp.h | 4 | ||||
-rw-r--r-- | source/dng_xmp_sdk.h | 3 |
10 files changed, 132 insertions, 0 deletions
diff --git a/source/RawEnvironment.h b/source/RawEnvironment.h new file mode 100644 index 0000000..3613cd4 --- /dev/null +++ b/source/RawEnvironment.h @@ -0,0 +1,16 @@ +// Define preprocessor constants that control platform-specific conditional +// compilation. The constants qMacOS and qWinOS must be defined on all +// platforms. Other constants, such as qLinux, only need to be defined if we're +// actually compiling for that platform. +#if defined(__linux__) +#define qMacOS 0 +#define qWinOS 0 +#define qLinux 1 +#elif defined(__APPLE__) +#define qMacOS 1 +#define qWinOS 0 +#elif defined(_WIN32) +#define qMacOS 0 +#define qWinOS 1 +#endif + diff --git a/source/dng_host.cpp b/source/dng_host.cpp index 6581f90..d36572c 100644 --- a/source/dng_host.cpp +++ b/source/dng_host.cpp @@ -29,7 +29,10 @@ #include "dng_resample.h" #include "dng_shared.h" #include "dng_simple_image.h" + +#if qDNGUseXMP #include "dng_xmp.h" +#endif /*****************************************************************************/ @@ -268,6 +271,8 @@ dng_exif * dng_host::Make_dng_exif () /*****************************************************************************/ +#if qDNGUseXMP + dng_xmp * dng_host::Make_dng_xmp () { @@ -284,6 +289,8 @@ dng_xmp * dng_host::Make_dng_xmp () } +#endif + /*****************************************************************************/ dng_shared * dng_host::Make_dng_shared () diff --git a/source/dng_host.h b/source/dng_host.h index 357cd7e..dc526d2 100644 --- a/source/dng_host.h +++ b/source/dng_host.h @@ -346,7 +346,11 @@ class dng_host /// Factory method for dng_xmp class. Can be used to customize allocation or /// to ensure a derived class is used instead of dng_xmp. + #if qDNGUseXMP + virtual dng_xmp * Make_dng_xmp (); + + #endif /// Factory method for dng_shared class. Can be used to customize allocation /// or to ensure a derived class is used instead of dng_shared. diff --git a/source/dng_image_writer.cpp b/source/dng_image_writer.cpp index b70ba62..049d7c3 100644 --- a/source/dng_image_writer.cpp +++ b/source/dng_image_writer.cpp @@ -40,7 +40,10 @@ #include "dng_tag_codes.h" #include "dng_tag_values.h" #include "dng_utils.h" + +#if qDNGUseXMP #include "dng_xmp.h" +#endif #include "zlib.h" @@ -80,6 +83,8 @@ static void SpoolAdobeData (dng_stream &stream, TempBigEndian tempEndian (stream); + #if qDNGUseXMP + if (metadata && metadata->GetXMP ()) { @@ -133,6 +138,8 @@ static void SpoolAdobeData (dng_stream &stream, } + #endif + if (preview) { @@ -538,6 +545,8 @@ tag_xmp::tag_xmp (const dng_xmp *xmp) { + #if qDNGUseXMP + if (xmp) { @@ -554,6 +563,8 @@ tag_xmp::tag_xmp (const dng_xmp *xmp) } + #endif + } /******************************************************************************/ @@ -4758,6 +4769,8 @@ void dng_image_writer::WriteImage (dng_host &host, /*****************************************************************************/ +#if qDNGUseXMP + static void CopyString (const dng_xmp &oldXMP, dng_xmp &newXMP, const char *ns, @@ -4889,6 +4902,8 @@ static void CopyBoolean (const dng_xmp &oldXMP, } + +#endif /*****************************************************************************/ void dng_image_writer::CleanUpMetadata (dng_host &host, @@ -4898,6 +4913,8 @@ void dng_image_writer::CleanUpMetadata (dng_host &host, const char *software) { + #if qDNGUseXMP + if (metadata.GetXMP () && metadata.GetExif ()) { @@ -5230,6 +5247,8 @@ void dng_image_writer::CleanUpMetadata (dng_host &host, } + #endif + } /*****************************************************************************/ @@ -5474,6 +5493,8 @@ void dng_image_writer::WriteTIFFWithProfile (dng_host &host, // XMP metadata. + #if qDNGUseXMP + tag_xmp tagXMP (metadata.Get () ? metadata->GetXMP () : NULL); if (tagXMP.Count ()) @@ -5481,6 +5502,8 @@ void dng_image_writer::WriteTIFFWithProfile (dng_host &host, mainIFD.Add (&tagXMP); } + #endif + // IPTC metadata. tag_iptc tagIPTC (metadata.Get () ? metadata->IPTCData () : NULL, @@ -6484,6 +6507,8 @@ void dng_image_writer::WriteDNG (dng_host &host, // XMP metadata. + #if qDNGUseXMP + tag_xmp tagXMP (metadata->GetXMP ()); if (tagXMP.Count ()) @@ -6493,6 +6518,8 @@ void dng_image_writer::WriteDNG (dng_host &host, } + #endif + // Exif tags. exif_tag_set exifSet (mainIFD, diff --git a/source/dng_negative.cpp b/source/dng_negative.cpp index c858ff2..ed106d7 100644 --- a/source/dng_negative.cpp +++ b/source/dng_negative.cpp @@ -43,7 +43,9 @@ #include "dng_tag_values.h" #include "dng_tile_iterator.h" #include "dng_utils.h" +#if qDNGUseXMP #include "dng_xmp.h" +#endif /*****************************************************************************/ @@ -139,7 +141,13 @@ dng_metadata::dng_metadata (dng_host &host) , fOriginalExif () , fIPTCBlock () , fIPTCOffset (kDNGStreamInvalidOffset) + + #if qDNGUseXMP + , fXMP (host.Make_dng_xmp ()) + + #endif + , fEmbeddedXMPDigest () , fXMPinSidecar (false) , fXMPisNewer (false) @@ -187,7 +195,13 @@ dng_metadata::dng_metadata (const dng_metadata &rhs, , fOriginalExif (CloneAutoPtr (rhs.fOriginalExif)) , fIPTCBlock (CloneAutoPtr (rhs.fIPTCBlock, allocator)) , fIPTCOffset (rhs.fIPTCOffset) + + #if qDNGUseXMP + , fXMP (CloneAutoPtr (rhs.fXMP)) + + #endif + , fEmbeddedXMPDigest (rhs.fEmbeddedXMPDigest) , fXMPinSidecar (rhs.fXMPinSidecar) , fXMPisNewer (rhs.fXMPisNewer) @@ -224,7 +238,11 @@ void dng_metadata::ApplyOrientation (const dng_orientation &orientation) fBaseOrientation += orientation; + + #if qDNGUseXMP fXMP->SetOrientation (fBaseOrientation); + + #endif } @@ -505,6 +523,8 @@ dng_fingerprint dng_metadata::IPTCDigest (bool includePadding) const /******************************************************************************/ +#if qDNGUseXMP + void dng_metadata::RebuildIPTC (dng_memory_allocator &allocator, bool padForTIFF) { @@ -631,6 +651,8 @@ void dng_metadata::SetEmbeddedXMP (dng_host &host, } +#endif + /*****************************************************************************/ void dng_metadata::SynchronizeMetadata () @@ -643,6 +665,8 @@ void dng_metadata::SynchronizeMetadata () } + #if qDNGUseXMP + fXMP->ValidateMetadata (); fXMP->IngestIPTC (*this, fXMPisNewer); @@ -651,6 +675,8 @@ void dng_metadata::SynchronizeMetadata () fXMP->SyncOrientation (*this, fXMPinSidecar); + #endif + } /*****************************************************************************/ @@ -660,7 +686,9 @@ void dng_metadata::UpdateDateTime (const dng_date_time_info &dt) fExif->UpdateDateTime (dt); +#if qDNGUseXMP fXMP->UpdateDateTime (dt); +#endif } @@ -675,8 +703,12 @@ void dng_metadata::UpdateDateTimeToNow () UpdateDateTime (dt); + #if qDNGUseXMP + fXMP->UpdateMetadataDate (dt); + #endif + } /*****************************************************************************/ @@ -688,7 +720,9 @@ void dng_metadata::UpdateMetadataDateTimeToNow () CurrentDateTimeAndZone (dt); + #if qDNGUseXMP fXMP->UpdateMetadataDate (dt); + #endif } @@ -3341,6 +3375,8 @@ void dng_negative::PostParse (dng_host &host, // XMP metadata. + #if qDNGUseXMP + if (shared.fXMPCount) { @@ -3366,6 +3402,8 @@ void dng_negative::PostParse (dng_host &host, } + #endif + // Color info. if (!IsMonochrome ()) diff --git a/source/dng_negative.h b/source/dng_negative.h index f0ee76c..6cec4e0 100644 --- a/source/dng_negative.h +++ b/source/dng_negative.h @@ -247,8 +247,12 @@ class dng_metadata // XMP data. + #if qDNGUseXMP + AutoPtr<dng_xmp> fXMP; + #endif + // If there a valid embedded XMP block, has is its digest? NULL if no valid // embedded XMP. @@ -397,6 +401,8 @@ class dng_metadata // API for XMP metadata: + #if qDNGUseXMP + bool SetXMP (dng_host &host, const void *buffer, uint32 count, @@ -442,6 +448,8 @@ class dng_metadata void ResetXMPSidecarNewer (dng_xmp * newXMP, bool inSidecar, bool isNewer ); + #endif + // Synchronize metadata sources. void SynchronizeMetadata (); @@ -491,6 +499,8 @@ const E & dng_metadata::Exif () const /*****************************************************************************/ +#if qDNGUseXMP + template< class X > X & dng_metadata::XMP () { @@ -509,6 +519,8 @@ const X & dng_metadata::XMP () const return dynamic_cast< const X & > (*xmp); } +#endif + /*****************************************************************************/ /// \brief Main class for holding DNG image data and associated metadata. @@ -1928,6 +1940,8 @@ class dng_negative // API for XMP metadata: + #if qDNGUseXMP + bool SetXMP (dng_host &host, const void *buffer, uint32 count, @@ -1975,6 +1989,8 @@ class dng_negative return Metadata ().HaveValidEmbeddedXMP (); } + #endif + // API for source MIMI type. void SetSourceMIMI (const char *s) diff --git a/source/dng_validate.cpp b/source/dng_validate.cpp index 83bc4f9..aa7c33a 100644 --- a/source/dng_validate.cpp +++ b/source/dng_validate.cpp @@ -48,8 +48,11 @@ #include "dng_tag_codes.h" #include "dng_tag_types.h" #include "dng_tag_values.h" + +#if qDNGUseXMP #include "dng_xmp.h" #include "dng_xmp_sdk.h" +#endif /*****************************************************************************/ @@ -452,6 +455,8 @@ static dng_error_code dng_validate (const char *filename) // not keep any Camera Raw settings in the XMP around when // writing rendered files. + #if qDNGUseXMP + if (negative->GetXMP ()) { @@ -460,6 +465,8 @@ static dng_error_code dng_validate (const char *filename) } + #endif + // Write TIF file. dng_file_stream stream2 (gDumpTIF.Get (), true); @@ -855,8 +862,12 @@ int main (int argc, char *argv []) fprintf (stderr, "*** No file specified\n"); return 1; } + + #if qDNGUseXMP dng_xmp_sdk::InitializeSDK (); + + #endif int result = 0; @@ -873,7 +884,11 @@ int main (int argc, char *argv []) } + #if qDNGUseXMP + dng_xmp_sdk::TerminateSDK (); + + #endif return result; diff --git a/source/dng_xmp.cpp b/source/dng_xmp.cpp index e761007..aaed238 100644 --- a/source/dng_xmp.cpp +++ b/source/dng_xmp.cpp @@ -12,6 +12,7 @@ /* $Author: tknoll $ */
/*****************************************************************************/
+#if qDNGUseXMP
#include "dng_xmp.h"
@@ -4412,4 +4413,5 @@ void dng_xmp::DocOpsUpdateMetadata (const char *srcMIMI) #endif
+#endif
/*****************************************************************************/
diff --git a/source/dng_xmp.h b/source/dng_xmp.h index fc898fa..9ef960b 100644 --- a/source/dng_xmp.h +++ b/source/dng_xmp.h @@ -16,6 +16,8 @@ #ifndef __dng_xmp__ #define __dng_xmp__ +#if qDNGUseXMP + /*****************************************************************************/ #include "dng_classes.h" @@ -398,6 +400,8 @@ class dng_xmp }; +#endif + /*****************************************************************************/ #endif diff --git a/source/dng_xmp_sdk.h b/source/dng_xmp_sdk.h index c6ff6f0..462d22d 100644 --- a/source/dng_xmp_sdk.h +++ b/source/dng_xmp_sdk.h @@ -23,6 +23,8 @@ #include "dng_flags.h" #include "dng_types.h" +#if qDNGUseXMP + /*****************************************************************************/ extern const char *XMP_NS_TIFF; @@ -231,6 +233,7 @@ class dng_xmp_sdk }; +#endif /*****************************************************************************/ #endif |