summaryrefslogtreecommitdiff
path: root/gpr/source/lib/dng_sdk/dng_info.h
blob: 3ccefd1d8f9897a2caae874e694a3d196742aa9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*****************************************************************************/
// Copyright 2006-2011 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in
// accordance with the terms of the Adobe license agreement accompanying it.
/*****************************************************************************/

/* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_info.h#1 $ */ 
/* $DateTime: 2012/05/30 13:28:51 $ */
/* $Change: 832332 $ */
/* $Author: tknoll $ */

/** \file
 * Class for holding top-level information about a DNG image.
 */

/*****************************************************************************/

#ifndef __dng_info__
#define __dng_info__

/*****************************************************************************/

#include "dng_classes.h"
#include "dng_ifd.h"
#include "dng_exif.h"
#include "dng_shared.h"
#include "dng_errors.h"
#include "dng_sdk_limits.h"
#include "dng_auto_ptr.h"

/*****************************************************************************/

/// \brief Top-level structure of DNG file with access to metadata.
///
/// See \ref spec_dng "DNG 1.1.0 specification" for information on member fields of this class.

class dng_info
	{
	
	public:
	
		uint64 fTIFFBlockOffset;
		
		uint64 fTIFFBlockOriginalOffset;
	
		bool fBigEndian;
		
		uint32 fMagic;
		
		AutoPtr<dng_exif> fExif;
	
		AutoPtr<dng_shared> fShared;
		
		int32 fMainIndex;
		
		int32 fMaskIndex;
			
		uint32 fIFDCount;
		
		AutoPtr<dng_ifd> fIFD [kMaxSubIFDs + 1];
		
		uint32 fChainedIFDCount;
		
		AutoPtr<dng_ifd> fChainedIFD [kMaxChainedIFDs];
		
	protected:
	
		uint32 fMakerNoteNextIFD;
		
	public:
	
		dng_info ();
		
		virtual ~dng_info ();

		/// Read dng_info from a dng_stream
		/// \param host DNG host used for progress updating, abort testing, buffer allocation, etc.
		/// \param stream Stream to read DNG data from.

		virtual void Parse (dng_host &host,
							dng_stream &stream);

		/// Must be called immediately after a successful Parse operation.

		virtual void PostParse (dng_host &host);

		/// Test validity of DNG data.
		/// \retval true if stream provided a valid DNG.

		virtual bool IsValidDNG ();
		
	protected:
		
		virtual void ValidateMagic ();

		virtual void ParseTag (dng_host &host,
							   dng_stream &stream,
							   dng_exif *exif,
						 	   dng_shared *shared,
						 	   dng_ifd *ifd,
						 	   uint32 parentCode,
						 	   uint32 tagCode,
						 	   uint32 tagType,
						 	   uint32 tagCount,
						 	   uint64 tagOffset,
						 	   int64 offsetDelta);

		virtual bool ValidateIFD (dng_stream &stream,
						 	      uint64 ifdOffset,
						 	      int64 offsetDelta);

		virtual void ParseIFD (dng_host &host,
							   dng_stream &stream,
							   dng_exif *exif,
						 	   dng_shared *shared,
						 	   dng_ifd *ifd,
						 	   uint64 ifdOffset,
						 	   int64 offsetDelta,
						 	   uint32 parentCode);

		virtual bool ParseMakerNoteIFD (dng_host &host,
										dng_stream &stream,
										uint64 ifdSize,
								 	    uint64 ifdOffset,
								 	    int64 offsetDelta,
								 	    uint64 minOffset,
								 	    uint64 maxOffset,
								 	    uint32 parentCode);

		virtual void ParseMakerNote (dng_host &host,
									 dng_stream &stream,
							   		 uint32 makerNoteCount,
							   		 uint64 makerNoteOffset,
							   		 int64 offsetDelta,
							   		 uint64 minOffset,
							   		 uint64 maxOffset);
							   		 
		virtual void ParseSonyPrivateData (dng_host &host,
										   dng_stream &stream,
										   uint64 count,
										   uint64 oldOffset,
										   uint64 newOffset);
							   		 
		virtual void ParseDNGPrivateData (dng_host &host,
										  dng_stream &stream);

	private:
	
		// Hidden copy constructor and assignment operator.
	
		dng_info (const dng_info &info);
		
		dng_info & operator= (const dng_info &info);
		
	};
	
/*****************************************************************************/

#endif
	
/*****************************************************************************/