jfifcontainer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef _JFIFCONTAINER_H_
00029 #define _JFIFCONTAINER_H_
00030
00031 #include <setjmp.h>
00032 #include <cstdio>
00033
00034 namespace JPEG {
00035 #include <jpeglib.h>
00036 }
00037
00038 #include <libopenraw/types.h>
00039 #include <libopenraw/consts.h>
00040
00041 #include "exception.h"
00042 #include "rawcontainer.h"
00043
00044 namespace OpenRaw {
00045
00046 class BitmapData;
00047
00048 namespace Internals {
00049
00050 class JFIFContainer
00051 : public RawContainer
00052 {
00053 public:
00054 JFIFContainer(IO::Stream *file, off_t offset);
00056 virtual ~JFIFContainer();
00057
00058 bool getDimensions(uint32_t &x, uint32_t &y);
00059 bool getDecompressedData(BitmapData &data);
00060
00061
00062 static void j_init_source(JPEG::j_decompress_ptr cinfo);
00063 static JPEG::boolean j_fill_input_buffer(JPEG::j_decompress_ptr cinfo);
00064 static void j_skip_input_data(JPEG::j_decompress_ptr cinfo,
00065 long num_bytes);
00066
00067 static void j_term_source(JPEG::j_decompress_ptr cinfo);
00068 static void j_error_exit(JPEG::j_common_ptr cinfo);
00069
00070 private:
00071 int _loadHeader();
00072
00073 struct JPEG::jpeg_decompress_struct m_cinfo;
00074 struct JPEG::jpeg_error_mgr m_jerr;
00075 jmp_buf m_jpegjmp;
00076 bool m_headerLoaded;
00077 };
00078
00079 }
00080 }
00081
00082 #endif