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

h263codec.h

Go to the documentation of this file.
00001 /* 00002 * h263codec.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): Guilhem Tardy (gtardy@marchnetworks.com) 00025 * 00026 * $Log: h263codec.h,v $ 00027 * Revision 1.16 2004/04/22 22:35:00 csoutheren 00028 * Fixed mispelling of Guilhem Tardy - my apologies to him 00029 * 00030 * Revision 1.15 2004/04/22 14:22:20 csoutheren 00031 * Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet 00032 * Many thanks to them for their contributions. 00033 * 00034 * Revision 1.14 2003/08/04 00:03:22 dereksmithies 00035 * Reorganise tests for enabled 00036 * 00037 * Revision 1.13 2003/07/24 08:08:42 dereksmithies 00038 * Update to use vich263 codec, instead of ffmpeg. 00039 * 00040 * Revision 1.12 2003/06/06 05:18:54 dereksmithies 00041 * Fix startup delay bug. Remove all large packets from the network. Improve reliability. 00042 * 00043 * Revision 1.11 2003/05/27 09:22:55 dereksmithies 00044 * Updates for code revisions in h263 codec 00045 * 00046 * Revision 1.10 2003/05/14 13:47:58 rjongbloed 00047 * Removed static "initialisation" function as this should be done 00048 * internally and not in the application. 00049 * 00050 * Revision 1.9 2003/05/05 11:59:21 robertj 00051 * Changed to use autoconf style selection of options and subsystems. 00052 * 00053 * Revision 1.8 2003/05/02 04:22:10 craigs 00054 * Added lots of extra H.263 support 00055 * 00056 * Revision 1.7 2003/04/27 09:16:38 rogerh 00057 * use PBYTE_ORDER instead of endian.h 00058 * 00059 * Revision 1.6 2003/04/21 21:50:22 dereks 00060 * Implement suggestion from Guilhem Tardy. Many thanks. 00061 * 00062 * Revision 1.5 2003/04/16 04:26:57 dereks 00063 * Initial release of h263 codec, which utilises the ffmpeg library. 00064 * Thanks to Guilhem Tardy, and to AliceStreet. 00065 * 00066 * Revision 1.4 2002/09/16 01:14:15 robertj 00067 * Added #define so can select if #pragma interface/implementation is used on 00068 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00069 * 00070 * Revision 1.3 2002/09/03 06:19:36 robertj 00071 * Normalised the multi-include header prevention ifdef/define symbol. 00072 * 00073 * Revision 1.2 2002/08/05 10:03:47 robertj 00074 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00075 * 00076 * Revision 1.1 2002/05/19 22:32:46 dereks 00077 * Initial release of stub file for h263 codec. Thanks Guilhem Tardy. 00078 * 00079 * 00080 * 00081 */ 00082 00083 /* 00084 * Initial release notes from Guilhem Tardy:: 00085 * 00086 * Added support for video capabilities & codec, only tested under Linux! 00087 * The code for varying bit rate is copied from h261codec.cxx, 00088 * until it is moved to a separate file common to both video codecs. 00089 * 00090 */ 00091 00092 #ifndef __OPAL_H263CODEC_H 00093 #define __OPAL_H263CODEC_H 00094 00095 #ifdef P_USE_PRAGMA 00096 #pragma interface 00097 #endif 00098 00099 #include <openh323buildopts.h> 00100 00101 00102 #include "h323caps.h" 00103 00104 #if defined(H323_VICH263) || defined(H323_RFC2190_AVCODEC) 00105 00106 class H263Decoder; 00107 class H263Encoder; 00108 00110 00114 class H323_H263Capability : public H323VideoCapability 00115 { 00116 PCLASSINFO(H323_H263Capability, H323VideoCapability) 00117 00118 public: 00123 H323_H263Capability( 00124 unsigned sqcifMPI, 00125 unsigned qcifMPI, 00126 unsigned cifMPI, 00127 unsigned cif4MPI, 00128 unsigned cif16MPI, 00129 unsigned maxBitRate = 850, 00130 unsigned videoFrameRate = 25, 00131 BOOL unrestrictedVector = FALSE, 00132 BOOL arithmeticCoding = FALSE, 00133 BOOL advancedPrediction = FALSE, 00134 BOOL pbFrames = FALSE, 00135 BOOL temporalSpatialTradeOff = TRUE, 00136 unsigned hrd_B = 0, 00137 unsigned bppMaxKb = 0, 00138 unsigned slowSqcifMPI = 0, 00139 unsigned slowQcifMPI = 0, 00140 unsigned slowCifMPI = 0, 00141 unsigned slowCif4MPI = 0, 00142 unsigned slowCif16MPI = 0, 00143 BOOL errorCompensation = FALSE 00144 ); 00146 00151 virtual PObject * Clone() const; 00153 00154 00159 Comparison Compare(const PObject & obj) const; 00161 00170 virtual unsigned GetSubType() const; 00171 00174 virtual PString GetFormatName() const; 00176 00186 virtual BOOL OnSendingPDU( 00187 H245_VideoCapability & pdu 00188 ) const; 00189 00197 virtual BOOL OnSendingPDU( 00198 H245_VideoMode & pdu 00199 ) const; 00200 00208 virtual BOOL OnReceivedPDU( 00209 const H245_VideoCapability & pdu 00210 ); 00211 00214 virtual H323Codec * CreateCodec( 00215 H323Codec::Direction direction 00216 ) const; 00217 00218 #if 0 00221 unsigned GetSQCIFMPI() const 00222 { return sqcifMPI); } 00223 00226 unsigned GetQCIFMPI() const 00227 { return qcifMPI; } 00228 00231 unsigned GetCIFMPI() const 00232 { return cifMPI; } 00233 00236 unsigned GetCIF4MPI() const 00237 { return cif4MPI; } 00238 00241 unsigned GetCIF16MPI() const 00242 { return cif16MPI; } 00243 00246 unsigned GetMaxBitRate() const 00247 { return maxBitRate; } 00248 00251 BOOL GetUnrestrictedVectorCapability() const 00252 { return unrestrictedVector; } 00253 00256 BOOL GetArithmeticCodingCapability() const 00257 { return arithmeticCoding; } 00258 00261 BOOL GetAdvancedPredictionCapability() const 00262 { return advancedPrediction; } 00263 00266 BOOL GetPbFramesCapability() const 00267 { return pbFrames; } 00268 00271 BOOL GetTemporalSpatialTradeOffCapability() const 00272 { return temporalSpatialTradeOff; } 00273 00276 BOOL GetHrd_B() const 00277 { return hrd_B; } 00278 00281 BOOL GetBppMaxKb() const 00282 { return bppMaxKb; } 00283 00286 unsigned GetSlowSQCIFMPI() const 00287 { return (sqcifMPI<0?-sqcifMPI:0); } 00288 00291 unsigned GetSlowQCIFMPI() const 00292 { return (qcifMPI<0?-qcifMPI:0); } 00293 00296 unsigned GetSlowCIFMPI() const 00297 { return (cifMPI<0?-cifMPI:0); } 00298 00301 unsigned GetSlowCIF4MPI() const 00302 { return (cif4MPI<0?-cif4MPI:0); } 00303 00306 unsigned GetSlowCIF16MPI() const 00307 { return (cif16MPI<0?-cif16MPI:0); } 00308 00311 BOOL GetErrorCompensationCapability() const 00312 { return errorCompensation; } 00313 #endif 00314 00316 00317 protected: 00318 // H.263 v1 00319 signed sqcifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00320 signed qcifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00321 signed cifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00322 signed cif4MPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00323 signed cif16MPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00324 00325 unsigned maxBitRate; // units of bit/s 00326 unsigned videoFrameRate; // frames per second. 00327 00328 BOOL unrestrictedVector; 00329 BOOL arithmeticCoding; 00330 BOOL advancedPrediction; 00331 BOOL pbFrames; 00332 BOOL temporalSpatialTradeOff; 00333 00334 long unsigned hrd_B; // units of 128 bits 00335 unsigned bppMaxKb; // units of 1024 bits 00336 00337 BOOL errorCompensation; 00338 }; 00339 00341 00343 class H323_H263Codec : public H323VideoCodec 00344 { 00345 PCLASSINFO(H323_H263Codec, H323VideoCodec) 00346 00347 public: 00350 H323_H263Codec( 00351 Direction direction, 00352 unsigned sqcifMPI, 00353 unsigned qcifMPI, 00354 unsigned cifMPI, 00355 unsigned cif4MPI, 00356 unsigned cif16MPI, 00357 unsigned maxBitRate, 00358 unsigned videoFrameRate 00359 ); 00360 00361 ~H323_H263Codec(); 00362 00379 virtual BOOL Read( 00380 BYTE * buffer, 00381 unsigned & length, 00382 RTP_DataFrame & rtpFrame 00383 ); 00384 00397 virtual BOOL Write( 00398 const BYTE * buffer, 00399 unsigned length, 00400 const RTP_DataFrame & rtp, 00401 unsigned & written 00402 ); 00403 00406 virtual unsigned GetFrameRate() const { return timestampDelta; } 00407 00413 void SetTxQualityLevel(int qLevel); 00414 00418 void SetBackgroundFill(int fillLevel); 00419 00423 virtual void OnLostPartialPicture(); 00424 00429 virtual void OnLostPicture(); 00430 00436 static void RtpCallback(void *data, int size, int packetNumber); 00437 00438 protected: 00439 BOOL Resize(int width, int height); 00440 00441 BOOL RenderFrame(); 00442 BOOL RenderFrame(const void * buffer); 00443 00444 00445 00446 void InitialiseCodec(); 00447 void CloseCodec(); 00448 00449 00450 unsigned timestampDelta; 00451 00452 H263Decoder *videoDecoder; 00453 H263Encoder *videoEncoder; 00454 00455 int now; 00456 BYTE * rvts; 00457 int ndblk, nblk; 00458 00459 PTime startTime; 00460 PINDEX bitsSent; 00461 00462 unsigned lastebits; 00463 }; 00464 00465 #endif // H323_VICH263 00466 #endif // __OPAL_H263CODEC_H 00467 00468 00469 00470

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