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
39namespace OpenRaw {
40
41class MetaValue;
42class RawData;
43
44namespace Internals {
46
48class IfdFile : public OpenRaw::RawFile {
49#if defined(IN_TESTSUITE)
50public:
51 friend class ::Test; // for testing
52#endif
53
54protected:
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;
91
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
134private:
135 IfdDir::Ref m_cfaIfd;
136 IfdDir::Ref m_mainIfd;
140 IfdDir::Ref m_exifIfd;
141 MakerNoteDir::Ref m_makerNoteIfd;
142
143 IfdFile(const IfdFile &) = delete;
144 IfdFile &operator=(const IfdFile &) = delete;
145};
146}
147}
148
149/*
150 Local Variables:
151 mode:c++
152 c-file-style:"stroustrup"
153 c-file-offsets:((innamespace . 0))
154 tab-width:2
155 c-basic-offset:2
156 indent-tabs-mode:nil
157 fill-column:80
158 End:
159*/
160#endif
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:661
virtual::or_error _enumThumbnailSizes(std::vector< uint32_t > &list) override
Definition ifdfile.cpp:112
IfdFileContainer * m_container
Definition ifdfile.hpp:90
virtual::or_error _getRawData(RawData &data, uint32_t options) override
Definition ifdfile.cpp:485
virtual::or_error _locateThumbnail(const IfdDir::Ref &dir, std::vector< uint32_t > &list)
Definition ifdfile.cpp:148
::or_error _getRawDataFromDir(RawData &data, const IfdDir::Ref &dir)
Definition ifdfile.cpp:510
virtual RawContainer * getContainer() const override
Definition ifdfile.cpp:279
virtual uint32_t _getJpegThumbnailOffset(const IfdDir::Ref &dir, uint32_t &len)
Definition ifdfile.cpp:284
const IfdDir::Ref & cfaIfd()
Definition ifdfile.cpp:332
virtual uint32_t _translateCompressionType(IFD::TiffCompress tiffCompression)
Definition ifdfile.cpp:325
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard....
Definition arwfile.cpp:30