libopenraw
ifdfile.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - ifdfile.h
4  *
5  * Copyright (C) 2006-2015 Hubert Figuiere
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef OR_INTERNALS_IFD_FILE_H_
23 #define OR_INTERNALS_IFD_FILE_H_
24 
25 #include <stdint.h>
26 #include <sys/types.h>
27 
28 #include <vector>
29 
30 #include <libopenraw/consts.h>
31 
32 #include "rawfile.hpp"
33 #include "io/stream.hpp"
34 #include "ifd.hpp"
35 #include "rawcontainer.hpp"
36 #include "ifddir.hpp"
37 #include "makernotedir.hpp"
38 
39 namespace OpenRaw {
40 
41 class MetaValue;
42 class RawData;
43 
44 namespace Internals {
45 class IfdFileContainer;
46 
48 class IfdFile : public OpenRaw::RawFile {
49 #if defined(IN_TESTSUITE)
50 public:
51  friend class ::Test; // for testing
52 #endif
53 
54 protected:
55  IfdFile(const IO::Stream::Ptr &s, Type _type,
56  bool instantiateContainer = true);
57  virtual ~IfdFile();
58 
64  virtual ::or_error _enumThumbnailSizes(
65  std::vector<uint32_t> &list) override;
66 
72  virtual ::or_error _locateThumbnail(const IfdDir::Ref &dir,
73  std::vector<uint32_t> &list);
79  ::or_error _getRawDataFromDir(RawData &data, const IfdDir::Ref &dir);
80 
86  virtual uint32_t _getJpegThumbnailOffset(const IfdDir::Ref &dir,
87  uint32_t &len);
88 
89  IO::Stream::Ptr m_io;
92  virtual RawContainer *getContainer() const override;
93 
94  virtual IfdDir::Ref _locateCfaIfd() = 0;
95  virtual IfdDir::Ref _locateMainIfd() = 0;
96  virtual IfdDir::Ref _locateExifIfd();
97  virtual MakerNoteDir::Ref _locateMakerNoteIfd();
98 
99  virtual void _identifyId() override;
100 
101  virtual MetaValue *_getMetaValue(int32_t meta_index) override;
102 
108  virtual uint32_t _translateCompressionType(
109  IFD::TiffCompress tiffCompression);
110 
120  virtual ::or_error _unpackData(uint16_t bpc, uint32_t compression,
121  RawData &data, uint32_t x, uint32_t y,
122  uint32_t offset, uint32_t byte_length);
123 
125  const IfdDir::Ref &cfaIfd();
126  const IfdDir::Ref &mainIfd();
127  const IfdDir::Ref &exifIfd();
128  const MakerNoteDir::Ref &makerNoteIfd();
129 
130  virtual ::or_error _getRawData(RawData &data, uint32_t options) override;
131  // call to decrompress if needed from _getRawData()
132  virtual ::or_error _decompressIfNeeded(RawData &, uint32_t);
133 
134 private:
135  IfdDir::Ref m_cfaIfd;
136  IfdDir::Ref
137  m_mainIfd;
141  IfdDir::Ref m_exifIfd;
142  MakerNoteDir::Ref m_makerNoteIfd;
144  IfdFile(const IfdFile &) = delete;
145  IfdFile &operator=(const IfdFile &) = delete;
146 };
147 }
148 }
149 
150 /*
151  Local Variables:
152  mode:c++
153  c-file-style:"stroustrup"
154  c-file-offsets:((innamespace . 0))
155  tab-width:2
156  c-basic-offset:2
157  indent-tabs-mode:nil
158  fill-column:80
159  End:
160 */
161 #endif
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 ::or_error _enumThumbnailSizes(std::vector< uint32_t > &list) override
Definition: ifdfile.cpp:113
virtual ::or_error _getRawData(RawData &data, uint32_t options) override
Definition: ifdfile.cpp:486
IO::Stream::Ptr m_io
Definition: ifdfile.hpp:89
virtual uint32_t _getJpegThumbnailOffset(const IfdDir::Ref &dir, uint32_t &len)
Definition: ifdfile.cpp:285
virtual ::or_error _locateThumbnail(const IfdDir::Ref &dir, std::vector< uint32_t > &list)
Definition: ifdfile.cpp:149
virtual ::or_error _unpackData(uint16_t bpc, uint32_t compression, RawData &data, uint32_t x, uint32_t y, uint32_t offset, uint32_t byte_length)
Definition: ifdfile.cpp:675
const IfdDir::Ref & cfaIfd()
Definition: ifdfile.cpp:333
virtual RawContainer * getContainer() const override
Definition: ifdfile.cpp:280
IfdFileContainer * m_container
Definition: ifdfile.hpp:90
::or_error _getRawDataFromDir(RawData &data, const IfdDir::Ref &dir)
Definition: ifdfile.cpp:511
generic IFD based raw file.
Definition: ifdfile.hpp:48
virtual uint32_t _translateCompressionType(IFD::TiffCompress tiffCompression)
Definition: ifdfile.cpp:326