libopenraw
rawfile.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - rawfile.h
4  *
5  * Copyright (C) 2005-2016 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 
23 
24 #ifndef LIBOPENRAWPP_RAWFILE_H_
25 #define LIBOPENRAWPP_RAWFILE_H_
26 
27 #include <string>
28 #include <vector>
29 
30 #include <libopenraw/rawfile.h>
31 
32 namespace OpenRaw {
33 
34 namespace IO {
35 class Stream;
36 }
37 class Thumbnail;
38 class RawData;
39 class BitmapData;
40 class MetaValue;
41 
42 namespace Internals {
43 class RawContainer;
44 class ThumbDesc;
45 struct BuiltinColourMatrix;
46 }
47 
48 void init();
49 
50 class RawFile
51 {
52 public:
53  typedef ::or_rawfile_type Type;
54  typedef ::or_rawfile_typeid TypeId;
55 
56  RawFile(const RawFile&) = delete;
57  RawFile & operator=(const RawFile &) = delete;
58 
64  static const char **fileExtensions();
65 
71  static RawFile *newRawFile(const char*_filename,
72  Type _typeHint = OR_RAWFILE_TYPE_UNKNOWN);
80  static RawFile *newRawFileFromMemory(const uint8_t *buffer, uint32_t len,
81  Type _typeHint = OR_RAWFILE_TYPE_UNKNOWN);
82 
84  virtual ~RawFile();
86  Type type() const;
87 
91  TypeId typeId();
92 
93  // standard api, like get thumbnail
94  // and get exif.
95 
98  const std::vector<uint32_t> & listThumbnailSizes(void);
104  ::or_error getThumbnail(uint32_t size, Thumbnail & thumbnail);
105 
111  ::or_error getRawData(RawData & rawdata, uint32_t options);
112 
118  ::or_error getRenderedImage(BitmapData & bitmapdata, uint32_t options);
119 
122  int32_t getOrientation();
123 
127  uint32_t colourMatrixSize();
128 
136  ::or_error getColourMatrix1(double* matrix, uint32_t & size);
137  ::or_error getColourMatrix2(double* matrix, uint32_t & size);
138 
142  ExifLightsourceValue getCalibrationIlluminant1();
143  ExifLightsourceValue getCalibrationIlluminant2();
144 
145  const MetaValue *getMetaValue(int32_t meta_index);
146 protected:
147  struct camera_ids_t {
148  const char * model;
149  const uint32_t type_id;
150  };
155  RawFile(Type _type);
156 
158  void _setTypeId(TypeId _type_id);
162  TypeId _typeId() const;
163 
165  virtual Internals::RawContainer* getContainer() const = 0;
166 
171  virtual ::or_error _enumThumbnailSizes(std::vector<uint32_t> &list) = 0;
172 
180  virtual ::or_error _getThumbnail(uint32_t size, Thumbnail & thumbnail);
181  void _addThumbnail(uint32_t size, const Internals::ThumbDesc& desc);
182 
189  virtual ::or_error _getRawData(RawData & data, uint32_t options) = 0;
190 
194  virtual ::or_error _getColourMatrix(uint32_t index, double* matrix, uint32_t & size);
195  virtual ExifLightsourceValue _getCalibrationIlluminant(uint16_t index);
196  virtual MetaValue *_getMetaValue(int32_t /*meta_index*/) = 0;
197 
198  TypeId _typeIdFromModel(const std::string& make, const std::string & model);
199  TypeId _typeIdFromMake(const std::string& make);
200  void _setIdMap(const camera_ids_t *map);
201  void _setMatrices(const Internals::BuiltinColourMatrix* matrices);
202  const Internals::BuiltinColourMatrix* _getMatrices() const;
203 
204  virtual void _identifyId() = 0;
205 
206  static ::or_error _getBuiltinLevels(const Internals::BuiltinColourMatrix* m,
207  TypeId type_id,
208  uint16_t & black,
209  uint16_t & white);
210  static ::or_error _getBuiltinColourMatrix(const Internals::BuiltinColourMatrix* m,
211  TypeId type_id,
212  double* matrix,
213  uint32_t & size);
214 
215 private:
216  static Type identify(const char*_filename);
217  static ::or_error identifyBuffer(const uint8_t* buff, size_t len,
218  Type &_type);
219  static const camera_ids_t s_make[];
220  static const camera_ids_t* _lookupCameraId(const camera_ids_t * map,
221  const std::string& value);
222 
223 
224  class Private;
225 
226  Private *d;
227 };
228 
229 
230 
231 }
232 
233 /*
234  Local Variables:
235  mode:c++
236  c-file-style:"stroustrup"
237  c-file-offsets:((innamespace . 0))
238  indent-tabs-mode:nil
239  fill-column:80
240  End:
241 */
242 #endif
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30