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
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 #ifndef __OPAL_H263CODEC_H
00096 #define __OPAL_H263CODEC_H
00097
00098 #ifdef P_USE_PRAGMA
00099 #pragma interface
00100 #endif
00101
00102 #include <openh323buildopts.h>
00103
00104
00105 #include "h323caps.h"
00106
00107 #if defined(H323_VICH263) || defined(H323_RFC2190_AVCODEC)
00108
00109 class H263Decoder;
00110 class H263Encoder;
00111
00113
00117 class H323_H263Capability : public H323VideoCapability
00118 {
00119 PCLASSINFO(H323_H263Capability, H323VideoCapability)
00120
00121 public:
00126 H323_H263Capability(
00127 unsigned sqcifMPI,
00128 unsigned qcifMPI,
00129 unsigned cifMPI,
00130 unsigned cif4MPI,
00131 unsigned cif16MPI,
00132 unsigned maxBitRate = 850,
00133 unsigned videoFrameRate = 25,
00134 BOOL unrestrictedVector = FALSE,
00135 BOOL arithmeticCoding = FALSE,
00136 BOOL advancedPrediction = FALSE,
00137 BOOL pbFrames = FALSE,
00138 BOOL temporalSpatialTradeOff = TRUE,
00139 unsigned hrd_B = 0,
00140 unsigned bppMaxKb = 0,
00141 unsigned slowSqcifMPI = 0,
00142 unsigned slowQcifMPI = 0,
00143 unsigned slowCifMPI = 0,
00144 unsigned slowCif4MPI = 0,
00145 unsigned slowCif16MPI = 0,
00146 BOOL errorCompensation = FALSE
00147 );
00149
00154 virtual PObject * Clone() const;
00156
00157
00162 Comparison Compare(const PObject & obj) const;
00164
00173 virtual unsigned GetSubType() const;
00174
00177 virtual PString GetFormatName() const;
00179
00189 virtual BOOL OnSendingPDU(
00190 H245_VideoCapability & pdu
00191 ) const;
00192
00200 virtual BOOL OnSendingPDU(
00201 H245_VideoMode & pdu
00202 ) const;
00203
00211 virtual BOOL OnReceivedPDU(
00212 const H245_VideoCapability & pdu
00213 );
00214
00217 virtual H323Codec * CreateCodec(
00218 H323Codec::Direction direction
00219 ) const;
00220
00221 #if 0
00224 unsigned GetSQCIFMPI() const
00225 { return sqcifMPI); }
00226
00229 unsigned GetQCIFMPI() const
00230 { return qcifMPI; }
00231
00234 unsigned GetCIFMPI() const
00235 { return cifMPI; }
00236
00239 unsigned GetCIF4MPI() const
00240 { return cif4MPI; }
00241
00244 unsigned GetCIF16MPI() const
00245 { return cif16MPI; }
00246
00249 unsigned GetMaxBitRate() const
00250 { return maxBitRate; }
00251
00254 BOOL GetUnrestrictedVectorCapability() const
00255 { return unrestrictedVector; }
00256
00259 BOOL GetArithmeticCodingCapability() const
00260 { return arithmeticCoding; }
00261
00264 BOOL GetAdvancedPredictionCapability() const
00265 { return advancedPrediction; }
00266
00269 BOOL GetPbFramesCapability() const
00270 { return pbFrames; }
00271
00274 BOOL GetTemporalSpatialTradeOffCapability() const
00275 { return temporalSpatialTradeOff; }
00276
00279 BOOL GetHrd_B() const
00280 { return hrd_B; }
00281
00284 BOOL GetBppMaxKb() const
00285 { return bppMaxKb; }
00286
00289 unsigned GetSlowSQCIFMPI() const
00290 { return (sqcifMPI<0?-sqcifMPI:0); }
00291
00294 unsigned GetSlowQCIFMPI() const
00295 { return (qcifMPI<0?-qcifMPI:0); }
00296
00299 unsigned GetSlowCIFMPI() const
00300 { return (cifMPI<0?-cifMPI:0); }
00301
00304 unsigned GetSlowCIF4MPI() const
00305 { return (cif4MPI<0?-cif4MPI:0); }
00306
00309 unsigned GetSlowCIF16MPI() const
00310 { return (cif16MPI<0?-cif16MPI:0); }
00311
00314 BOOL GetErrorCompensationCapability() const
00315 { return errorCompensation; }
00316 #endif
00317
00319
00320 protected:
00321
00322 signed sqcifMPI;
00323 signed qcifMPI;
00324 signed cifMPI;
00325 signed cif4MPI;
00326 signed cif16MPI;
00327
00328 unsigned maxBitRate;
00329 unsigned videoFrameRate;
00330
00331 BOOL unrestrictedVector;
00332 BOOL arithmeticCoding;
00333 BOOL advancedPrediction;
00334 BOOL pbFrames;
00335 BOOL temporalSpatialTradeOff;
00336
00337 long unsigned hrd_B;
00338 unsigned bppMaxKb;
00339
00340 BOOL errorCompensation;
00341 };
00342
00344
00346 class H323_H263Codec : public H323VideoCodec
00347 {
00348 PCLASSINFO(H323_H263Codec, H323VideoCodec)
00349
00350 public:
00353 H323_H263Codec(
00354 Direction direction,
00355 unsigned sqcifMPI,
00356 unsigned qcifMPI,
00357 unsigned cifMPI,
00358 unsigned cif4MPI,
00359 unsigned cif16MPI,
00360 unsigned maxBitRate,
00361 unsigned videoFrameRate
00362 );
00363
00364 ~H323_H263Codec();
00365
00382 virtual BOOL Read(
00383 BYTE * buffer,
00384 unsigned & length,
00385 RTP_DataFrame & rtpFrame
00386 );
00387
00400 virtual BOOL Write(
00401 const BYTE * buffer,
00402 unsigned length,
00403 const RTP_DataFrame & rtp,
00404 unsigned & written
00405 );
00406
00409 virtual unsigned GetFrameRate() const { return timestampDelta; }
00410
00416 void SetTxQualityLevel(int qLevel);
00417
00421 void SetBackgroundFill(int fillLevel);
00422
00426 virtual void OnLostPartialPicture();
00427
00432 virtual void OnLostPicture();
00433
00439 static void RtpCallback(void *data, int size, int packetNumber);
00440
00441 protected:
00442 BOOL Resize(int width, int height);
00443
00444 BOOL RenderFrame();
00445 BOOL RenderFrame(const void * buffer);
00446
00447
00448
00449 void InitialiseCodec();
00450 void CloseCodec();
00451
00452
00453 unsigned timestampDelta;
00454
00455 H263Decoder *videoDecoder;
00456 H263Encoder *videoEncoder;
00457
00458 int now;
00459 BYTE * rvts;
00460 int ndblk, nblk;
00461
00462 PTime startTime;
00463 PINDEX bitsSent;
00464
00465 unsigned lastebits;
00466 };
00467
00468 #endif // H323_VICH263
00469 #endif // __OPAL_H263CODEC_H
00470
00471
00472
00473