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 namespace Internals {
00047
00048 class JFIFContainer
00049 : public RawContainer
00050 {
00051 public:
00052 JFIFContainer(IO::Stream *file, off_t offset);
00054 virtual ~JFIFContainer();
00055
00056 bool getDimensions(uint32_t &x, uint32_t &y);
00057
00058
00059 static void j_init_source(JPEG::j_decompress_ptr cinfo);
00060 static JPEG::boolean j_fill_input_buffer(JPEG::j_decompress_ptr cinfo);
00061 static void j_skip_input_data(JPEG::j_decompress_ptr cinfo,
00062 long num_bytes);
00063
00064 static void j_term_source(JPEG::j_decompress_ptr cinfo);
00065 static void j_error_exit(JPEG::j_common_ptr cinfo);
00066
00067 private:
00068 int _loadHeader();
00069
00070 struct JPEG::jpeg_decompress_struct m_cinfo;
00071 struct JPEG::jpeg_error_mgr m_jerr;
00072 jmp_buf m_jpegjmp;
00073 bool m_headerLoaded;
00074 };
00075
00076 }
00077 }
00078
00079 #endif