libopenraw  0.3.7
rafcontainer.hpp
1 /* -*- tab-width:4; c-basic-offset:4 -*- */
2 /*
3  * libopenraw - rafcontainer.h
4  *
5  * Copyright (C) 2011-2016 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_RAFCONTAINER_H_
23 #define OR_INTERNALS_RAFCONTAINER_H_
24 
25 #include <stdint.h>
26 #include <string>
27 
28 #include "io/stream.hpp"
29 #include "rawcontainer.hpp"
30 
31 namespace OpenRaw {
32 
33 namespace Internals {
34 
39 class JfifContainer;
40 class IfdFileContainer;
41 class RafMetaContainer;
42 
45 {
46  // 36 bytes skipped
47  uint32_t jpegOffset;
48  uint32_t jpegLength;
49  uint32_t metaOffset;
50  uint32_t metaLength;
51  uint32_t cfaOffset;
52  uint32_t cfaLength;
53 };
54 
57  : public RawContainer
58 {
59 public:
60  RafContainer(const IO::Stream::Ptr &_file);
62  virtual ~RafContainer();
63 
64  const std::string & getModel();
65  JfifContainer * getJpegPreview();
66  IfdFileContainer * getCfaContainer();
67  RafMetaContainer * getMetaContainer();
68  uint32_t getJpegOffset() const
69  {
70  return m_offsetDirectory.jpegOffset;
71  }
72  uint32_t getJpegLength() const
73  {
74  return m_offsetDirectory.jpegLength;
75  }
76  uint32_t getCfaOffset() const
77  {
78  return m_offsetDirectory.cfaOffset;
79  }
80  uint32_t getCfaLength() const
81  {
82  return m_offsetDirectory.cfaLength;
83  }
84 private:
85  bool _readHeader();
86  bool m_read;
87  std::string m_model;
88  uint32_t m_version;
89  RafOffsetDirectory m_offsetDirectory;
90 
91  JfifContainer * m_jpegPreview;
92  IfdFileContainer * m_cfaContainer;
93  RafMetaContainer * m_metaContainer;
94 };
95 
97 }
98 }
99 
100 #endif
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
virtual ~RafContainer()
Destructor.
Generic interface for the RAW file container.
Global namespace for libopenraw.
Definition: arwfile.cpp:29