00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00031
00032 #pragma once
00033
00034 #include "../api_display.h"
00035 #include "../Image/pixel_buffer.h"
00036 #include "../../Core/Text/string_types.h"
00037 #include <vector>
00038
00039 class CL_IODevice;
00040 class CL_JPEGDecompressor_Impl;
00041
00045 class CL_API_DISPLAY CL_JPEGDecompressor
00046 {
00049
00050 public:
00051
00055 CL_JPEGDecompressor(CL_IODevice input_source);
00056
00060
00061 public:
00062 enum SpecialMarker
00063 {
00064 marker_rst0 = 0xD0,
00065 marker_eoi = 0xD9,
00066 marker_app0 = 0xe0,
00067 marker_app1 = 0xe1,
00068 marker_app2 = 0xe2,
00069 marker_app3 = 0xe3,
00070 marker_app4 = 0xe4,
00071 marker_app5 = 0xe5,
00072 marker_app6 = 0xe6,
00073 marker_app7 = 0xe7,
00074 marker_app8 = 0xe8,
00075 marker_app9 = 0xe9,
00076 marker_app10 = 0xea,
00077 marker_app11 = 0xeb,
00078 marker_app12 = 0xec,
00079 marker_app13 = 0xed,
00080 marker_app14 = 0xee,
00081 marker_com = 0xfe
00082 };
00083
00084 struct SavedMarker
00085 {
00086 unsigned char marker;
00087 unsigned int original_length;
00088 unsigned int data_length;
00089 void *data;
00090 };
00091
00095 int get_output_width() const;
00096
00100 int get_output_height() const;
00101
00105 int get_output_components() const;
00106
00107 std::vector<SavedMarker> get_saved_markers() const;
00108
00112
00113 public:
00114
00119 void record_marker(SpecialMarker marker_code, unsigned int length_limit = 0xffff);
00120
00124 void start(bool raw_data = false);
00125
00126 unsigned int read_scanlines(unsigned char **data, unsigned int lines);
00127
00128 unsigned int read_raw_data(const unsigned char ***data, unsigned int lines);
00129
00131 void finish();
00132
00136
00137 private:
00138 CL_SharedPtr<CL_JPEGDecompressor_Impl> impl;
00140 };
00141