Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cu30codec.h

Go to the documentation of this file.
00001 /* 00002 * cu30codec.h 00003 * 00004 * H.323 protocol handler 00005 * 00006 * Open H323 Library 00007 * 00008 * Copyright (c) 1999-2000 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Open H323 Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Contributor(s): ______________________________________. 00025 * Derek J Smithies (derek@indranet.co.nz) 00026 * 00027 * $Log: cu30codec.h,v $ 00028 * Revision 1.6 2002/10/09 18:18:35 rogerh 00029 * Apply a patch from Damien Sandras 00030 * 00031 * Revision 1.5 2002/09/16 01:14:15 robertj 00032 * Added #define so can select if #pragma interface/implementation is used on 00033 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00034 * 00035 * Revision 1.4 2002/09/03 06:19:36 robertj 00036 * Normalised the multi-include header prevention ifdef/define symbol. 00037 * 00038 * Revision 1.3 2002/08/05 10:03:47 robertj 00039 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00040 * 00041 * Revision 1.2 2002/01/16 02:53:52 dereks 00042 * Add methods to cope with H.245 RequestModeChange in h.261 video codec. 00043 * 00044 * Revision 1.1 2001/10/23 02:18:06 dereks 00045 * Initial release of CU30 video codec. 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, // Endpoint to get NonStandardInfo from. 00077 PString statsDir, // Directory to read statistics for codec from/to. 00078 INT _width, // width and height for the transmitter. 00079 INT _height, // 00080 INT _statsFrames // Number of frames to collect stats for. 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; //Required by cu30 codec at initialization. 00108 //directory containing stats. Good stats==good compression. 00109 00110 INT newWidth; // width and height for the transmitter. 00111 INT newHeight; // 00112 INT statsFrames; // Number of frames to collect stats over. 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 /*There is a problem with the CU30codec. It needs to be able to 00228 carry out two tasks. 1)Grab data from the camera. 00229 2)Render data from an array. 00230 Thus, we either: two PVideoChannels, or one PVideoChannel to both 00231 grab and render. 00232 We use one PVideoChannel, which is not consistant with elsewhere, 00233 but enables us to (later) have a grab and display process irrespective 00234 of there being a H323 connection. 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

Generated on Sat Jul 24 17:03:06 2004 for OpenH323 by doxygen 1.3.7