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

vetCodec_MPEG.h

00001 
00045 #ifndef __VETLIB_VETCODEC_MPEG_H__
00046  #define __VETLIB_VETCODEC_MPEG_H__
00047 
00048  #include "../vetDefs.h"
00049  #include "../vetCodec.h"
00050 
00051  #include "../vetFrameYUV420.h"
00052  #include "../vetFrameRGB24.h"
00053  #include "../vetFrameT.h"
00054 
00055  #include "../../support/libmpeg3/libmpeg3.h"
00056 
00057 
00058  #define VETRET_CODER_FILEOUT_ERR       1010     /*  */
00059  #define VETRET_CODER_SIZE_ERR          1011     /*  */
00060  #define VETRET_CODER_WRITE_ERR         1012     /*  */
00061  #define VETRET_CODER_PALETTE_ERR       1013     /*  */
00062 
00063 
00064 
00065 
00066 
00067 
00068 class vetCodec_MPEGParameters : public vetCodecParameters
00069 {
00070         protected:
00071 
00072                 char fileName[64];
00073                 long frameIndex;
00074                 int stream;
00075 
00076                 friend class vetCodec_MPEG;
00077 
00078 
00079         public:
00080 
00084                 vetCodec_MPEGParameters();
00085 
00094                 vetCodec_MPEGParameters(const char* filename, int stream = 0, long frameIndex = 0);
00095 
00099                 ~vetCodec_MPEGParameters()  {  }
00100 
00104                 void reset();
00105 
00112                 void setStream(int stream = 0);
00113 
00120                 void setFileName(const char *filename);
00121 
00128                 void setFrameIndex(long index = 0);
00129 
00130 
00139                 VETRESULT saveToStreamXML(FILE *fp);
00140 
00149                 VETRESULT loadFromStreamXML(FILE *fp);
00150 
00151 };
00152 
00153 
00154 
00155 
00156 
00157 
00158 class vetCodec_MPEG :  public vetCodec
00159  {
00160         public:
00161 
00162 
00163         protected:
00164 
00168                 vetCodec_MPEGParameters* myParams;
00169 
00173                 mpeg3_t* file;
00174 
00178                 unsigned char** buff;           
00179 
00183                 char *Y;
00187                 char *U;
00191                 char *V;
00192 
00196                 unsigned int width;
00197 
00201                 unsigned int height;
00202 
00203 
00204         public:
00205 
00206 
00211                 vetCodec_MPEG(vetCodec_MPEGParameters* initParams = NULL);
00212 
00220                 vetCodec_MPEG(char* filename, int stream = 0);
00221 
00225                 ~vetCodec_MPEG();
00226 
00227 
00233                 VETRESULT save() { return VETRET_NOT_IMPLEMENTED; };
00234                 VETRESULT save(char *filename, int stream = 0) { return VETRET_NOT_IMPLEMENTED; };
00235 
00236 
00243                 VETRESULT load();
00244 
00245 
00254                 VETRESULT load(char *filename, int stream = 0);
00255 
00256 
00266                 VETRESULT setParameters(vetCodec_MPEGParameters* initParams);
00267 
00273                 vetCodec_MPEGParameters& getParameters() { return *myParams; };
00274 
00275 
00276 
00277                 VETRESULT setFilterParameters (vetFilterParameters* initParams) { return setParameters(static_cast<vetCodec_MPEGParameters*>(initParams)); };
00278                 vetFilterParameters* getFilterParameters () { return static_cast<vetFilterParameters*>(myParams); };
00279 
00280 
00286                 VETRESULT reset();
00287 
00294                 bool EoF();
00295 //BUG
00301                 bool eof(int stream = -1) const;
00302 
00303 // FRAME BROWSING FUNCTIONS
00304 
00315                 VETRESULT setFrameIndex(long index, int stream = -1);
00316 
00317 
00327                 VETRESULT goToPreviousFrame(int stream = -1);
00328 
00338                 VETRESULT goToVideoEnd(int stream = -1);
00339 
00349                 VETRESULT goToAudioEnd(int stream = -1);
00350 
00351 
00352 /* Give the seconds time in the last packet read */
00353                 double getLastPacketTime();
00354 
00364 //long getAudioFrameIndex(int stream = -1);
00373 //long getVideoFrameIndex(int stream = -1);
00374 
00375 
00376 // VIDEO INFO FUNCTIONS
00377 
00383                 unsigned int getWidth() const { return width; };
00384 
00390                 unsigned int getHeight() const { return height; };
00391 
00392 
00401                 int getColorModel(int stream = -1);
00402 
00403 
00409                 bool hasVideo();
00410 
00416                 int getVideoStreamCount();
00417 
00426                 float getVideoFrameRate(int stream = -1);
00427 
00436                 long getVideoStreamLength(int stream = -1);
00437 
00438 
00439 
00440 // AUDIO INFO FUNCTIONS
00441 
00447                 bool hasAudio();
00448 
00454                 int getAudioStreamCount();
00455 
00464                 int getAudioChannels(int stream = -1);
00465 
00474                 float getAudioSampleRate(int stream = -1);
00475 
00484                 long getAudioStreamLength(int stream = -1);
00485 
00486 
00492                 VETRESULT setHeight(unsigned int value)
00493                  {
00494                         height = value;
00495                         return VETRET_OK;
00496                  };
00497 
00503                 VETRESULT setWidth(unsigned int value)
00504                  {
00505                         width = value;
00506                         return VETRET_OK;
00507                  };
00508 
00509 
00510 
00511                 static int getMPEG3_Version_major();
00512                 static int getMPEG3_Version_minor();
00513                 static int getMPEG3_Version_release();
00514 
00515 
00516 
00517 
00518 
00531                 VETRESULT extractTo(vetFrameYUV420& img);
00532 
00545                 VETRESULT extractTo(vetFrameRGB24& img);
00546 
00547 
00560                 VETRESULT extractTo(vetFrameT<unsigned char>& img);
00561 
00562 
00563 
00570                 VETRESULT importFrom(vetFrameYUV420& img);
00571 
00578                 VETRESULT importFrom(vetFrameRGB24& img);
00579 
00586                 VETRESULT importFrom(vetFrameT<unsigned char>& img);
00587 
00588 
00589 
00590 
00591 
00592 
00601 //              void operator << (vetFrameYUV420& img) { vetOutput::operator << (img); }
00602 //              void operator << (vetFrameRGB24& img) { vetOutput::operator << (img); }
00603 //              void operator << (vetFrameT<unsigned char>& img) { vetOutput::operator << (img); }
00604 
00620 //              vetInput& operator >> (vetFrameYUV420& img) { vetInput::operator >> (img); return *this; }
00621 //              vetInput& operator >> (vetFrameRGB24& img) { vetInput::operator >> (img); return *this; }
00622 //              vetInput& operator >> (vetFrameT<unsigned char>& img) { vetInput::operator >>( img); return *this; }
00623 
00624 
00625                 bool isEncodingAvailable() { return false; };
00626                 bool isDecodingAvailable() { return true; };
00627 
00628 
00629 };
00630 
00631 
00632 
00633 
00634 
00635 
00636 #endif //__VETLIB_VETCODEC_MPEG_H__

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