libopenraw  0.3.7
raffile.hpp
1 /* -*- Mode: C++ ; tab-width:4; c-basic-offset:4 -*- */
2 /*
3  * libopenraw - raffile.hpp
4  *
5  * Copyright (C) 2011-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 "rawcontainer.hpp"
31 #include "io/stream.hpp"
32 
38 #define RAF_MAGIC "FUJIFILMCCD-RAW "
40 #define RAF_MAGIC_LEN 16
41 
44 namespace OpenRaw {
45 
46 class RawData;
47 class MetaValue;
48 
49 namespace Internals {
50 
54 class RafContainer;
55 
57 class RafFile : public OpenRaw::RawFile {
58  template<typename T>
59  friend void audit_coefficients();
60 
61 public:
62  static RawFile *factory(const IO::Stream::Ptr &s);
63  RafFile(const IO::Stream::Ptr &s);
64  virtual ~RafFile();
65 
66  RafFile(const RafFile &) = delete;
67  RafFile &operator=(const RafFile &) = delete;
68 
69 protected:
70  virtual ::or_error _enumThumbnailSizes(std::vector<uint32_t> &list) override;
71 
72  virtual RawContainer *getContainer() const override;
73 
74  virtual ::or_error _getRawData(RawData &data, uint32_t options) override;
75 
76  virtual IfdDir::Ref _locateCfaIfd() override
77  {
78  LOGERR("not implemented\n");
79  return IfdDir::Ref();
80  }
81  virtual IfdDir::Ref _locateMainIfd() override;
82 
83  virtual MetaValue *_getMetaValue(int32_t /*meta_index*/) override;
84 
85  virtual void _identifyId() override;
86 
87 private:
88  bool isXTrans(RawFile::TypeId type) const;
89 
90  IO::Stream::Ptr m_io;
91  RafContainer *m_container;
92  // uint32_t m_x;
93  // uint32_t m_y;
94  IfdDir::Ref m_mainIfd;
95  IfdDir::Ref m_exifIfd;
96  IfdDir::Ref m_makerNoteIfd;
97 
98  static const RawFile::camera_ids_t s_def[];
99 };
100 
102 }
103 }
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Definition: ifddir.hpp:56
Fujifilm RAF file.
Definition: raffile.hpp:57
virtual void _identifyId() override
Identify the file and set the ID internally.
Definition: raffile.cpp:661
virtual IfdDir::Ref _locateCfaIfd() override
Locate the IFD for the raw data.
Definition: raffile.hpp:76
virtual ::or_error _getRawData(RawData &data, uint32_t options) override
Get the RAW data.
Definition: raffile.cpp:558
virtual RawContainer * getContainer() const override
Get the container.
Definition: raffile.cpp:511
virtual MetaValue * _getMetaValue(int32_t) override
Implementation for getMetaValue()
Definition: raffile.cpp:640
virtual IfdDir::Ref _locateMainIfd() override
Locate the main IFD.
Definition: raffile.cpp:434
virtual ::or_error _enumThumbnailSizes(std::vector< uint32_t > &list) override
Enumerate the thumbnail sizes.
Definition: raffile.cpp:446
Generic interface for the RAW file container.
Metadata value.
Definition: metavalue.hpp:35
Represent camera raw data.
Definition: rawdata.hpp:38
RAW file.
Definition: rawfile.hpp:66
Type type() const
Accessor for the type.
Definition: rawfile.cpp:375
or_error
Error codes returned by libopenraw.
Definition: consts.h:42
Global namespace for libopenraw.
Definition: arwfile.cpp:29