libopenraw  0.3.7
rw2file.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - rw2file.hpp
4  *
5  * Copyright (C) 2006-2020 Hubert Figuière
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 #pragma once
23 
24 #include <stdint.h>
25 #include <vector>
26 
27 #include <libopenraw/consts.h>
28 
29 #include "rawfile.hpp"
30 #include "ifddir.hpp"
31 #include "ifdfile.hpp"
32 #include "jfifcontainer.hpp"
33 #include "io/stream.hpp"
34 
35 namespace OpenRaw {
36 
37 class RawData;
38 
39 namespace Internals {
40 
41 class Rw2File
42  : public IfdFile
43 {
44  template<typename T>
45  friend void audit_coefficients();
46 
47 public:
48  static RawFile *factory(const IO::Stream::Ptr& s);
49  Rw2File(const IO::Stream::Ptr& s);
50  virtual ~Rw2File();
51 
52  Rw2File(const Rw2File&) = delete;
53  Rw2File & operator=(const Rw2File&) = delete;
54 
55 protected:
56  virtual IfdDir::Ref _locateCfaIfd() override;
57  virtual IfdDir::Ref _locateMainIfd() override;
58  virtual IfdDir::Ref _locateExifIfd() override;
59 private:
60 
61  virtual ::or_error _locateThumbnail(const IfdDir::Ref& dir,
62  std::vector<uint32_t>& list) override;
63  const std::unique_ptr<JfifContainer>& getJpegContainer(const IfdDir::Ref& dir, uint32_t& offset, uint32_t& size);
64  virtual uint32_t _getJpegThumbnailOffset(const IfdDir::Ref& dir, uint32_t& len) override;
65  virtual ::or_error _getRawData(RawData& data, uint32_t options) override;
66 
67  static const IfdFile::camera_ids_t s_def[];
68 
69  std::unique_ptr<JfifContainer> m_jfif;
70  uint32_t m_jfif_offset;
71  uint32_t m_jfif_size;
72 };
73 
74 }
75 }
76 /*
77  Local Variables:
78  mode:c++
79  c-file-style:"stroustrup"
80  c-file-offsets:((innamespace . 0))
81  tab-width:4
82  c-basic-offset:4
83  indent-tabs-mode:nil
84  fill-column:80
85  End:
86 */
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Definition: ifddir.hpp:56
A generic IFD (TIFF) based raw file.
Definition: ifdfile.hpp:51
virtual IfdDir::Ref _locateMainIfd() override
Locate the main IFD.
Definition: rw2file.cpp:601
virtual IfdDir::Ref _locateExifIfd() override
Locate the Exif IFD.
Definition: rw2file.cpp:611
virtual IfdDir::Ref _locateCfaIfd() override
Locate the IFD for the raw data.
Definition: rw2file.cpp:596
Represent camera raw data.
Definition: rawdata.hpp:38
RAW file.
Definition: rawfile.hpp:66
or_error
Error codes returned by libopenraw.
Definition: consts.h:42
Global namespace for libopenraw.
Definition: arwfile.cpp:29