OPAL  Version 3.14.3
vidcodec.h
Go to the documentation of this file.
1 /*
2  * vidcodec.h
3  *
4  * Uncompressed video handler
5  *
6  * Open Phone Abstraction Library
7  *
8  * Copyright (c) 2003 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open Phone Abstraction Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s):
25  *
26  * $Revision: 31630 $
27  * $Author: rjongbloed $
28  * $Date: 2014-03-28 11:30:35 +1100 (Fri, 28 Mar 2014) $
29  */
30 
31 #ifndef OPAL_CODEC_VIDCODEC_H
32 #define OPAL_CODEC_VIDCODEC_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
38 #include <opal_config.h>
39 
40 #include <opal/transcoders.h>
41 
42 #if OPAL_VIDEO
43 
44 #if OPAL_H323
45 #include <h323/h323caps.h>
46 #endif
47 
48 #include <codec/opalplugin.h>
49 #include <codec/known.h>
50 
51 
52 extern const OpalVideoFormat & GetOpalRGB24();
53 extern const OpalVideoFormat & GetOpalRGB32();
54 extern const OpalVideoFormat & GetOpalBGR24();
55 extern const OpalVideoFormat & GetOpalBGR32();
56 extern const OpalVideoFormat & GetOpalYUV420P();
57 
58 #define OpalRGB24 GetOpalRGB24()
59 #define OpalRGB32 GetOpalRGB32()
60 #define OpalBGR24 GetOpalBGR24()
61 #define OpalBGR32 GetOpalBGR32()
62 #define OpalYUV420P GetOpalYUV420P()
63 
64 #define OPAL_REGISTER_RAW_VIDEO() \
65  GetOpalRGB24(); \
66  GetOpalRGB32(); \
67  GetOpalBGR24(); \
68  GetOpalBGR32(); \
69  GetOpalYUV420P()
70 
71 
73 
81 {
83  public:
85 
93  );
95 
111  virtual bool UpdateMediaFormats(
114  );
115 
122  virtual PINDEX GetOptimalDataFrameSize(
123  PBoolean input
124  ) const;
125 
135  virtual PBoolean ExecuteCommand(
136  const OpalMediaCommand & command
137  );
138 
149  virtual PBoolean Convert(
150  const RTP_DataFrame & input,
151  RTP_DataFrame & output
152  );
153 
154 #if OPAL_STATISTICS
155  virtual void GetStatistics(OpalMediaStatistics & statistics) const;
156 #endif
157 
159  const PCaselessString & rtpEncodingName,
160  const BYTE * payloadPtr,
161  PINDEX payloadSize,
162  PBYTEArray & context
163  );
164 
165  virtual bool HasErrorConcealment() const { return m_errorConcealment; }
166  bool WasLastFrameIFrame() const { return m_lastFrameWasIFrame; }
167  void ForceIFrame() { m_forceIFrame = true; }
168  virtual void SendIFrameRequest(unsigned sequenceNumber, unsigned timestamp);
169  virtual bool HandleIFrameRequest();
171 
172  protected:
173  PINDEX m_inDataSize;
180 
184 
186  DWORD m_keyFrames;
187 };
188 
189 
191 
192 OPAL_DEFINE_MEDIA_COMMAND(OpalVideoFreezePicture, "Freeze Picture");
193 
200 {
201  PCLASSINFO_WITH_CLONE(OpalVideoUpdatePicture, OpalMediaCommand);
202  public:
203  virtual PString GetName() const;
204 };
205 
212 {
213  PCLASSINFO_WITH_CLONE(OpalVideoPictureLoss, OpalVideoUpdatePicture);
214  public:
215  OpalVideoPictureLoss(unsigned sequenceNumber = 0, unsigned timestamp = 0);
216 
217  virtual PString GetName() const;
218 
219  unsigned GetSequenceNumber() const { return m_sequenceNumber; }
220  unsigned GetTimestamp() const { return m_timestamp; }
221 
222  protected:
224  unsigned m_timestamp;
225 };
226 
227 
237 {
238  PCLASSINFO_WITH_CLONE(OpalTemporalSpatialTradeOff, OpalMediaCommand);
239  public:
240  OpalTemporalSpatialTradeOff(int tradeoff) : m_tradeOff(tradeoff) { }
241 
242  virtual PString GetName() const;
243 
244  enum {
247  };
248 
249  unsigned GetTradeOff() const { return m_tradeOff; }
250 
251  protected:
252  unsigned m_tradeOff;
253 };
254 
255 
256 #endif // OPAL_VIDEO
257 
258 #endif // OPAL_CODEC_VIDCODEC_H
259