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

ffh263codec.h

Go to the documentation of this file.
00001 /* 00002 * H.323 protocol handler 00003 * 00004 * Open H323 Library 00005 * 00006 * Copyright (c) 2001 March Networks Corporation 00007 * Copyright (c) 1999-2000 Equivalence Pty. Ltd. 00008 * 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License at 00012 * http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 * the License for the specific language governing rights and limitations 00017 * under the License. 00018 * 00019 * The Original Code is Open H323 Library. 00020 * 00021 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00022 * 00023 * Contributor(s): Guilhem Tardy (gtardy@salyens.com) 00024 * 00025 * $Log: ffh263codec.h,v $ 00026 * Revision 1.8 2004/05/12 23:18:44 csoutheren 00027 * Adjusted copyright notices for ffh263 and rfc2190 files 00028 * 00029 * Revision 1.7 2004/04/23 03:50:36 csoutheren 00030 * Added missing start comment and repaired inadvertant change to #ifdef 00031 * 00032 * Revision 1.6 2004/04/22 22:34:59 csoutheren 00033 * Fixed mispelling of Guilhem Tardy - my apologies to him 00034 * 00035 * Revision 1.5 2004/04/22 22:24:17 csoutheren 00036 * Fixed wrong usage of pragma message 00037 * 00038 * Revision 1.4 2004/04/22 14:22:20 csoutheren 00039 * Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet 00040 * Many thanks to them for their contributions. 00041 * 00042 * Revision 1.3 2003/08/04 00:03:16 dereksmithies 00043 * Reorganise tests for enabled 00044 * 00045 * Revision 1.2 2003/07/31 05:08:24 dereksmithies 00046 * Switch to manual packet fragment technique. Much more reliable, especially so on windows. 00047 * 00048 * Revision 1.1 2003/07/24 05:23:06 dereksmithies 00049 * Move ffmpeg h263 support to this file, and designate non standard. 00050 * 00051 * Revision 1.12 2003/06/06 05:18:54 dereksmithies 00052 * Fix startup delay bug. Remove all large packets from the network. Improve reliability. 00053 * 00054 * Revision 1.11 2003/05/27 09:22:55 dereksmithies 00055 * Updates for code revisions in h263 codec 00056 * 00057 * Revision 1.10 2003/05/14 13:47:58 rjongbloed 00058 * Removed static "initialisation" function as this should be done 00059 * internally and not in the application. 00060 * 00061 * Revision 1.9 2003/05/05 11:59:21 robertj 00062 * Changed to use autoconf style selection of options and subsystems. 00063 * 00064 * Revision 1.8 2003/05/02 04:22:10 craigs 00065 * Added lots of extra H.263 support 00066 * 00067 * Revision 1.7 2003/04/27 09:16:38 rogerh 00068 * use PBYTE_ORDER instead of endian.h 00069 * 00070 * Revision 1.6 2003/04/21 21:50:22 dereks 00071 * Implement suggestion from Guilhem Tardy. Many thanks. 00072 * 00073 * Revision 1.5 2003/04/16 04:26:57 dereks 00074 * Initial release of h263 codec, which utilises the ffmpeg library. 00075 * Thanks to Guilhem Tardy, and to AliceStreet. 00076 * 00077 * Revision 1.4 2002/09/16 01:14:15 robertj 00078 * Added #define so can select if #pragma interface/implementation is used on 00079 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00080 * 00081 * Revision 1.3 2002/09/03 06:19:36 robertj 00082 * Normalised the multi-include header prevention ifdef/define symbol. 00083 * 00084 * Revision 1.2 2002/08/05 10:03:47 robertj 00085 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00086 * 00087 * Revision 1.1 2002/05/19 22:32:46 dereks 00088 * Initial release of stub file for h263 codec. Thanks Guilhem Tardy. 00089 * 00090 * 00091 * 00092 */ 00093 00094 /* 00095 * Initial release notes from Guilhem Tardy:: 00096 * 00097 * Added support for video capabilities & codec, only tested under Linux! 00098 * The code for varying bit rate is copied from h261codec.cxx, 00099 * until it is moved to a separate file common to both video codecs. 00100 * 00101 */ 00102 00103 #ifndef __OPAL_FFH263CODEC_H 00104 #define __OPAL_FFH263CODEC_H 00105 00106 #ifdef P_USE_PRAGMA 00107 #pragma interface 00108 #endif 00109 00110 #ifdef H323_RFC2190_AVCODEC 00111 #pragma message ("Non-standard H.263 codecs disabled as RFC2190 H.263 is enabled") 00112 #elif defined(H323_AVCODEC) 00113 00114 struct AVCodec; 00115 struct AVCodecContext; 00116 struct AVFrame; 00117 00119 00122 class H323_FFH263Capability : public H323NonStandardVideoCapability 00123 { 00124 PCLASSINFO(H323_FFH263Capability, H323NonStandardVideoCapability) 00125 00126 public: 00131 H323_FFH263Capability( 00132 unsigned sqcifMPI, 00133 unsigned qcifMPI, 00134 unsigned cifMPI, 00135 unsigned cif4MPI, 00136 unsigned cif16MPI, 00137 unsigned maxBitRate = 850, 00138 unsigned videoFrameRate = 25); 00140 00145 virtual PObject * Clone() const; 00147 00156 virtual unsigned GetSubType() const; 00157 00160 virtual PString GetFormatName() const; 00162 00172 virtual BOOL OnSendingPDU( 00173 H245_VideoCapability & pdu 00174 ) const; 00175 00183 virtual BOOL OnSendingPDU( 00184 H245_VideoMode & pdu 00185 ) const; 00186 00194 virtual BOOL OnReceivedPDU( 00195 const H245_VideoCapability & pdu 00196 ); 00197 00200 virtual H323Codec * CreateCodec( 00201 H323Codec::Direction direction 00202 ) const; 00203 00204 00206 00207 protected: 00208 00209 signed sqcifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00210 signed qcifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00211 signed cifMPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00212 signed cif4MPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00213 signed cif16MPI; // {1..3600 units seconds/frame, 1..32 units 1/29.97 Hz} 00214 00215 unsigned maxBitRate; // units of bit/s 00216 unsigned videoFrameRate; // frames per second. 00217 00218 }; 00220 00221 class H263Packet : public PObject 00222 { 00223 PCLASSINFO(H263Packet, PObject) 00224 00225 public: 00226 H263Packet(void *newData, int newSize); 00227 ~H263Packet(); 00228 00229 int GetSize() { return size; } 00230 00231 void *GetData() { return data; } 00232 00233 private: 00234 void *data; 00235 int size; 00236 }; 00237 00239 00240 PDECLARE_LIST(H263FragmentList, H263Packet) 00241 #if 0 //This makes emacs bracket matching code happy. 00242 { 00243 #endif 00244 public: 00245 ~H263FragmentList(); 00246 00247 PINDEX GetFragmentsRemaining(); 00248 00249 PINDEX GetFragmentIndex(); 00250 00251 PINDEX GetFragmentsTotal(); 00252 00253 virtual H263Packet *GetNextFragment(); 00254 00255 void AppendH263Packet(H263Packet *packet); 00256 00257 void AppendH263Packet(unsigned char *data, int size); 00258 00259 void EmptyList(); 00260 00261 private: 00262 PINDEX nPackets; 00263 }; 00264 00265 00267 00269 class H323_FFH263Codec : public H323VideoCodec 00270 { 00271 PCLASSINFO(H323_FFH263Codec, H323VideoCodec) 00272 00273 public: 00276 H323_FFH263Codec( 00277 Direction direction, 00278 unsigned sqcifMPI, 00279 unsigned qcifMPI, 00280 unsigned cifMPI, 00281 unsigned cif4MPI, 00282 unsigned cif16MPI, 00283 unsigned maxBitRate, 00284 unsigned videoFrameRate 00285 ); 00286 00287 ~H323_FFH263Codec(); 00288 00305 virtual BOOL Read( 00306 BYTE * buffer, 00307 unsigned & length, 00308 RTP_DataFrame & rtpFrame 00309 ); 00310 00323 virtual BOOL Write( 00324 const BYTE * buffer, 00325 unsigned length, 00326 const RTP_DataFrame & rtp, 00327 unsigned & written 00328 ); 00329 00332 virtual unsigned GetFrameRate() const { return timestampDelta; } 00333 00339 void SetTxQualityLevel(int qLevel); 00340 00344 void SetBackgroundFill(int fillLevel); 00345 00349 virtual void OnLostPartialPicture(); 00350 00355 virtual void OnLostPicture(); 00356 00362 static void RtpCallback(void *data, int size, int packetNumber); 00363 00364 protected: 00365 BOOL Resize(int width, int height); 00366 00367 BOOL RenderFrame(); 00368 BOOL RenderFrame(const void * buffer); 00369 00370 BOOL RenderFrame(AVFrame *pict); 00371 BOOL RawToPict(AVFrame *pict); 00372 00373 void InitialiseCodec(); 00374 void CloseCodec(); 00375 00376 H263FragmentList partialPackets; //used for rebuilding H263 frame from source. 00377 PINDEX currentFragment; // " " " 00378 00379 PBYTEArray encFrameBuffer; 00380 PBYTEArray rawFrameBuffer; 00381 00382 PINDEX encFrameLen; 00383 PINDEX rawFrameLen; 00384 00385 unsigned timestampDelta; 00386 00387 AVCodec *codec; 00388 AVCodecContext *context; 00389 AVFrame *picture; 00390 00391 PTime startTime; 00392 PINDEX bitsSent; 00393 00394 unsigned lastebits; 00395 }; 00396 00397 #endif // H323_AVCODEC 00398 00399 #endif // __OPAL_FFH263CODEC_H 00400 00401

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