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 #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
00319 signed sqcifMPI;
00320 signed qcifMPI;
00321 signed cifMPI;
00322 signed cif4MPI;
00323 signed cif16MPI;
00324
00325 unsigned maxBitRate;
00326 unsigned videoFrameRate;
00327
00328 BOOL unrestrictedVector;
00329 BOOL arithmeticCoding;
00330 BOOL advancedPrediction;
00331 BOOL pbFrames;
00332 BOOL temporalSpatialTradeOff;
00333
00334 long unsigned hrd_B;
00335 unsigned bppMaxKb;
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