00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef __OPAL_CU30CODEC_H
00051 #define __OPAL_CU30CODEC_H
00052
00053 #ifdef P_USE_PRAGMA
00054 #pragma interface
00055 #endif
00056
00057
00058 #include "h323caps.h"
00059
00060
00062
00063
00066 class H323_Cu30Capability : public H323NonStandardVideoCapability
00067 {
00068 PCLASSINFO(H323_Cu30Capability, H323NonStandardVideoCapability);
00069
00070 public:
00075 H323_Cu30Capability(
00076 H323EndPoint & endpoint,
00077 PString statsDir,
00078 INT _width,
00079 INT _height,
00080 INT _statsFrames
00081 );
00083
00088 virtual PObject * Clone() const;
00090
00095 virtual H323Codec * CreateCodec(
00096 H323Codec::Direction direction
00097 ) const;
00099
00104 virtual PString GetFormatName() const;
00106
00107 PString statisticsDir;
00108
00109
00110 INT newWidth;
00111 INT newHeight;
00112 INT statsFrames;
00113 };
00114
00116
00118 class H323_Cu30Codec : public H323VideoCodec, public PDynaLink
00119 {
00120 PCLASSINFO(H323_Cu30Codec, H323VideoCodec)
00121
00122 public:
00127 H323_Cu30Codec(
00128 Direction direction,
00129 PString statsDir,
00130 INT _width,
00131 INT _height,
00132 INT _statsFrames
00133 );
00134 ~H323_Cu30Codec();
00136
00137
00162 virtual BOOL Read(
00163 BYTE * buffer,
00164 unsigned & length,
00165 RTP_DataFrame & rtpFrame
00166 );
00167
00180 virtual BOOL Write(
00181 const BYTE * buffer,
00182 unsigned length,
00183 const RTP_DataFrame & rtp,
00184 unsigned & written
00185 );
00186
00191 BOOL RecordStatistics(unsigned char *src);
00192
00193 protected:
00196 BOOL Resize(int width, int height);
00197
00200 BOOL Redraw();
00201
00209 BOOL RenderFrame();
00210
00218 virtual void OnLostPartialPicture();
00219
00224 virtual void OnLostPicture();
00225
00226 private:
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00241 void Close();
00242
00244
00250 int (*OpenEncoderWith)(void *, int,int,char *);
00251
00255 int (*OpenEncoder)(void *, int,int);
00256
00260 int (*CloseEncoder)(void *);
00261
00265 int (*OpenDecoder)(void *, int,int);
00266
00270 int (*CloseDecoder)(void *);
00271
00275 int (*OpenStats)(void *, int,int);
00276
00280 int (*CloseStats)(void *);
00281
00285 int (*DoEncode)(void *, unsigned char *,unsigned char **);
00286
00290 int (*DoDecode)(void *, const unsigned char*, int, unsigned char **);
00291
00295 int (*DoStats)(void *, const unsigned char*);
00296
00300 int (*SetQuality)(void *, int);
00301
00305 int (*SetCodecSize)(void *, int,int);
00306
00310 int (*CopyStatsFromLib)(void *, unsigned char *dest, unsigned &length, char *field);
00311
00315 int (*CopyStatsToLib)(void *, unsigned char *src, unsigned length, char *field);
00316
00321 int (*IsIntraFrame)(void *, const unsigned char *);
00322
00327 int (*SendStatsToFiles)(void *, char *dir);
00328
00329
00334 int (*ForceIntraFrame)(void *);
00335
00340 int (*MakeInternalData)(void **);
00341
00346 int (*FreeInternalData)(void *);
00347
00354 int (*StatsLoadedOK)(void *);
00355
00364 BOOL AllocateInternalImages(void);
00365
00367
00372 unsigned char *yuv420pImage;
00373
00379 unsigned char *encodedImage;
00380
00384 int encodedImageSize;
00385
00389 int encodedImageIndex;
00390
00395 PINDEX packetCount;
00396
00403 BOOL codecActive;
00404
00410 PString statisticsDir;
00411
00416 BOOL waitForIntraFrame;
00417
00423 INT statsFrames;
00424
00429 BOOL resendStats;
00430
00434 void *internData;
00435 };
00436
00437
00438 #endif // __OPAL_CU30CODEC_H
00439
00440