OPAL  Version 3.18.8
mediacmd.h
Go to the documentation of this file.
1 /*
2  * mediacmd.h
3  *
4  * Abstractions for sending commands to media processors.
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2001 Equivalence Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24  *
25  * Contributor(s): ______________________________________.
26  */
27 
28 #ifndef OPAL_OPAL_MEDIACMD_H
29 #define OPAL_OPAL_MEDIACMD_H
30 
31 #ifdef P_USE_PRAGMA
32 #pragma interface
33 #endif
34 
35 #include <opal_config.h>
36 
38 
43 class OpalMediaCommand : public PObject
44 {
45  PCLASSINFO(OpalMediaCommand, PObject);
46  public:
48  const OpalMediaType & mediaType,
49  unsigned sessionID = 0,
50  unsigned ssrc = 0
51  );
52 
59  virtual void PrintOn(
60  ostream & strm
61  ) const;
62 
74  virtual Comparison Compare(
75  const PObject & obj
76  ) const;
77 
78  // Redefine as pure, derived classes from here MUST implment it.
79  virtual PObject * Clone() const = 0;
81 
86  virtual PString GetName() const = 0;
87 
90  virtual void * GetPlugInData() const;
91 
94  virtual unsigned * GetPlugInSize() const;
96 
99  const OpalMediaType & GetMediaType() const { return m_mediaType; }
100  unsigned GetSessionID() const { return m_sessionID; }
101  unsigned GetSyncSource() const { return m_ssrc; }
103 
104  protected:
106  unsigned m_sessionID;
107  unsigned m_ssrc;
108 };
109 
110 
111 #define OPAL_DEFINE_MEDIA_COMMAND(cls, name, mediaType) \
112  class cls : public OpalMediaCommand \
113  { \
114  PCLASSINFO_WITH_CLONE(cls, OpalMediaCommand) \
115  public: \
116  cls(unsigned id = 0, unsigned ssrc = 0) : OpalMediaCommand(mediaType, id, ssrc) { } \
117  virtual PString GetName() const { return name; } \
118  }
119 
120 
124 {
125  PCLASSINFO_WITH_CLONE(OpalMediaFlowControl, OpalMediaCommand);
126  public:
128  OpalBandwidth bitRate,
129  const OpalMediaType & mediaType,
130  unsigned sessionID = 0,
131  unsigned ssrc = 0
132  );
134  OpalBandwidth bitRate,
135  const OpalMediaType & mediaType,
136  unsigned sessionID,
137  const RTP_SyncSourceArray & ssrcs
138  );
139 
140  virtual PString GetName() const;
141 
142  const OpalBandwidth & GetMaxBitRate() const { return m_bitRate; }
143  const RTP_SyncSourceArray & GetSSRCs() const { return m_ssrcs; }
144 
145  protected:
148 };
149 
150 
154 {
155  PCLASSINFO_WITH_CLONE(OpalMediaPacketLoss, OpalMediaCommand);
156  public:
158  unsigned packetLoss,
159  const OpalMediaType & mediaType,
160  unsigned sessionID = 0,
161  unsigned ssrc = 0
162  );
163 
164  virtual PString GetName() const;
165 
166  unsigned GetPacketLoss() const { return m_packetLoss; }
167 
168  protected:
169  unsigned m_packetLoss;
170 };
171 
172 
176 {
177  PCLASSINFO_WITH_CLONE(OpalMediaMaxPayload, OpalMediaCommand);
178  public:
180  unsigned payloadSize,
181  const OpalMediaType & mediaType,
182  unsigned sessionID = 0,
183  unsigned ssrc = 0
184  );
185 
186  virtual PString GetName() const;
187 
188  unsigned GetPayloadSize() const { return m_payloadSize; }
189 
190  protected:
191  unsigned m_payloadSize;
192 };
193 
194 
195 #endif // OPAL_OPAL_MEDIACMD_H
196 
197 
198 // End of File ///////////////////////////////////////////////////////////////
virtual PString GetName() const
const RTP_SyncSourceArray & GetSSRCs() const
Definition: mediacmd.h:143
virtual PString GetName() const
Definition: mediacmd.h:43
unsigned m_sessionID
Definition: mediacmd.h:106
virtual PString GetName() const
Definition: mediatype.h:66
unsigned GetPayloadSize() const
Definition: mediacmd.h:188
std::vector< RTP_SyncSourceId > RTP_SyncSourceArray
Definition: rtp.h:47
OpalMediaFlowControl(OpalBandwidth bitRate, const OpalMediaType &mediaType, unsigned sessionID=0, unsigned ssrc=0)
virtual void * GetPlugInData() const
Definition: mediafmt.h:60
RTP_SyncSourceArray m_ssrcs
Definition: mediacmd.h:147
virtual PObject * Clone() const =0
unsigned GetPacketLoss() const
Definition: mediacmd.h:166
OpalMediaPacketLoss(unsigned packetLoss, const OpalMediaType &mediaType, unsigned sessionID=0, unsigned ssrc=0)
unsigned m_packetLoss
Definition: mediacmd.h:169
unsigned GetSyncSource() const
Definition: mediacmd.h:101
Definition: mediacmd.h:175
virtual void PrintOn(ostream &strm) const
const OpalMediaType & GetMediaType() const
Definition: mediacmd.h:99
const OpalBandwidth & GetMaxBitRate() const
Definition: mediacmd.h:142
OpalMediaCommand(const OpalMediaType &mediaType, unsigned sessionID=0, unsigned ssrc=0)
Definition: mediacmd.h:123
Definition: mediacmd.h:153
unsigned m_payloadSize
Definition: mediacmd.h:191
virtual Comparison Compare(const PObject &obj) const
unsigned m_ssrc
Definition: mediacmd.h:107
OpalMediaType m_mediaType
Definition: mediacmd.h:105
OpalMediaMaxPayload(unsigned payloadSize, const OpalMediaType &mediaType, unsigned sessionID=0, unsigned ssrc=0)
virtual unsigned * GetPlugInSize() const
OpalBandwidth m_bitRate
Definition: mediacmd.h:146
virtual PString GetName() const =0
unsigned GetSessionID() const
Definition: mediacmd.h:100