libopenraw  0.3.7
cr3file.hpp
1 /* -*- mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil; -*- */
2 /*
3  * libopenraw - cr3file.hpp
4  *
5  * Copyright (C) 2018-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 
26 #include <array>
27 #include <memory>
28 
29 #include <libopenraw/consts.h>
30 
31 #include "io/stream.hpp"
32 #include "rawfile.hpp"
33 #include "ifdfilecontainer.hpp"
34 #include "makernotedir.hpp"
35 
36 namespace OpenRaw {
37 
38 class RawData;
39 
40 namespace Internals {
41 
42 class IsoMediaContainer;
43 
49 class Cr3File : public RawFile {
50  template<typename T>
51  friend void audit_coefficients();
52 
53 public:
54  static RawFile *factory(const IO::Stream::Ptr &s);
55  Cr3File(const IO::Stream::Ptr &s);
56  virtual ~Cr3File();
57 
58  Cr3File(const Cr3File &) = delete;
59  Cr3File &operator=(const Cr3File &) = delete;
60 
61 protected:
63  std::vector<uint32_t> &list) override;
64  virtual RawContainer* getContainer() const override;
65  virtual ::or_error _getRawData(RawData &data, uint32_t options) override;
66 
67  virtual MetaValue* _getMetaValue(int32_t /*meta_index*/) override;
68 
69  virtual void _identifyId() override;
70 
71  virtual IfdDir::Ref _locateCfaIfd() override
72  {
73  LOGERR("not implemented\n");
74  return IfdDir::Ref();
75  }
76  virtual IfdDir::Ref _locateMainIfd() override;
77  virtual IfdDir::Ref _locateExifIfd() override;
78  virtual MakerNoteDir::Ref _locateMakerNoteIfd() override;
79 
80 private:
81  IfdDir::Ref findIfd(uint32_t idx);
82 
83  IO::Stream::Ptr m_io;
84  IsoMediaContainer *m_container;
85  std::array<std::shared_ptr<IfdFileContainer>, 4> m_ifds;
86 
87  static const RawFile::camera_ids_t s_def[];
88 };
89 
92 }
93 }
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
virtual MakerNoteDir::Ref _locateMakerNoteIfd() override
Locate the MakerNote IFD.
Definition: cr3file.cpp:315
virtual MetaValue * _getMetaValue(int32_t) override
Implementation for getMetaValue()
Definition: cr3file.cpp:326
virtual ::or_error _enumThumbnailSizes(std::vector< uint32_t > &list) override
Enumerate the thumbnail sizes.
Definition: cr3file.cpp:223
virtual IfdDir::Ref _locateMainIfd() override
Locate the main IFD.
Definition: cr3file.cpp:297
virtual IfdDir::Ref _locateCfaIfd() override
Locate the IFD for the raw data.
Definition: cr3file.hpp:71
virtual ::or_error _getRawData(RawData &data, uint32_t options) override
Get the RAW data.
Definition: cr3file.cpp:186
virtual RawContainer * getContainer() const override
Get the container.
Definition: cr3file.cpp:181
virtual IfdDir::Ref _locateExifIfd() override
Locate the Exif IFD.
Definition: cr3file.cpp:306
virtual void _identifyId() override
Identify the file and set the ID internally.
Definition: cr3file.cpp:351
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Definition: ifddir.hpp:56
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
or_error
Error codes returned by libopenraw.
Definition: consts.h:42
Global namespace for libopenraw.
Definition: arwfile.cpp:29