libopenraw
jfifcontainer.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - jfifcontainer.h
4  *
5  * Copyright (C) 2006-2015 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 
26 #ifndef OR_INTERNALS_JFIFCONTAINER_H_
27 #define OR_INTERNALS_JFIFCONTAINER_H_
28 
29 #include <stdint.h>
30 #include <sys/types.h>
31 #include <setjmp.h>
32 
33 #include <memory>
34 
35 #include "ifddir.hpp"
36 #include "io/stream.hpp"
37 #include "rawcontainer.hpp"
38 
39 extern "C" {
40 #include <jpeglib.h>
41 }
42 
43 namespace OpenRaw {
44 
45 class BitmapData;
46 
47 namespace Internals {
48 
49 class IfdFileContainer;
50 
52  : public RawContainer
53 {
54 public:
55  JfifContainer(const IO::Stream::Ptr &file, off_t offset);
57  virtual ~JfifContainer();
58 
59  bool getDimensions(uint32_t &x, uint32_t &y);
60  bool getDecompressedData(BitmapData &data);
61 
63  IfdDir::Ref mainIfd();
65  IfdDir::Ref getIfdDirAt(int idx);
67  IfdDir::Ref exifIfd();
69  std::unique_ptr<IfdFileContainer> & ifdContainer();
70 
71  jmp_buf & jpegjmp() {
72  return m_jpegjmp;
73  }
74 private:
75  int _loadHeader();
76 
77  struct jpeg_decompress_struct m_cinfo;
78  struct jpeg_error_mgr m_jerr;
79  jmp_buf m_jpegjmp;
80  bool m_headerLoaded;
81  std::unique_ptr<IfdFileContainer> m_ifd;
82 };
83 
84 }
85 }
86 
87 #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
std::unique_ptr< IfdFileContainer > & ifdContainer()