libopenraw  0.3.7
jfifcontainer.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - jfifcontainer.h
4  *
5  * Copyright (C) 2006-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 <sys/types.h>
26 #include <setjmp.h>
27 
28 #include <memory>
29 
30 #include "ifddir.hpp"
31 #include "io/stream.hpp"
32 #include "rawcontainer.hpp"
33 
34 extern "C" {
35 #include <jpeglib.h>
36 }
37 
38 namespace OpenRaw {
39 
40 class BitmapData;
41 
42 namespace Internals {
43 
44 class IfdFileContainer;
45 
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 
63  IfdDir::Ref getIfdDirAt(int idx);
67  std::unique_ptr<IfdFileContainer> & ifdContainer();
69  size_t exifOffset() const {
70  return m_exif_offset;
71  }
72 
73  jmp_buf & jpegjmp() {
74  return m_jpegjmp;
75  }
76 private:
77  int _loadHeader();
78 
79  struct jpeg_decompress_struct m_cinfo;
80  struct jpeg_error_mgr m_jerr;
81  jmp_buf m_jpegjmp;
82  bool m_headerLoaded;
83  std::unique_ptr<IfdFileContainer> m_ifd;
84  size_t m_exif_offset;
85 };
86 
87 }
88 }
Represent some bitmap data.
Definition: bitmapdata.hpp:30
std::shared_ptr< Stream > Ptr
Definition: stream.hpp:47
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Definition: ifddir.hpp:56
std::unique_ptr< IfdFileContainer > & ifdContainer()
Generic interface for the RAW file container.
Global namespace for libopenraw.
Definition: arwfile.cpp:29