libopenraw  0.3.7
rafmetacontainer.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - rafmetacontainer.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_RAFMETACONTAINER_H_
23 #define OR_INTERNALS_RAFMETACONTAINER_H_
24 
25 #include <stdint.h>
26 
27 #include <memory>
28 #include <map>
29 
30 #include "metavalue.hpp"
31 #include "io/stream.hpp"
32 #include "rawcontainer.hpp"
33 
34 namespace OpenRaw {
35 
36 namespace Internals {
37 
43 enum {
44  RAF_TAG_INVALID = 0,
45  RAF_TAG_SENSOR_DIMENSION = 0x100, // the RAW dimensions
46  RAF_TAG_IMG_TOP_LEFT = 0x110,
47  RAF_TAG_IMG_HEIGHT_WIDTH = 0x111,
48  RAF_TAG_OUTPUT_HEIGHT_WIDTH =
49  0x121, // this is the one dcraw use for the active area
50  RAF_TAG_RAW_INFO = 0x130, // some info about the RAW.
51  _RAF_TAG_LAST
52 };
53 
55 class RafMetaValue {
56 public:
57  typedef std::shared_ptr<RafMetaValue> Ref;
58  RafMetaValue(uint16_t tag, uint16_t size, const MetaValue &v);
59  ~RafMetaValue();
60 
61  const MetaValue &get() const { return m_value; }
62  uint16_t tag() const { return m_tag; }
63  uint16_t size() const { return m_size; }
64 
65 private:
66  uint16_t m_tag;
67  uint16_t m_size;
68  MetaValue m_value;
69 };
70 
73 public:
74  RafMetaContainer(const IO::Stream::Ptr &_file);
75 
76  uint32_t count();
77  RafMetaValue::Ref getValue(uint16_t tag);
78 
79 private:
80  void _read();
81  uint32_t m_count;
82  std::map<uint16_t, RafMetaValue::Ref> m_tags;
83 };
84 
87 }
88 }
89 
90 #endif
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
Metadata value for RAF files.
Generic interface for the RAW file container.
Metadata value.
Definition: metavalue.hpp:35
Global namespace for libopenraw.
Definition: arwfile.cpp:29