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 namespace JPEG {
34 #include <jpeglib.h>
35 }
36 
37 #include "ifddir.hpp"
38 #include "io/stream.hpp"
39 #include "rawcontainer.hpp"
40 
41 namespace OpenRaw {
42 
43 class BitmapData;
44 
45 namespace Internals {
46 
47 class IfdFileContainer;
48 
50  : public RawContainer
51 {
52 public:
53  JfifContainer(const IO::Stream::Ptr &file, off_t offset);
55  virtual ~JfifContainer();
56 
57  bool getDimensions(uint32_t &x, uint32_t &y);
58  bool getDecompressedData(BitmapData &data);
59 
61  IfdDir::Ref mainIfd();
63  IfdDir::Ref getIfdDirAt(int idx);
65  IfdDir::Ref exifIfd();
67  IfdFileContainer* ifdContainer();
68 
69  /* libjpeg callbacks j_ is the prefix for these callbacks */
70  static void j_init_source(JPEG::j_decompress_ptr cinfo);
71  static JPEG::boolean j_fill_input_buffer(JPEG::j_decompress_ptr cinfo);
72  static void j_skip_input_data(JPEG::j_decompress_ptr cinfo,
73  long num_bytes);
74 // static void j_jpeg_resync_to_restart(JPEG::j_decompress_ptr cinfo);
75  static void j_term_source(JPEG::j_decompress_ptr cinfo);
76  static void j_error_exit(JPEG::j_common_ptr cinfo);
77 
78 private:
79  int _loadHeader();
80 
81  struct JPEG::jpeg_decompress_struct m_cinfo;
82  struct JPEG::jpeg_error_mgr m_jerr;
83  jmp_buf m_jpegjmp;
84  bool m_headerLoaded;
85  IfdFileContainer* m_ifd;
86 };
87 
88 }
89 }
90 
91 #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
a JPEG container