| 1 | /*****************************************************************************/ |
| 2 | // Copyright 2006-2011 Adobe Systems Incorporated |
| 3 | // All Rights Reserved. |
| 4 | // |
| 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in |
| 6 | // accordance with the terms of the Adobe license agreement accompanying it. |
| 7 | /*****************************************************************************/ |
| 8 | |
| 9 | /* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_info.h#1 $ */ |
| 10 | /* $DateTime: 2012/05/30 13:28:51 $ */ |
| 11 | /* $Change: 832332 $ */ |
| 12 | /* $Author: tknoll $ */ |
| 13 | |
| 14 | /** \file |
| 15 | * Class for holding top-level information about a DNG image. |
| 16 | */ |
| 17 | |
| 18 | /*****************************************************************************/ |
| 19 | |
| 20 | #ifndef __dng_info__ |
| 21 | #define __dng_info__ |
| 22 | |
| 23 | /*****************************************************************************/ |
| 24 | |
| 25 | #include "dng_classes.h" |
| 26 | #include "dng_ifd.h" |
| 27 | #include "dng_exif.h" |
| 28 | #include "dng_shared.h" |
| 29 | #include "dng_errors.h" |
| 30 | #include "dng_sdk_limits.h" |
| 31 | #include "dng_auto_ptr.h" |
| 32 | |
| 33 | /*****************************************************************************/ |
| 34 | |
| 35 | /// \brief Top-level structure of DNG file with access to metadata. |
| 36 | /// |
| 37 | /// See \ref spec_dng "DNG 1.1.0 specification" for information on member fields of this class. |
| 38 | |
| 39 | class dng_info |
| 40 | { |
| 41 | |
| 42 | public: |
| 43 | |
| 44 | uint64 fTIFFBlockOffset; |
| 45 | |
| 46 | uint64 fTIFFBlockOriginalOffset; |
| 47 | |
| 48 | bool fBigEndian; |
| 49 | |
| 50 | uint32 fMagic; |
| 51 | |
| 52 | AutoPtr<dng_exif> fExif; |
| 53 | |
| 54 | AutoPtr<dng_shared> fShared; |
| 55 | |
| 56 | int32 fMainIndex; |
| 57 | |
| 58 | int32 fMaskIndex; |
| 59 | |
| 60 | uint32 fIFDCount; |
| 61 | |
| 62 | AutoPtr<dng_ifd> fIFD [kMaxSubIFDs + 1]; |
| 63 | |
| 64 | uint32 fChainedIFDCount; |
| 65 | |
| 66 | AutoPtr<dng_ifd> fChainedIFD [kMaxChainedIFDs]; |
| 67 | |
| 68 | protected: |
| 69 | |
| 70 | uint32 fMakerNoteNextIFD; |
| 71 | |
| 72 | public: |
| 73 | |
| 74 | dng_info (); |
| 75 | |
| 76 | virtual ~dng_info (); |
| 77 | |
| 78 | /// Read dng_info from a dng_stream |
| 79 | /// \param host DNG host used for progress updating, abort testing, buffer allocation, etc. |
| 80 | /// \param stream Stream to read DNG data from. |
| 81 | |
| 82 | virtual void Parse (dng_host &host, |
| 83 | dng_stream &stream); |
| 84 | |
| 85 | /// Must be called immediately after a successful Parse operation. |
| 86 | |
| 87 | virtual void PostParse (dng_host &host); |
| 88 | |
| 89 | /// Test validity of DNG data. |
| 90 | /// \retval true if stream provided a valid DNG. |
| 91 | |
| 92 | virtual bool IsValidDNG (); |
| 93 | |
| 94 | protected: |
| 95 | |
| 96 | virtual void ValidateMagic (); |
| 97 | |
| 98 | virtual void ParseTag (dng_host &host, |
| 99 | dng_stream &stream, |
| 100 | dng_exif *exif, |
| 101 | dng_shared *shared, |
| 102 | dng_ifd *ifd, |
| 103 | uint32 parentCode, |
| 104 | uint32 tagCode, |
| 105 | uint32 tagType, |
| 106 | uint32 tagCount, |
| 107 | uint64 tagOffset, |
| 108 | int64 offsetDelta); |
| 109 | |
| 110 | virtual bool ValidateIFD (dng_stream &stream, |
| 111 | uint64 ifdOffset, |
| 112 | int64 offsetDelta); |
| 113 | |
| 114 | virtual void ParseIFD (dng_host &host, |
| 115 | dng_stream &stream, |
| 116 | dng_exif *exif, |
| 117 | dng_shared *shared, |
| 118 | dng_ifd *ifd, |
| 119 | uint64 ifdOffset, |
| 120 | int64 offsetDelta, |
| 121 | uint32 parentCode); |
| 122 | |
| 123 | virtual bool ParseMakerNoteIFD (dng_host &host, |
| 124 | dng_stream &stream, |
| 125 | uint64 ifdSize, |
| 126 | uint64 ifdOffset, |
| 127 | int64 offsetDelta, |
| 128 | uint64 minOffset, |
| 129 | uint64 maxOffset, |
| 130 | uint32 parentCode); |
| 131 | |
| 132 | virtual void ParseMakerNote (dng_host &host, |
| 133 | dng_stream &stream, |
| 134 | uint32 makerNoteCount, |
| 135 | uint64 makerNoteOffset, |
| 136 | int64 offsetDelta, |
| 137 | uint64 minOffset, |
| 138 | uint64 maxOffset); |
| 139 | |
| 140 | virtual void ParseSonyPrivateData (dng_host &host, |
| 141 | dng_stream &stream, |
| 142 | uint64 count, |
| 143 | uint64 oldOffset, |
| 144 | uint64 newOffset); |
| 145 | |
| 146 | virtual void ParseDNGPrivateData (dng_host &host, |
| 147 | dng_stream &stream); |
| 148 | |
| 149 | private: |
| 150 | |
| 151 | // Hidden copy constructor and assignment operator. |
| 152 | |
| 153 | dng_info (const dng_info &info); |
| 154 | |
| 155 | dng_info & operator= (const dng_info &info); |
| 156 | |
| 157 | }; |
| 158 | |
| 159 | /*****************************************************************************/ |
| 160 | |
| 161 | #endif |
| 162 | |
| 163 | /*****************************************************************************/ |
| 164 | |