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 #ifndef __OPAL_VIDCODEC_H
00072 #define __OPAL_VIDCODEC_H
00073
00074 #ifdef P_USE_PRAGMA
00075 #pragma interface
00076 #endif
00077
00078
00079 #include <opal/transcoders.h>
00080
00081 #ifndef NO_H323
00082 #include <h323/h323caps.h>
00083 #endif
00084
00085
00086 #define OPAL_RGB24 "RGB24"
00087 #define OPAL_RGB32 "RGB32"
00088 #define OPAL_YUV420P "YUV420P"
00089
00090 extern const OpalVideoFormat & GetOpalRGB24();
00091 extern const OpalVideoFormat & GetOpalRGB32();
00092 extern const OpalVideoFormat & GetOpalYUV420P();
00093
00094 #define OpalRGB24 GetOpalRGB24()
00095 #define OpalRGB32 GetOpalRGB32()
00096 #define OpalYUV420P GetOpalYUV420P()
00097
00098
00100
00107 class OpalVideoTranscoder : public OpalTranscoder
00108 {
00109 PCLASSINFO(OpalVideoTranscoder, OpalTranscoder);
00110 public:
00111 struct FrameHeader {
00112 PInt32l x;
00113 PInt32l y;
00114 PUInt32l width;
00115 PUInt32l height;
00116 BYTE data[1];
00117 };
00118
00123 OpalVideoTranscoder(
00124 const OpalMediaFormat & inputMediaFormat,
00125 const OpalMediaFormat & outputMediaFormat
00126 );
00128
00139 virtual BOOL UpdateOutputMediaFormat(
00140 const OpalMediaFormat & mediaFormat
00141 );
00142
00150 virtual BOOL ExecuteCommand(
00151 const OpalMediaCommand & command
00152 );
00153
00164 virtual BOOL Convert(
00165 const RTP_DataFrame & input,
00166 RTP_DataFrame & output
00167 );
00169
00170 protected:
00171 unsigned frameWidth;
00172 unsigned frameHeight;
00173 unsigned videoQuality;
00174 unsigned targetBitRate;
00175 bool dynamicVideoQuality;
00176 bool adaptivePacketDelay;
00177 unsigned fillLevel;
00178 bool updatePicture;
00179 };
00180
00181
00183
00184 OPAL_DEFINE_MEDIA_COMMAND(OpalVideoFreezePicture, "Freeze Picture");
00185
00186 class OpalVideoUpdatePicture : public OpalMediaCommand
00187 {
00188 PCLASSINFO(OpalVideoUpdatePicture, OpalMediaCommand);
00189 public:
00190 OpalVideoUpdatePicture(int firstGOB = -1, int firstMB = -1, int numBlocks = 0)
00191 : m_firstGOB(firstGOB), m_firstMB(firstMB), m_numBlocks(numBlocks) { }
00192
00193 virtual PString GetName() const;
00194
00195 int GetFirstGOB() const { return m_firstGOB; }
00196 int GetFirstMB() const { return m_firstMB; }
00197 int GetNumBlocks() const { return m_numBlocks; }
00198
00199 protected:
00200 int m_firstGOB;
00201 int m_firstMB;
00202 int m_numBlocks;
00203 };
00204
00205
00206 class OpalTemporalSpatialTradeOff : public OpalMediaCommand
00207 {
00208 PCLASSINFO(OpalTemporalSpatialTradeOff, OpalMediaCommand);
00209 public:
00210 OpalTemporalSpatialTradeOff(int quality) : m_quality(quality) { }
00211
00212 virtual PString GetName() const;
00213
00214 int GetQuality() const { return m_quality; }
00215
00216 protected:
00217 int m_quality;
00218 };
00219
00220
00222
00223 #ifndef NO_H323
00224
00227 class H323_UncompVideoCapability : public H323NonStandardVideoCapability
00228 {
00229 PCLASSINFO(H323_UncompVideoCapability, H323NonStandardVideoCapability)
00230
00231 public:
00236 H323_UncompVideoCapability(
00237 const H323EndPoint & endpoint,
00238 const PString & colourFormat
00239 );
00241
00246 virtual PObject * Clone() const;
00248
00253 virtual PString GetFormatName() const;
00255
00256 protected:
00257 PString colourFormat;
00258 };
00259
00260 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323 \
00261 H323_REGISTER_CAPABILITY_FUNCTION(H323_RGB24, OPAL_RGB24, ep) \
00262 { return new H323_UncompVideoCapability(ep, OpalRGB24); } \
00263 H323_REGISTER_CAPABILITY_FUNCTION(H323_RGB32, OPAL_RGB32, ep) \
00264 { return new H323_UncompVideoCapability(ep, OpalRGB32); }
00265
00266 #else // ifndef NO_H323
00267
00268 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323
00269
00270 #endif // ifndef NO_H323
00271
00272
00274
00278 class OpalUncompVideoTranscoder : public OpalVideoTranscoder
00279 {
00280 PCLASSINFO(OpalUncompVideoTranscoder, OpalVideoTranscoder);
00281 public:
00286 OpalUncompVideoTranscoder(
00287 const OpalMediaFormat & inputMediaFormat,
00288 const OpalMediaFormat & outputMediaFormat
00289 );
00290
00293 ~OpalUncompVideoTranscoder();
00295
00304 virtual PINDEX GetOptimalDataFrameSize(
00305 BOOL input
00306 ) const;
00307
00318 virtual BOOL ConvertFrames(
00319 const RTP_DataFrame & input,
00320 RTP_DataFrameList & output
00321 );
00323 };
00324
00325
00326 class Opal_RGB24_RGB24 : public OpalUncompVideoTranscoder {
00327 PCLASSINFO(Opal_RGB24_RGB24, OpalUncompVideoTranscoder);
00328 public:
00329 Opal_RGB24_RGB24() : OpalUncompVideoTranscoder(OpalRGB24, OpalRGB24) { }
00330 };
00331
00332
00333 class Opal_RGB32_RGB32 : public OpalUncompVideoTranscoder {
00334 PCLASSINFO(Opal_RGB32_RGB32, OpalUncompVideoTranscoder);
00335 public:
00336 Opal_RGB32_RGB32() : OpalUncompVideoTranscoder(OpalRGB32, OpalRGB32) { }
00337 };
00338
00339
00341
00342 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO() \
00343 OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323 \
00344 OPAL_REGISTER_TRANSCODER(Opal_RGB32_RGB32, OpalRGB32, OpalRGB32); \
00345 OPAL_REGISTER_TRANSCODER(Opal_RGB24_RGB24, OpalRGB24, OpalRGB24)
00346
00347
00348 #endif // __OPAL_VIDCODEC_H
00349
00350