Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

vetCodec_BMP.h

00001 
00040 #ifndef __VETLIB_VETCODEC_BMP_H__
00041  #define __VETLIB_VETCODEC_BMP_H__
00042 
00043  #include "../vetDefs.h"
00044  #include "../vetCodec.h"
00045 
00046  #include "../vetFrameYUV420.h"
00047  #include "../vetFrameRGB24.h"
00048  #include "../vetFrameT.h"
00049  #include "../vetFrameRGB96.h"
00050  #include "../vetFrameRGBA32.h"
00051  #include "../vetFrameHSV.h"
00052 
00053 #define VETRET_CODER_FILEOUT_ER 1010     /*  */
00054 #define VETRET_CODER_SIZE_ER    1011     /*  */
00055 #define VETRET_CODER_WRITE_ER   1012     /*  */
00056 #define VETRET_CODER_PALETTE_ER 1013     /*  */
00057 
00058 
00059 
00060 class vetCodec_BMPParameters;
00061 
00062 
00063 class vetCodec_BMP :  protected vetFrameRGB96,
00064                       public vetCodec
00065  {
00066 
00067         public:
00068 
00069                 enum FileFormat{ FORMAT_BMP_24,
00070                                                  FORMAT_BMP_RC,
00071                                                  FORMAT_BMP_MONO,
00072                                                  FORMAT_BMP_ANY    };
00073 
00074         protected:
00075 
00076                 vetCodec_BMPParameters* myParams;
00077 
00078                 char fileNameIndexBuffer[16];
00079                 char fileNameBuffer[80];
00080 
00081                 void doFileNameCurrent();
00082 
00083         public:
00084 
00085 
00089                 vetCodec_BMP(vetCodec_BMPParameters* initParams = NULL);
00090 
00097                 vetCodec_BMP(vetFrameRGB96& img) : vetFrameRGB96(img), vetCodec() { reset(); }
00098 
00105                 vetCodec_BMP(vetFrameRGB24& img) : vetFrameRGB96(img), vetCodec() { reset(); }
00106 
00114                 vetCodec_BMP(unsigned int x, unsigned int y) : vetFrameRGB96(x, y), vetCodec() { reset(); }
00115 
00123                 vetCodec_BMP(const char* filename, FileFormat format = vetCodec_BMP::FORMAT_BMP_ANY);
00124 
00125 
00126 
00134                 int save();
00135 
00145                 int save(const char *filename, FileFormat format = vetCodec_BMP::FORMAT_BMP_24);
00146 
00154                 int load();
00155 
00165                 int load(const char *filename, FileFormat format = vetCodec_BMP::FORMAT_BMP_24);
00166 
00167 
00174                 bool EoF();
00175 
00176 
00177 
00178 
00179 
00189                 int setParameters(vetCodec_BMPParameters* initParams);
00190 
00196                 vetCodec_BMPParameters& getParameters() { return *myParams; };
00197 
00206                 void setFileNameProgression(bool value);
00207 
00220                 void setAutoOutputEnabled(bool value = true);
00221 
00234                 void setAutoInputEnabled(bool value = true);
00235 
00248                 void setDoBuffering(bool value = true);
00249 
00259                 void setFileName(const char *filename);
00260 
00268                 void setFileFormat(FileFormat format = vetCodec_BMP::FORMAT_BMP_24);
00269 
00281                 int getFileNameIndex();
00290                 bool isFileNameProgressionEnabled();
00291 
00302                 bool isAutoInputEnabled();
00303 
00316                 bool isAutoOutputEnabled();
00317 
00330                 bool isBufferingEnabled();
00331 
00344                 void getFileName(char *filename);
00345 
00354                 void getFileNameCurrent(char *filename);
00355 
00364                 FileFormat getFileFormat(void);
00365 
00372                 int reset();
00373 
00374 
00380 //              unsigned int getWidth() const { return width; };
00381 
00387 //              unsigned int getHeight() const { return height; };
00388 
00394                 int setHeight(unsigned int value) { return VETRET_NOT_IMPLEMENTED; };
00395 
00401                 int setWidth(unsigned int value) { return VETRET_NOT_IMPLEMENTED; };
00402 
00403                 int getAudioStreamCount() { return -1; };
00404                 int getVideoStreamCount() { return -1; };
00405 
00406                 bool hasAudio() { return false; };
00407                 bool hasVideo() { return false; };
00408 
00409                 long getVideoStreamLength(int stream = -1) { return -1; };
00410 
00411                 long getAudioStreamLength(int stream = -1) { return -1; };
00412 
00413 
00427                 VETRESULT extractTo(vetFrameYUV420& img);
00428 
00442                 VETRESULT extractTo(vetFrameRGB24& img);
00443 
00444 
00458                 VETRESULT extractTo(vetFrameT<unsigned char>& img);
00459 
00460 
00461 
00474                 VETRESULT importFrom(vetFrameYUV420& img );
00475 
00488                 VETRESULT importFrom(vetFrameRGB24& img);
00489 
00490 
00503                 VETRESULT importFrom(vetFrameT<unsigned char>& img);
00504 
00505 
00506 
00507 
00508 
00509 
00510 // call importFrom, so filename index is managed
00511 
00520                 void operator << (vetFrameYUV420& img) { vetOutput::operator << (img); }
00521                 void operator << (vetFrameRGB24& img) { vetOutput::operator << (img); }
00522                 void operator << (vetFrameT<unsigned char>& img) { vetOutput::operator << (img); }
00523 
00524 // call extractTo, so filename index and frame rate are managed
00525 
00541                 vetInput& operator >> (vetFrameYUV420& img) { vetInput::operator >> (img); return *this; }
00542                 vetInput& operator >> (vetFrameRGB24& img) { vetInput::operator >> (img); return *this; }
00543                 vetInput& operator >> (vetFrameT<unsigned char>& img) { vetInput::operator >>( img); return *this; }
00544 
00545 
00546 
00547 
00548 
00549 
00560                 static VETRESULT save(vetFrameRGB24 &source, const char *filename,FileFormat format);
00561 
00572                 static VETRESULT save(vetFrameYUV420 &source, const char *filename,FileFormat format);
00573 
00584                 static VETRESULT save(vetFrameT<unsigned char> &source, const char *filename, FileFormat format);
00585 
00596                 static VETRESULT save(vetFrameRGB96 &source, const char *filename,FileFormat format);
00597 
00608                 static VETRESULT load(vetFrameRGB24 &source, const char *filename,FileFormat format);
00609 
00620                 static VETRESULT load(vetFrameYUV420 &source, const char *filename,FileFormat format);
00621 
00632                 static VETRESULT load(vetFrameT<unsigned char> &source, const char *filename, FileFormat format);
00633 
00644                 static VETRESULT load(vetFrameRGB96 &source, const char *filename, FileFormat format);
00645 
00646 
00647                 bool isEncodingAvailable() { return true; };
00648                 bool isDecodingAvailable() { return true; };
00649 
00650 };
00651 
00652 
00653 class vetCodec_BMPParameters : public vetCodecParameters
00654 {
00655         protected:
00656 
00657                 int fileNameIndex;
00658                 char fileNameBase[128];
00659                 bool fileNameProgression;
00660                 bool autoOuput;
00661                 bool autoInput;
00662                 bool doBuffering;
00663                 vetCodec_BMP::FileFormat fileFormat;
00664 
00665 
00666                 friend class vetCodec_BMP;
00667 
00668 
00669         public:
00670 
00671                 vetCodec_BMPParameters();
00672                 vetCodec_BMPParameters(const char* filename, vetCodec_BMP::FileFormat format = vetCodec_BMP::FORMAT_BMP_ANY);
00673                 ~vetCodec_BMPParameters()  {  }
00674 
00675                 void reset();
00676 
00677 
00690                 void setFileNameIndex(int base = -1) { fileNameIndex = base; };
00691 
00700                 void setFileNameProgression(bool value = true) { fileNameProgression = value; };
00701 
00714                 void setAutoOutputEnabled(bool value = true) { autoOuput = value; };
00715 
00728                 void setAutoInputEnabled(bool value = true) { autoInput = value; };
00729 
00742                 void setDoBuffering(bool value = true) { doBuffering = value; };
00743 
00753                 void setFileName(const char *filename);
00754 
00762                 void setFileFormat(vetCodec_BMP::FileFormat format = vetCodec_BMP::FORMAT_BMP_24) { fileFormat = format; };
00763 
00775                 int getFileNameIndex() { return fileNameIndex;};
00784                 bool isFileNameProgressionEnabled() { return fileNameProgression; };
00785 
00796                 bool isAutoInputEnabled() { return autoInput;};
00797 
00810                 bool isAutoOutputEnabled() { return autoOuput;};
00811 
00824                 bool isBufferingEnabled() { return doBuffering;};
00825 
00838                 void getFileName(char *filename);
00839 
00848                 void getFileNameCurrent(char *filename);
00849 
00858                 vetCodec_BMP::FileFormat getFileFormat() { return fileFormat; };
00859 
00860 
00861                 int saveToStreamXML(FILE *fp);
00862                 int loadFromStreamXML(FILE *fp);
00863 
00864 };
00865 
00866 
00867 
00868 
00869 
00870 
00871 #endif //__VETLIB_VETCODER_BMP_H__

Generated on Tue Jan 24 11:58:58 2006 for VETLib by  doxygen 1.4.4