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

vetCodec_BMP2.h

00001 
00038 #ifndef __VETLIB_VETCODEC_BMP_H__
00039  #define __VETLIB_VETCODEC_BMP_H__
00040 
00041  #include "../vetDefs.h"
00042  #include "../vetCodec.h"
00043 
00044  #include "../vetFrameYUV420.h"
00045  #include "../vetFrameRGB24.h"
00046  #include "../vetFrameT.h"
00047  #include "../vetFrameRGB96.h"
00048  #include "../vetFrameRGBA32.h"
00049  #include "../vetFrameHSV.h"
00050 
00051 #define VETRET_CODER_FILEOUT_ER 1010     /*  */
00052 #define VETRET_CODER_SIZE_ER    1011     /*  */
00053 #define VETRET_CODER_WRITE_ER   1012     /*  */
00054 #define VETRET_CODER_PALETTE_ER 1013     /*  */
00055 
00056 
00057 
00058 class vetCodec_BMPParameters;
00059 
00060 
00061 class vetCodec_BMP :  protected vetFrameRGB96,
00062                       public vetCodec
00063  {
00064 
00065         protected:
00066 
00067                 vetCodec_BMPParameters* myParams;
00068 
00069                 char fileNameIndexBuffer[16];
00070                 char fileNameBuffer[80];
00071 
00072                 void doFileNameCurrent();
00073 
00074         public:
00075 
00076                 enum FileFormat{ FORMAT_BMP_24,
00077                                                  FORMAT_BMP_RC,
00078                                                  FORMAT_BMP_MONO,
00079                                                  FORMAT_BMP_ANY    };
00080 
00081 
00082 
00086                 vetCodec_BMP(vetCodec_BMPParameters* initParams = NULL);
00087 
00094                 vetCodec_BMP(vetFrameRGB24& img) : vetFrameRGB96(), vetCodec() {        vetFrameRGB96::operator << (img); reset(); }
00095 
00102                 vetCodec_BMP(vetFrameRGB96& img) : vetFrameRGB96(img), vetCodec() { reset(); }
00103 
00111                 vetCodec_BMP(unsigned int x, unsigned int y) : vetFrameRGB96(x, y), vetCodec() { reset(); }
00112 
00120                 vetCodec_BMP(char* filename, FileFormat format = vetCodec_BMP::FORMAT_BMP_ANY);
00121 
00122 
00123 
00131                 VETRESULT save();
00132 
00142                 VETRESULT save(char *filename, int format = vetCodec_BMP::FORMAT_BMP_24);
00143 
00151                 VETRESULT load();
00152 
00162                 VETRESULT load(char *filename, int format = vetCodec_BMP::FORMAT_BMP_24);
00163 
00164 
00174                 VETRESULT setParameters(vetCodec_BMPParameters* initParams);
00175 
00181                 vetCodec_BMPParameters& getParameters() { return *myParams; };
00182 
00183 
00184                 VETRESULT setFilterParameters (vetFilterParameters* initParams);
00185                 vetFilterParameters* getFilterParameters ();
00186 
00187 
00194                 bool EoF();
00195 
00196 
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                 VETRESULT reset();
00373 
00374 
00380 //              unsigned int getWidth() const { return width; };
00381 
00387 //              unsigned int getHeight() const { return height; };
00388 
00394                 VETRESULT setHeight(unsigned int value) { return VETRET_NOT_IMPLEMENTED; };
00395 //BUG
00401                 VETRESULT 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 
00426                 VETRESULT extractTo(vetFrameYUV420& img);
00427 
00441                 VETRESULT extractTo(vetFrameRGB24& img);
00442 
00443 
00457                 VETRESULT extractTo(vetFrameT<unsigned char>& img);
00458 
00459 
00460 
00473                 VETRESULT importFrom(vetFrameYUV420& img );
00474 
00487                 VETRESULT importFrom(vetFrameRGB24& img);
00488 
00489 
00502                 VETRESULT importFrom(vetFrameT<unsigned char>& img);
00503 
00504 
00505 
00506 // call importFrom, so filename index is managed
00507 
00516                 void operator << (vetFrameYUV420& img) { vetOutput::operator << (img); }
00517                 void operator << (vetFrameRGB24& img) { vetOutput::operator << (img); }
00518                 void operator << (vetFrameT<unsigned char>& img) { vetOutput::operator << (img); }
00519 
00520 // call extractTo, so filename index and frame rate are managed
00521 
00537                 vetInput& operator >> (vetFrameYUV420& img) { vetInput::operator >> (img); return *this; }
00538                 vetInput& operator >> (vetFrameRGB24& img) { vetInput::operator >> (img); return *this; }
00539                 vetInput& operator >> (vetFrameT<unsigned char>& img) { vetInput::operator >>( img); return *this; }
00540 
00541 
00542 
00543 
00554                 static VETRESULT save(vetFrameYUV420 &source, char *filename, FileFormat format);
00555 
00566                 static VETRESULT save(vetFrameRGB24 &source, char *filename, FileFormat format);
00567 
00578                 static VETRESULT save(vetFrameRGB96 &source, char *filename, FileFormat format);
00579 
00590                 static VETRESULT save(vetFrameT<unsigned char> &source, char *filename, FileFormat format);
00591 
00592 
00603                 static VETRESULT load(vetFrameYUV420 &source, char *filename,FileFormat format);
00604 
00615                 static VETRESULT load(vetFrameRGB24 &source, char *filename,FileFormat format);
00616 
00627                 static VETRESULT load(vetFrameRGB96 &source, char *filename, FileFormat format);
00628 
00639                 static VETRESULT load(vetFrameT<unsigned char> &source, char *filename, FileFormat format);
00640 
00641 
00642                 bool isEncodingAvailable() { return true; };
00643                 bool isDecodingAvailable() { return true; };
00644 
00645 };
00646 
00647 
00648 
00649 
00650 class vetCodec_BMPParameters : public vetCodecParameters
00651 {
00652         protected:
00653 
00654                 int fileNameIndex;
00655                 char fileNameBase[128];
00656                 bool fileNameProgression;
00657                 bool autoOuput;
00658                 bool autoInput;
00659                 bool doBuffering;
00660                 vetCodec_BMP::FileFormat fileFormat;
00661 
00662 
00663                 friend class vetCodec_BMP;
00664 
00665 
00666         public:
00667 
00668                 vetCodec_BMPParameters();
00669                 vetCodec_BMPParameters(const char* filename, vetCodec_BMP::FileFormat format = vetCodec_BMP::FORMAT_BMP_ANY);
00670                 ~vetCodec_BMPParameters()  {  }
00671 
00672                 void reset();
00673 
00674 
00687                 void setFileNameIndex(int base = -1) { fileNameIndex = base; };
00688 
00697                 void setFileNameProgression(bool value = true) { fileNameProgression = value; };
00698 
00711                 void setAutoOutputEnabled(bool value = true) { autoOuput = value; };
00712 
00725                 void setAutoInputEnabled(bool value = true) { autoInput = value; };
00726 
00739                 void setDoBuffering(bool value = true) { doBuffering = value; };
00740 
00750                 void setFileName(const char *filename);
00751 
00759                 void setFileFormat(vetCodec_BMP::FileFormat format = vetCodec_BMP::FORMAT_BMP_24) { fileFormat = format; };
00760 
00772                 int getFileNameIndex() { return fileNameIndex;};
00781                 bool isFileNameProgressionEnabled() { return fileNameProgression; };
00782 
00793                 bool isAutoInputEnabled() { return autoInput;};
00794 
00807                 bool isAutoOutputEnabled() { return autoOuput;};
00808 
00821                 bool isBufferingEnabled() { return doBuffering;};
00822 
00835                 void getFileName(char *filename);
00836 
00845                 void getFileNameCurrent(char *filename);
00846 
00855                 vetCodec_BMP::FileFormat getFileFormat() { return fileFormat; };
00856 
00857 
00858                 VETRESULT saveToStreamXML(FILE *fp);
00859                 VETRESULT loadFromStreamXML(FILE *fp);
00860 
00861 };
00862 
00863 
00864 
00865 
00866 
00867 
00868 #endif //__VETLIB_VETCODEC_BMP_H__

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