00001 00038 #ifndef __VETLIB_VETCODEC_H__ 00039 #define __VETLIB_VETCODEC_H__ 00040 00041 #include "vetDefs.h" 00042 #include "vetObject.h" 00043 #include "vetInput.h" 00044 #include "vetOutput.h" 00045 #include "vetFilter.h" 00046 00047 #include "vetFrameYUV420.h" 00048 #include "vetFrameRGB24.h" 00049 #include "vetFrameT.h" 00050 00051 00052 class vetCodecParameters; 00053 00054 class vetCodec : public vetInput, 00055 public vetOutput, 00056 public vetObject 00057 { 00058 00059 protected: 00060 00061 00062 00063 00064 public: 00065 00072 vetCodec(float fps = 0) : vetObject() { v_sleeptime = 0; } 00073 00074 00078 virtual ~vetCodec() {} 00079 00080 00088 virtual VETRESULT reset() = 0; 00089 00097 virtual int getAudioStreamCount(int stream = -1) = 0; 00098 00106 virtual int getVideoStreamCount(int stream = -1) = 0; 00107 00108 00114 virtual bool EoF() = 0; 00115 00121 virtual bool isEncodingAvailable() = 0; 00122 00128 virtual bool isDecodingAvailable() = 0; 00129 00130 00131 00139 virtual long getVideoStreamLength(int stream = -1) = 0; 00140 00148 virtual long getAudioStreamLength(int stream = -1) = 0; 00149 00150 00151 00159 virtual bool hasAudio(int stream = -1) = 0; 00160 00168 virtual bool hasVideo(int stream = -1) = 0; 00169 00170 00171 00177 virtual VETRESULT close() = 0; 00178 00179 00180 00181 00190 virtual VETRESULT load(char *filename, int stream = -1) = 0; 00191 00200 virtual VETRESULT save(char *filename, int stream = -1) = 0; 00201 00202 00203 00204 00217 virtual VETRESULT extractTo(vetFrameYUV420& img) = 0; 00218 00231 virtual VETRESULT extractTo(vetFrameRGB24& img) = 0; 00232 00245 virtual VETRESULT extractTo(vetFrameT<unsigned char>& img) = 0; 00246 00247 00248 00261 virtual VETRESULT importFrom(vetFrameYUV420& img) = 0; 00262 00275 virtual VETRESULT importFrom(vetFrameRGB24& img) = 0; 00276 00289 virtual VETRESULT importFrom(vetFrameT<unsigned char>& img) = 0; 00290 00291 00292 00299 enum{ vetClassType = VETCLASS_TYPE_CODEC }; 00300 }; 00301 00302 00303 00305 00306 #include <stdio.h> 00307 #include <fstream> 00308 00309 00310 class vetCodecParameters : public vetFilterParameters 00311 { 00312 00313 protected: 00314 00315 char fileName[128]; 00316 00317 long frameIndex; 00318 00319 int stream; 00320 00321 public: 00322 00327 vetCodecParameters() { fileName[0] = '\0'; frameIndex = 0, stream = 0; }; 00328 00329 00333 virtual ~vetCodecParameters() {} 00334 00335 00336 void reset() {}; 00337 00346 virtual VETRESULT saveToStreamXML(FILE *fp) = 0; 00347 00356 virtual VETRESULT loadFromStreamXML(FILE *fp) = 0; 00357 00358 }; 00359 00360 00361 #endif //__VETLIB_VETCODEC_H__ 00362
1.4.4