libopenraw
ifdfilecontainer.hpp
1 /*
2  * libopenraw - ifdfilecontainer.h
3  *
4  * Copyright (C) 2005-2016 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
29 #ifndef OR_INTERNALS_IFDFILECONTAINER_H_
30 #define OR_INTERNALS_IFDFILECONTAINER_H_
31 
32 #include <stddef.h>
33 #include <stdint.h>
34 #include <sys/types.h>
35 #include <vector>
36 
37 #include <libopenraw/consts.h>
38 
39 #include "rawcontainer.hpp"
40 #include "ifddir.hpp"
41 #include "io/stream.hpp"
42 
43 namespace OpenRaw {
44 namespace Internals {
45 
46 
48  : public RawContainer
49 {
50 public:
56  IfdFileContainer(const IO::Stream::Ptr &file,
57  off_t offset);
59  virtual ~IfdFileContainer();
60 
65  enum {
66  IFD_NONE = -1,
67  IFD_EXIF = -2,
68  IFD_GPS = -3,
70  };
71 
81  virtual EndianType isMagicHeader(const char *p, int len);
82 
89  IfdDir::Ref setDirectory(int dir);
95  int countDirectories(void);
99  std::vector<IfdDir::Ref> & directories();
100 
106  int currentDirectory();
107 
112  size_t getDirectoryDataSize();
113 
114 
119  int lastError() const
120  {
121  return m_error;
122  }
123 
130  {
131  return m_exif_offset_correction;
132  }
133 
135  void setExifOffsetCorrection(int corr)
136  {
137  m_exif_offset_correction = corr;
138  }
139 
145  ::or_error locateImageData(const IfdDir::Ref& dir, uint32_t& x, uint32_t& y,
146  ::or_data_type& t);
147 
148 protected:
150  virtual bool locateDirsPreHook();
151 private:
152  int m_error;
153  int m_exif_offset_correction;
154 
155  IfdDir::Ref m_current_dir;
156  std::vector<IfdDir::Ref> m_dirs;
157 
158  bool _locateDirs();
159 };
160 
161 }
162 }
163 
164 #endif
165 /*
166  Local Variables:
167  mode:c++
168  c-file-style:"stroustrup"
169  c-file-offsets:((innamespace . 0))
170  tab-width:2
171  c-basic-offset:2
172  indent-tabs-mode:nil
173  fill-column:80
174  End:
175 */
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30
virtual EndianType isMagicHeader(const char *p, int len)
std::vector< IfdDir::Ref > & directories()
IfdFileContainer(const IO::Stream::Ptr &file, off_t offset)
::or_error locateImageData(const IfdDir::Ref &dir, uint32_t &x, uint32_t &y, ::or_data_type &t)