00001 #ifndef JPEG_READER_H 00002 #define JPEG_READER_H 00003 00004 #include <stdlib.h> 00005 #include <string.h> 00006 00007 extern "C" { 00008 #include <jpeglib.h> 00009 } 00010 00011 class JpegReader 00012 { 00013 public : 00014 typedef enum {cmAuto, cmGray, cmRGB, cmYUV} ColorSpace; 00015 unsigned int size; 00016 unsigned int width,height; 00017 ColorSpace reqColorSpace, outputColorSpace; 00018 bool externaloutput; 00019 unsigned char * buffer; 00020 double timestamp; 00021 00022 JpegReader(); 00023 00024 virtual ~JpegReader(); 00025 00026 virtual bool load(char * filename); 00027 virtual bool load(const unsigned char * src, unsigned int srcsize); 00028 00029 void setTimeStamp(); 00030 void setTimeStamp(double ts); 00031 ColorSpace getOutputColorSpace() const {return outputColorSpace;} 00032 virtual void setOutputColorSpace(ColorSpace cspace); 00033 00034 void setExternalOutput(unsigned char * dest) 00035 { 00036 free(buffer); 00037 externaloutput = false; 00038 buffer = dest; 00039 } 00040 void resetOutput() { 00041 externaloutput = true; 00042 buffer = NULL; 00043 } 00044 00045 }; 00046 00047 00048 00049 00050 #endif // JPEG_READER_H