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

codecs.h

Go to the documentation of this file.
00001 /* 00002 * codecs.h 00003 * 00004 * H.323 protocol handler 00005 * 00006 * Open H323 Library 00007 * 00008 * Copyright (c) 1998-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 * Portions of this code were written with the assisance of funding from 00025 * Vovida Networks, Inc. http://www.vovida.com. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: codecs.h,v $ 00030 * Revision 1.74 2004/07/03 06:48:26 rjongbloed 00031 * Split video temporal/spatial trade off H.245 packets to separate command and 00032 * indication functions and added quality parameter, thanks Guilhem Tardy. 00033 * 00034 * Revision 1.73 2004/05/09 10:08:34 csoutheren 00035 * Changed new DecodeFrame to return bytes decoded rather than samples decoded 00036 * Added support for new DecodeFrame to plugin manager 00037 * 00038 * Revision 1.72 2004/05/02 04:52:23 rjongbloed 00039 * Fixed problems with G.711 caused by fixing problem with G.723.1-5k3 mode. 00040 * 00041 * Revision 1.71 2004/03/24 00:39:12 dereksmithies 00042 * Changes from Michael Smith for use in reporting frames/second. Many Thanks 00043 * 00044 * Revision 1.70 2003/12/14 10:42:29 rjongbloed 00045 * Changes for compilability without video support. 00046 * 00047 * Revision 1.69 2003/11/12 11:14:21 csoutheren 00048 * Added H323FramedAudioCodec::DecodeSilenceFrame thanks to Henry Harrison of AliceStreet 00049 * 00050 * Revision 1.68 2003/07/16 10:43:12 csoutheren 00051 * Added SwapChannel function to H323Codec to allow media hold channels 00052 * to work better. Thanks to Federico Pinna 00053 * 00054 * Revision 1.67 2003/05/27 09:39:15 dereksmithies 00055 * Add frames per sec variable to the videocodec class 00056 * 00057 * Revision 1.66 2002/12/16 09:11:15 robertj 00058 * Added new video bit rate control, thanks Walter H. Whitlock 00059 * 00060 * Revision 1.65 2002/09/16 01:14:15 robertj 00061 * Added #define so can select if #pragma interface/implementation is used on 00062 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00063 * 00064 * Revision 1.64 2002/08/05 10:03:47 robertj 00065 * Cosmetic changes to normalise the usage of pragma interface/implementation. 00066 * 00067 * Revision 1.63 2002/01/23 06:13:52 robertj 00068 * Added filter function hooks to codec raw data channel. 00069 * 00070 * Revision 1.62 2002/01/23 01:58:25 robertj 00071 * Added function to determine if codecs raw data channel is native format. 00072 * 00073 * Revision 1.61 2002/01/22 16:17:19 rogerh 00074 * Back out the DTMF Decoder class. There will soon be a better way 00075 * to do this. 00076 * 00077 * Revision 1.60 2002/01/22 16:09:38 rogerh 00078 * Back out the DTMF detection from H323FramedAudioCodec::Write(). 00079 * There will shortly be a better place for it. 00080 * 00081 * Revision 1.59 2002/01/22 15:21:47 rogerh 00082 * Add DTMF decoding to PCM audio streams. This has been tested with 00083 * NetMeeting sending Dial Pad codes, using the G.711 codec. 00084 * At this time, DTMF codes (fron NetMeeting) are just displayed on the 00085 * screen and are not passed up to the users application. 00086 * 00087 * Revision 1.58 2002/01/13 23:56:01 robertj 00088 * Added mutex so can change raw data channel while reading/writing from codec. 00089 * 00090 * Revision 1.57 2001/12/04 05:13:09 robertj 00091 * Added videa bandwidth limiting code for H.261, thanks Jose Luis Urien. 00092 * 00093 * Revision 1.56 2001/11/16 01:05:21 craigs 00094 * Changed to allow access to uLaw/ALaw to/from linear functions 00095 * 00096 * Revision 1.55 2001/10/23 02:18:06 dereks 00097 * Initial release of CU30 video codec. 00098 * 00099 * Revision 1.54 2001/09/25 03:14:47 dereks 00100 * Add constant bitrate control for the h261 video codec. 00101 * Thanks Tiziano Morganti for the code to set bit rate. Good work! 00102 * 00103 * Revision 1.53 2001/09/11 01:24:36 robertj 00104 * Added conditional compilation to remove video and/or audio codecs. 00105 * 00106 * Revision 1.52 2001/08/28 09:27:38 robertj 00107 * Updated documentation to reflect some relationships between functions. 00108 * 00109 * Revision 1.51 2001/03/29 23:44:35 robertj 00110 * Added ability to get current silence detect state and threshold. 00111 * Changed silence detection to use G.723.1 SID frames as indicator of 00112 * silence instead of using the average energy and adaptive threshold. 00113 * Changed default signal on deadband time to be much shorter. 00114 * 00115 * Revision 1.50 2001/02/09 05:16:24 robertj 00116 * Added #pragma interface for GNU C++. 00117 * 00118 * Revision 1.49 2001/01/25 07:27:14 robertj 00119 * Major changes to add more flexible OpalMediaFormat class to normalise 00120 * all information about media types, especially codecs. 00121 * 00122 * Revision 1.48 2000/12/19 22:33:44 dereks 00123 * Adjust so that the video channel is used for reading/writing raw video 00124 * data, which better modularizes the video codec. 00125 * 00126 * Revision 1.47 2000/10/13 01:47:26 dereks 00127 * Include command option for setting the number of transmitted video 00128 * frames per second. use --videotxfps n 00129 * 00130 * Revision 1.46 2000/09/08 06:41:37 craigs 00131 * Added ability to set video device 00132 * Added ability to select test input frames 00133 * 00134 * Revision 1.45 2000/08/31 08:15:32 robertj 00135 * Added support for dynamic RTP payload types in H.245 OpenLogicalChannel negotiations. 00136 * 00137 * Revision 1.44 2000/08/21 04:45:06 dereks 00138 * Fix dangling pointer that caused segfaults for windows&unix users. 00139 * Improved the test image which is used when video grabber won't open. 00140 * Added code to handle setting of video Tx Quality. 00141 * Added code to set the number of background blocks sent with every frame. 00142 * 00143 * Revision 1.43 2000/05/16 02:04:16 craigs 00144 * Added access functions for silence compression mode 00145 * 00146 * Revision 1.42 2000/05/02 04:32:24 robertj 00147 * Fixed copyright notice comment. 00148 * 00149 * Revision 1.41 2000/04/14 20:11:16 robertj 00150 * Removed redundent member variable from H323FramedAudioCodec. 00151 * 00152 * Revision 1.40 2000/03/30 23:10:50 robertj 00153 * Fixed error in comments regarding GetFramerate() function. 00154 * 00155 * Revision 1.39 2000/03/21 03:06:47 robertj 00156 * Changes to make RTP TX of exact numbers of frames in some codecs. 00157 * 00158 * Revision 1.38 2000/02/28 13:00:22 robertj 00159 * Added some virtual keywords at the request of Yura Ershov 00160 * 00161 * Revision 1.37 2000/02/10 03:08:02 craigs 00162 * Added ability to specify NTSC or PAL video format 00163 * 00164 * Revision 1.36 2000/02/04 05:00:08 craigs 00165 * Changes for video transmission 00166 * 00167 * Revision 1.35 2000/01/13 04:03:45 robertj 00168 * Added video transmission 00169 * 00170 * Revision 1.34 1999/12/31 00:05:36 robertj 00171 * Added Microsoft ACM G.723.1 codec capability. 00172 * 00173 * Revision 1.33 1999/12/29 01:19:16 craigs 00174 * Fixed problem with RTP payload type variable 00175 * 00176 * Revision 1.32 1999/12/23 23:02:34 robertj 00177 * File reorganision for separating RTP from H.323 and creation of LID for VPB support. 00178 * 00179 * Revision 1.31 1999/11/29 09:01:46 craigs 00180 * Added new code for new video code interface 00181 * 00182 * Revision 1.30 1999/11/29 04:50:11 robertj 00183 * Added adaptive threshold calculation to silence detection. 00184 * 00185 * Revision 1.29 1999/11/20 00:53:46 robertj 00186 * Fixed ability to have variable sized frames in single RTP packet under G.723.1 00187 * 00188 * Revision 1.28 1999/11/13 14:10:32 robertj 00189 * Changes to make silence detection selectable. 00190 * 00191 * Revision 1.27 1999/11/11 23:28:52 robertj 00192 * Added first cut silence detection algorithm. 00193 * 00194 * Revision 1.26 1999/11/04 00:43:42 robertj 00195 * Added extra constructors for nonStandard codecs. 00196 * 00197 * Revision 1.25 1999/10/14 12:03:08 robertj 00198 * Fixed comment. 00199 * 00200 * Revision 1.24 1999/10/08 09:59:01 robertj 00201 * Rewrite of capability for sending multiple audio frames 00202 * 00203 * Revision 1.23 1999/10/08 04:58:37 robertj 00204 * Added capability for sending multiple audio frames in single RTP packet 00205 * 00206 * Revision 1.22 1999/09/23 07:25:12 robertj 00207 * Added open audio and video function to connection and started multi-frame codec send functionality. 00208 * 00209 * Revision 1.21 1999/09/21 14:51:33 robertj 00210 * Fixed NonStandardCapabilityInfo class virtual destructor (and name). 00211 * 00212 * Revision 1.20 1999/09/21 14:04:41 robertj 00213 * Added non-standard codec capability classes 00214 * 00215 * Revision 1.19 1999/09/21 08:12:49 craigs 00216 * Added support for video codecs and H261 00217 * 00218 * Revision 1.18 1999/09/18 13:27:24 craigs 00219 * Added ability disable jitter buffer for codecs 00220 * Added ability to access entire RTP frame from codec Write 00221 * 00222 * Revision 1.17 1999/09/08 04:05:48 robertj 00223 * Added support for video capabilities & codec, still needs the actual codec itself! 00224 * 00225 * Revision 1.16 1999/08/31 12:34:18 robertj 00226 * Added gatekeeper support. 00227 * 00228 * Revision 1.15 1999/08/25 03:08:23 robertj 00229 * Added UserInput capability. 00230 * Allowed the attachment of a channel on a codec to optionally delete the channel object, 00231 * 00232 * Revision 1.14 1999/07/22 14:32:48 robertj 00233 * Fixed erroneous comments 00234 * 00235 * Revision 1.13 1999/07/16 16:05:48 robertj 00236 * Added "human readable" codec type name display. 00237 * 00238 * Revision 1.12 1999/07/15 14:45:35 robertj 00239 * Added propagation of codec open error to shut down logical channel. 00240 * Fixed control channel start up bug introduced with tunnelling. 00241 * 00242 * Revision 1.11 1999/07/13 09:53:24 robertj 00243 * Fixed some problems with jitter buffer and added more debugging. 00244 * 00245 * Revision 1.10 1999/07/09 06:09:49 robertj 00246 * Major implementation. An ENORMOUS amount of stuff added everywhere. 00247 * 00248 * Revision 1.9 1999/06/24 13:32:45 robertj 00249 * Fixed ability to change sound device on codec and fixed NM3 G.711 compatibility 00250 * 00251 * Revision 1.8 1999/06/22 13:49:40 robertj 00252 * Added GSM support and further RTP protocol enhancements. 00253 * 00254 * Revision 1.7 1999/06/14 15:08:40 robertj 00255 * Added GSM codec class frame work (still no actual codec). 00256 * 00257 * Revision 1.6 1999/06/14 06:39:08 robertj 00258 * Fixed problem with getting transmit flag to channel from PDU negotiator 00259 * 00260 * Revision 1.5 1999/06/14 05:15:55 robertj 00261 * Changes for using RTP sessions correctly in H323 Logical Channel context 00262 * 00263 * Revision 1.4 1999/06/13 12:41:14 robertj 00264 * Implement logical channel transmitter. 00265 * Fixed H245 connect on receiving call. 00266 * 00267 * Revision 1.3 1999/06/09 05:26:19 robertj 00268 * Major restructuring of classes. 00269 * 00270 * Revision 1.2 1999/06/06 06:06:36 robertj 00271 * Changes for new ASN compiler and v2 protocol ASN files. 00272 * 00273 * Revision 1.1 1999/01/16 01:31:01 robertj 00274 * Initial revision 00275 * 00276 */ 00277 00278 #ifndef __CODECS_H 00279 #define __CODECS_H 00280 00281 #ifdef P_USE_PRAGMA 00282 #pragma interface 00283 #endif 00284 00285 00286 #include <mediafmt.h> 00287 #include <rtp.h> 00288 #include <channels.h> 00289 #include "openh323buildopts.h" 00290 00291 00292 /* The following classes have forward references to avoid including the VERY 00293 large header files for H225 and H245. If an application requires access 00294 to the protocol classes they can include them, but for simple usage their 00295 inclusion can be avoided. 00296 */ 00297 class H245_MiscellaneousCommand_type; 00298 class H245_MiscellaneousIndication_type; 00299 class H323Connection; 00300 00301 00302 00304 00312 class H323Codec : public PObject 00313 { 00314 PCLASSINFO(H323Codec, PObject); 00315 00316 public: 00317 enum Direction { 00318 Encoder, 00319 Decoder 00320 }; 00321 00322 H323Codec( 00323 const char * mediaFormat, 00324 Direction direction 00325 ); 00326 00327 00340 virtual BOOL Open( 00341 H323Connection & connection 00342 ); 00343 00346 virtual void Close() = 0; 00347 00365 virtual BOOL Read( 00366 BYTE * buffer, 00367 unsigned & length, 00368 RTP_DataFrame & rtpFrame 00369 ) = 0; 00370 00382 virtual BOOL Write( 00383 const BYTE * buffer, 00384 unsigned length, 00385 const RTP_DataFrame & frame, 00386 unsigned & written 00387 ) = 0; 00388 00391 virtual unsigned GetFrameRate() const; 00392 00396 virtual void OnFlowControl( 00397 long bitRateRestriction 00398 ); 00399 00403 virtual void OnMiscellaneousCommand( 00404 const H245_MiscellaneousCommand_type & type 00405 ); 00406 00410 virtual void OnMiscellaneousIndication( 00411 const H245_MiscellaneousIndication_type & type 00412 ); 00413 00414 Direction GetDirection() const { return direction; } 00415 00416 const OpalMediaFormat & GetMediaFormat() const { return mediaFormat; } 00417 00425 virtual BOOL AttachChannel( 00426 PChannel * channel, 00427 BOOL autoDelete = TRUE 00428 ); 00429 00434 virtual PChannel * SwapChannel( 00435 PChannel * newChannel, 00436 BOOL autoDelete = TRUE 00437 ); 00438 00441 virtual BOOL CloseRawDataChannel(); 00442 00446 PChannel *GetRawDataChannel() 00447 { return rawDataChannel; } 00448 00455 virtual BOOL IsRawDataChannelNative() const; 00456 00459 BOOL ReadRaw( 00460 void * data, 00461 PINDEX size, 00462 PINDEX & length 00463 ); 00464 00467 BOOL WriteRaw( 00468 void * data, 00469 PINDEX length 00470 ); 00471 00478 BOOL AttachLogicalChannel(H323Channel *channel); 00479 00480 class FilterInfo : public PObject { 00481 PCLASSINFO(FilterInfo, PObject); 00482 public: 00483 FilterInfo(H323Codec & c, void * b, PINDEX s, PINDEX l) 00484 : codec(c), buffer(b), bufferSize(s), bufferLength(l) { } 00485 00486 H323Codec & codec; 00487 void * buffer; 00488 PINDEX bufferSize; 00489 PINDEX bufferLength; 00490 }; 00491 00513 void AddFilter( 00514 const PNotifier & notifier 00515 ); 00516 00517 protected: 00518 Direction direction; 00519 OpalMediaFormat mediaFormat; 00520 00521 H323Channel * logicalChannel; // sends messages from receive codec to tx codec. 00522 00523 PChannel * rawDataChannel; // connection to the hardware for reading/writing data. 00524 BOOL deleteChannel; 00525 PMutex rawChannelMutex; 00526 00527 PINDEX lastSequenceNumber; // Detects lost RTP packets in the video codec. 00528 00529 PLIST(FilterList, PNotifier); 00530 FilterList filters; 00531 }; 00532 00533 00540 class H323AudioCodec : public H323Codec 00541 { 00542 PCLASSINFO(H323AudioCodec, H323Codec); 00543 00544 public: 00550 H323AudioCodec( 00551 const char * mediaFormat, 00552 Direction direction 00553 ); 00554 00555 ~H323AudioCodec(); 00556 00565 virtual BOOL Open( 00566 H323Connection & connection 00567 ); 00568 00576 virtual void Close(); 00577 00580 virtual unsigned GetFrameRate() const; 00581 00582 enum SilenceDetectionMode { 00583 NoSilenceDetection, 00584 FixedSilenceDetection, 00585 AdaptiveSilenceDetection 00586 }; 00587 00591 void SetSilenceDetectionMode( 00592 SilenceDetectionMode mode, 00593 unsigned threshold = 0, 00594 unsigned signalDeadband = 80, 00595 unsigned silenceDeadband = 3200, 00596 unsigned adaptivePeriod = 4800 00597 ); 00598 00607 SilenceDetectionMode GetSilenceDetectionMode( 00608 BOOL * isInTalkBurst = NULL, // Current silence detct state. 00609 unsigned * currentThreshold = NULL // Current signal/silence threshold 00610 ) const; 00611 00618 virtual BOOL DetectSilence(); 00619 00627 virtual unsigned GetAverageSignalLevel(); 00628 00629 protected: 00630 unsigned samplesPerFrame; 00631 00632 SilenceDetectionMode silenceDetectMode; 00633 00634 unsigned signalDeadbandFrames; // Frames of signal before talk burst starts 00635 unsigned silenceDeadbandFrames; // Frames of silence before talk burst ends 00636 unsigned adaptiveThresholdFrames; // Frames to min/max over for adaptive threshold 00637 00638 BOOL inTalkBurst; // Currently sending RTP data 00639 unsigned framesReceived; // Signal/Silence frames received so far. 00640 unsigned levelThreshold; // Threshold level for silence/signal 00641 unsigned signalMinimum; // Minimum of frames above threshold 00642 unsigned silenceMaximum; // Maximum of frames below threshold 00643 unsigned signalFramesReceived; // Frames of signal received 00644 unsigned silenceFramesReceived; // Frames of silence received 00645 }; 00646 00647 00656 class H323FramedAudioCodec : public H323AudioCodec 00657 { 00658 PCLASSINFO(H323FramedAudioCodec, H323AudioCodec); 00659 00660 public: 00666 H323FramedAudioCodec( 00667 const char * mediaFormat, 00668 Direction direction 00669 ); 00670 00688 virtual BOOL Read( 00689 BYTE * buffer, 00690 unsigned & length, 00691 RTP_DataFrame & rtpFrame 00692 ); 00693 00706 virtual BOOL Write( 00707 const BYTE * buffer, 00708 unsigned length, 00709 const RTP_DataFrame & rtpFrame, 00710 unsigned & written 00711 ); 00712 00713 00718 virtual unsigned GetAverageSignalLevel(); 00719 00720 00726 virtual BOOL EncodeFrame( 00727 BYTE * buffer, 00728 unsigned & length 00729 ) = 0; 00730 00735 virtual BOOL DecodeFrame( 00736 const BYTE * buffer, 00737 unsigned length, 00738 unsigned & written, 00739 unsigned & bytesOutput 00740 ); 00741 virtual BOOL DecodeFrame( 00742 const BYTE * buffer, 00743 unsigned length, 00744 unsigned & written 00745 ); 00746 00751 virtual void DecodeSilenceFrame( 00752 void * buffer, 00753 unsigned length 00754 ) 00755 { memset(buffer, 0, length); } 00756 00757 protected: 00758 PShortArray sampleBuffer; 00759 unsigned bytesPerFrame; 00760 }; 00761 00762 00771 class H323StreamedAudioCodec : public H323FramedAudioCodec 00772 { 00773 PCLASSINFO(H323StreamedAudioCodec, H323FramedAudioCodec); 00774 00775 public: 00781 H323StreamedAudioCodec( 00782 const char * mediaFormat, 00783 Direction direction, 00784 unsigned samplesPerFrame, 00785 unsigned bits 00786 ); 00787 00793 virtual BOOL EncodeFrame( 00794 BYTE * buffer, 00795 unsigned & length 00796 ); 00797 00803 virtual BOOL DecodeFrame( 00804 const BYTE * buffer, 00805 unsigned length, 00806 unsigned & written, 00807 unsigned & samples 00808 ); 00809 00812 virtual int Encode(short sample) const = 0; 00813 00816 virtual short Decode(int sample) const = 0; 00817 00818 protected: 00819 unsigned bitsPerSample; 00820 }; 00821 00822 00823 #ifndef NO_H323_VIDEO 00824 00831 class H323VideoCodec : public H323Codec 00832 { 00833 PCLASSINFO(H323VideoCodec, H323Codec); 00834 00835 public: 00841 H323VideoCodec( 00842 const char * mediaFormat, 00843 Direction direction 00844 ); 00845 00846 ~H323VideoCodec(); 00847 00856 virtual BOOL Open( 00857 H323Connection & connection 00858 ); 00859 00867 virtual void Close(); 00868 00869 00873 virtual void OnMiscellaneousCommand( 00874 const H245_MiscellaneousCommand_type & type 00875 ); 00876 00880 virtual void OnMiscellaneousIndication( 00881 const H245_MiscellaneousIndication_type & type 00882 ); 00883 00884 // /**Attach the raw data device for use by codec. 00885 // Note the device provided will be deleted on destruction of the codec. 00886 // */ 00887 // virtual BOOL AttachDevice( 00888 // H323VideoDevice * device, /// Device to read/write data 00889 // BOOL autoDelete = TRUE /// Device is to be automatically deleted 00890 // ); 00891 00895 virtual void OnFreezePicture(); 00896 00900 virtual void OnFastUpdatePicture(); 00901 00905 virtual void OnFastUpdateGOB(unsigned firstGOB, unsigned numberOfGOBs); 00906 00910 virtual void OnFastUpdateMB(int firstGOB, int firstMB, unsigned numberOfMBs); 00911 00915 virtual void OnVideoIndicateReadyToActivate(); 00916 00920 virtual void OnVideoTemporalSpatialTradeOffCommand(int newQuality); 00921 00925 virtual void OnVideoTemporalSpatialTradeOffIndication(int newQuality); 00926 00930 virtual void OnVideoNotDecodedMBs( 00931 unsigned firstMB, 00932 unsigned numberOfMBs, 00933 unsigned temporalReference 00934 ); 00935 00939 virtual void OnLostPartialPicture(); 00940 00944 virtual void OnLostPicture(); 00945 00948 int GetWidth() const { return frameWidth; } 00949 00952 int GetHeight() const { return frameHeight; } 00953 00956 virtual void SetTxQualityLevel(int qlevel) {videoQuality = qlevel; } 00957 00961 virtual void SetTxMinQuality(int qlevel) {videoQMin = qlevel; } 00962 00966 virtual void SetTxMaxQuality(int qlevel) {videoQMax = qlevel; } 00967 00970 virtual void SetBackgroundFill(int idle) {fillLevel= idle; } 00971 00972 enum BitRateModeBits { 00973 None = 0x00, 00974 DynamicVideoQuality = 0x01, 00975 AdaptivePacketDelay = 0x02 00976 }; 00977 00980 unsigned GetVideoMode(void) {return videoBitRateControlModes;} 00981 00985 unsigned SetVideoMode(unsigned mode) {return videoBitRateControlModes = mode;} 00986 00991 virtual BOOL SetMaxBitRate( 00992 unsigned bitRate // New bit rate 00993 ); 00994 01003 virtual BOOL SetTargetFrameTimeMs( 01004 unsigned ms // new time between frames 01005 ); 01006 01011 void SendMiscCommand(unsigned command); 01012 01016 virtual int GetFrameNum() { return frameNum; } 01017 01018 01019 protected: 01020 01021 int frameWidth; 01022 int frameHeight; 01023 int fillLevel; 01024 01025 // used in h261codec.cxx 01026 unsigned videoBitRateControlModes; 01027 // variables used for video bit rate control 01028 int bitRateHighLimit; // maximum instantaneous bit rate allowed 01029 unsigned oldLength; 01030 PTimeInterval oldTime; 01031 PTimeInterval newTime; 01032 // variables used for dynamic video quality control 01033 int targetFrameTimeMs; //targetFrameTimeMs = 1000 / videoSendFPS 01034 int frameBytes; // accumulate count of bytes per frame 01035 int sumFrameTimeMs, sumAdjFrameTimeMs, sumFrameBytes; // accumulate running average 01036 int videoQMax, videoQMin; // dynamic video quality min/max limits 01037 int videoQuality; // current video encode quality setting, 1..31 01038 PTimeInterval frameStartTime; 01039 PTimeInterval grabInterval; 01040 01041 int frameNum, packetNum, oldPacketNum; 01042 int framesPerSec; 01043 01044 PMutex videoHandlerActive; 01045 }; 01046 01047 #endif // NO_H323_VIDEO 01048 01049 01051 // The simplest codec is the G.711 PCM codec. 01052 01055 class H323_ALawCodec : public H323StreamedAudioCodec 01056 { 01057 PCLASSINFO(H323_ALawCodec, H323StreamedAudioCodec) 01058 01059 public: 01064 H323_ALawCodec( 01065 Direction direction, 01066 BOOL at56kbps, 01067 unsigned frameSize 01068 ); 01070 01071 virtual int Encode(short sample) const { return EncodeSample(sample); } 01072 virtual short Decode(int sample) const { return DecodeSample(sample); } 01073 01074 static int EncodeSample(short sample); 01075 static short DecodeSample(int sample); 01076 01077 protected: 01078 BOOL sevenBit; 01079 }; 01080 01081 01084 class H323_muLawCodec : public H323StreamedAudioCodec 01085 { 01086 PCLASSINFO(H323_muLawCodec, H323StreamedAudioCodec) 01087 01088 public: 01093 H323_muLawCodec( 01094 Direction direction, 01095 BOOL at56kbps, 01096 unsigned frameSize 01097 ); 01099 01100 virtual int Encode(short sample) const { return EncodeSample(sample); } 01101 virtual short Decode(int sample) const { return DecodeSample(sample); } 01102 01103 static int EncodeSample(short sample); 01104 static short DecodeSample(int sample); 01105 01106 protected: 01107 BOOL sevenBit; 01108 }; 01109 01110 01111 #endif // __CODECS_H 01112 01113

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