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 #ifndef __OPAL_VIDCODEC_H
00091 #define __OPAL_VIDCODEC_H
00092
00093 #ifdef P_USE_PRAGMA
00094 #pragma interface
00095 #endif
00096
00097
00098 #include <opal/transcoders.h>
00099
00100 #if OPAL_H323
00101 #include <h323/h323caps.h>
00102 #endif
00103
00104 #include <codec/opalplugin.h>
00105
00106
00107 #define OPAL_RGB24 "RGB24"
00108 #define OPAL_RGB32 "RGB32"
00109 #define OPAL_YUV420P "YUV420P"
00110
00111 extern const OpalVideoFormat & GetOpalRGB24();
00112 extern const OpalVideoFormat & GetOpalRGB32();
00113 extern const OpalVideoFormat & GetOpalYUV420P();
00114
00115 #define OpalRGB24 GetOpalRGB24()
00116 #define OpalRGB32 GetOpalRGB32()
00117 #define OpalYUV420P GetOpalYUV420P()
00118
00119
00121
00128 class OpalVideoTranscoder : public OpalTranscoder
00129 {
00130 PCLASSINFO(OpalVideoTranscoder, OpalTranscoder);
00131 public:
00132 typedef PluginCodec_Video_FrameHeader FrameHeader;
00133
00138 OpalVideoTranscoder(
00139 const OpalMediaFormat & inputMediaFormat,
00140 const OpalMediaFormat & outputMediaFormat
00141 );
00143
00154 virtual BOOL UpdateOutputMediaFormat(
00155 const OpalMediaFormat & mediaFormat
00156 );
00157
00165 virtual BOOL ExecuteCommand(
00166 const OpalMediaCommand & command
00167 );
00168
00179 virtual BOOL Convert(
00180 const RTP_DataFrame & input,
00181 RTP_DataFrame & output
00182 );
00184
00185 protected:
00186 unsigned frameWidth;
00187 unsigned frameHeight;
00188 unsigned videoQuality;
00189 unsigned targetBitRate;
00190 bool dynamicVideoQuality;
00191 bool adaptivePacketDelay;
00192 unsigned fillLevel;
00193
00194 bool forceIFrame;
00195 };
00196
00197
00199
00200 OPAL_DEFINE_MEDIA_COMMAND(OpalVideoFreezePicture, "Freeze Picture");
00201
00202 class OpalVideoUpdatePicture : public OpalMediaCommand
00203 {
00204 PCLASSINFO(OpalVideoUpdatePicture, OpalMediaCommand);
00205 public:
00206 OpalVideoUpdatePicture(int firstGOB = -1, int firstMB = -1, int numBlocks = 0)
00207 : m_firstGOB(firstGOB), m_firstMB(firstMB), m_numBlocks(numBlocks) { }
00208
00209 virtual PString GetName() const;
00210
00211 int GetFirstGOB() const { return m_firstGOB; }
00212 int GetFirstMB() const { return m_firstMB; }
00213 int GetNumBlocks() const { return m_numBlocks; }
00214
00215 protected:
00216 int m_firstGOB;
00217 int m_firstMB;
00218 int m_numBlocks;
00219 };
00220
00221
00222 class OpalTemporalSpatialTradeOff : public OpalMediaCommand
00223 {
00224 PCLASSINFO(OpalTemporalSpatialTradeOff, OpalMediaCommand);
00225 public:
00226 OpalTemporalSpatialTradeOff(int quality) : m_quality(quality) { }
00227
00228 virtual PString GetName() const;
00229
00230 int GetQuality() const { return m_quality; }
00231
00232 protected:
00233 int m_quality;
00234 };
00235
00236
00237 class OpalLostPartialPicture : public OpalMediaCommand
00238 {
00239 PCLASSINFO(OpalLostPartialPicture, OpalMediaCommand);
00240 public:
00241 OpalLostPartialPicture() { }
00242 virtual PString GetName() const;
00243 };
00244
00245
00246 class OpalLostPicture : public OpalMediaCommand
00247 {
00248 PCLASSINFO(OpalLostPicture, OpalMediaCommand);
00249 public:
00250 OpalLostPicture() { }
00251 virtual PString GetName() const;
00252 };
00253
00254
00256
00257 #if OPAL_H323
00258
00259
00260
00261
00264 class H323_UncompVideoCapability : public H323NonStandardVideoCapability
00265 {
00266 PCLASSINFO(H323_UncompVideoCapability, H323NonStandardVideoCapability)
00267
00268 public:
00273 H323_UncompVideoCapability(
00274 const H323EndPoint & endpoint,
00275 const PString & colourFormat
00276 );
00278
00283 virtual PObject * Clone() const;
00285
00290 virtual PString GetFormatName() const;
00292
00293 protected:
00294 PString colourFormat;
00295 };
00296
00297 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323 \
00298 H323_REGISTER_CAPABILITY_FUNCTION(H323_RGB24, OPAL_RGB24, ep) \
00299 { return new H323_UncompVideoCapability(ep, OpalRGB24); } \
00300 H323_REGISTER_CAPABILITY_FUNCTION(H323_RGB32, OPAL_RGB32, ep) \
00301 { return new H323_UncompVideoCapability(ep, OpalRGB32); }
00302
00303 #else // ifndef NO_H323
00304
00305 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323
00306
00307 #endif // ifndef NO_H323
00308
00309
00311
00315 class OpalUncompVideoTranscoder : public OpalVideoTranscoder
00316 {
00317 PCLASSINFO(OpalUncompVideoTranscoder, OpalVideoTranscoder);
00318 public:
00323 OpalUncompVideoTranscoder(
00324 const OpalMediaFormat & inputMediaFormat,
00325 const OpalMediaFormat & outputMediaFormat
00326 );
00327
00330 ~OpalUncompVideoTranscoder();
00332
00341 virtual PINDEX GetOptimalDataFrameSize(
00342 BOOL input
00343 ) const;
00344
00355 virtual BOOL ConvertFrames(
00356 const RTP_DataFrame & input,
00357 RTP_DataFrameList & output
00358 );
00360 };
00361
00362
00363 class Opal_RGB24_RGB24 : public OpalUncompVideoTranscoder {
00364 PCLASSINFO(Opal_RGB24_RGB24, OpalUncompVideoTranscoder);
00365 public:
00366 Opal_RGB24_RGB24() : OpalUncompVideoTranscoder(OpalRGB24, OpalRGB24) { }
00367 };
00368
00369
00370 class Opal_RGB32_RGB32 : public OpalUncompVideoTranscoder {
00371 PCLASSINFO(Opal_RGB32_RGB32, OpalUncompVideoTranscoder);
00372 public:
00373 Opal_RGB32_RGB32() : OpalUncompVideoTranscoder(OpalRGB32, OpalRGB32) { }
00374 };
00375
00376
00378
00379 #define OPAL_REGISTER_UNCOMPRESSED_VIDEO() \
00380 OPAL_REGISTER_UNCOMPRESSED_VIDEO_H323 \
00381 OPAL_REGISTER_TRANSCODER(Opal_RGB32_RGB32, OpalRGB32, OpalRGB32); \
00382 OPAL_REGISTER_TRANSCODER(Opal_RGB24_RGB24, OpalRGB24, OpalRGB24)
00383
00384
00385 #endif // __OPAL_VIDCODEC_H
00386
00387