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 #ifndef OPAL_CODEC_VIDCODEC_H
00032 #define OPAL_CODEC_VIDCODEC_H
00033
00034 #ifdef P_USE_PRAGMA
00035 #pragma interface
00036 #endif
00037
00038 #include <opal/buildopts.h>
00039
00040 #include <opal/transcoders.h>
00041
00042 #if OPAL_VIDEO
00043
00044 #if OPAL_H323
00045 #include <h323/h323caps.h>
00046 #endif
00047
00048 #include <codec/opalplugin.h>
00049
00050
00051 #define OPAL_RGB24 "RGB24"
00052 #define OPAL_RGB32 "RGB32"
00053 #define OPAL_YUV420P "YUV420P"
00054
00055 extern const OpalVideoFormat & GetOpalRGB24();
00056 extern const OpalVideoFormat & GetOpalRGB32();
00057 extern const OpalVideoFormat & GetOpalYUV420P();
00058
00059 #define OpalRGB24 GetOpalRGB24()
00060 #define OpalRGB32 GetOpalRGB32()
00061 #define OpalYUV420P GetOpalYUV420P()
00062
00063
00065
00072 class OpalVideoTranscoder : public OpalTranscoder
00073 {
00074 PCLASSINFO(OpalVideoTranscoder, OpalTranscoder);
00075 public:
00076 typedef PluginCodec_Video_FrameHeader FrameHeader;
00077
00082 OpalVideoTranscoder(
00083 const OpalMediaFormat & inputMediaFormat,
00084 const OpalMediaFormat & outputMediaFormat
00085 );
00087
00103 virtual bool UpdateMediaFormats(
00104 const OpalMediaFormat & inputMediaFormat,
00105 const OpalMediaFormat & outputMediaFormat
00106 );
00107
00114 virtual PINDEX GetOptimalDataFrameSize(
00115 PBoolean input
00116 ) const;
00117
00127 virtual PBoolean ExecuteCommand(
00128 const OpalMediaCommand & command
00129 );
00130
00141 virtual PBoolean Convert(
00142 const RTP_DataFrame & input,
00143 RTP_DataFrame & output
00144 );
00145
00146 #if OPAL_STATISTICS
00147 virtual void GetStatistics(OpalMediaStatistics & statistics) const;
00148 #endif
00149
00150 virtual bool HasErrorConcealment() const { return m_errorConcealment; }
00151 bool WasLastFrameIFrame() const { return lastFrameWasIFrame; }
00152 void ForceIFrame() { forceIFrame = true; }
00154
00155 protected:
00156 bool m_errorConcealment;
00157 PINDEX inDataSize;
00158 PINDEX outDataSize;
00159 bool forceIFrame;
00160 bool lastFrameWasIFrame;
00161
00162 DWORD m_totalFrames;
00163 DWORD m_keyFrames;
00164 };
00165
00166
00168
00169 OPAL_DEFINE_MEDIA_COMMAND(OpalVideoFreezePicture, "Freeze Picture");
00170
00176 class OpalVideoUpdatePicture : public OpalMediaCommand
00177 {
00178 PCLASSINFO_WITH_CLONE(OpalVideoUpdatePicture, OpalMediaCommand);
00179 public:
00180 virtual PString GetName() const;
00181 };
00182
00188 class OpalVideoPictureLoss : public OpalVideoUpdatePicture
00189 {
00190 PCLASSINFO_WITH_CLONE(OpalVideoPictureLoss, OpalVideoUpdatePicture);
00191 public:
00192 OpalVideoPictureLoss(unsigned sequenceNumber = 0, unsigned timestamp = 0);
00193
00194 virtual PString GetName() const;
00195
00196 unsigned GetSequenceNumber() const { return m_sequenceNumber; }
00197 unsigned GetTimestamp() const { return m_timestamp; }
00198
00199 protected:
00200 unsigned m_sequenceNumber;
00201 unsigned m_timestamp;
00202 };
00203
00204
00213 class OpalTemporalSpatialTradeOff : public OpalMediaCommand
00214 {
00215 PCLASSINFO_WITH_CLONE(OpalTemporalSpatialTradeOff, OpalMediaCommand);
00216 public:
00217 OpalTemporalSpatialTradeOff(int tradeoff) : m_tradeOff(tradeoff) { }
00218
00219 virtual PString GetName() const;
00220
00221 enum {
00222 MaximiseSpatial = 0,
00223 MaximiseTemporal = 31
00224 };
00225
00226 unsigned GetTradeOff() const { return m_tradeOff; }
00227
00228 protected:
00229 unsigned m_tradeOff;
00230 };
00231
00232
00233 #endif // OPAL_VIDEO
00234
00235 #endif // OPAL_CODEC_VIDCODEC_H
00236