1 // Copyright (C) 2001,2002,2004 Federico Montesino Pouzols <fedemp@altern.org>.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // ccRTP. If you copy code from other releases into a copy of GNU
28 // ccRTP, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU ccRTP, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37
44 #ifndef CCXX_RTP_QUEUEBASE_H_
45 #define CCXX_RTP_QUEUEBASE_H_
46
50
51 #ifdef CCXX_NAMESPACES
52 namespace ost {
53 #endif
54
72 {
73 public:
75
77 { }
78
83
92
98 { return datablock->getPayloadType(); }
99
107 inline const uint8* const
109 { return datablock->getPayload(); }
110
114 size_t
116 { return datablock->getPayloadSize(); }
117
123 { return *source; }
124
130 inline bool
132 { return datablock->isMarked(); }
133
137 inline uint16
139 { return datablock->getSeqNum(); }
140
144 inline uint8
146 { return (uint8)datablock->getCSRCsCount(); }
147
153 inline const uint32*
155 { return datablock->getCSRCs(); }
156
157 private:
160 };
161
170 {
171 public:
179 inline bool
181 {
184 return true;
185 }
186
188 { return localSSRC; }
189
199 { return currentRTPClockRate; }
200
202 { return currentPayloadType; }
203
205 { return initialTime; }
206
207 protected:
213
215 { localSSRC = ssrc; localSSRCNetwork = htonl(ssrc); }
216
218 { return localSSRCNetwork; }
219
220 virtual
222 { }
223
230 inline virtual size_t
232 { return 0; }
233
234 inline virtual void
236 { }
237
238 private:
239 // local SSRC 32-bit identifier
241 // SSRC in network byte order
243 // RTP clock rate for the current payload type.
245 // Current payload type set for outgoing packets and expected
246 // from incoming packets.
248 // when the queue is created
250 };
251
259 {
260 public:
261 inline size_t
263 { return defaultMaxSendSegmentSize;}
264
271 inline void
273 { maxSendSegmentSize = size; }
274
275 inline size_t
277 { return maxSendSegmentSize; }
278
279 protected:
281
282 inline virtual
284 { }
285
286 private:
288 // maximum packet size before fragmenting sends.
290 };
291
299 {
300 public:
302 { return defaultMaxRecvPacketSize; }
303
304 inline size_t
306 { return maxRecvPacketSize; }
307
318 inline void
320 { maxRecvPacketSize = maxsize; }
321
322 protected:
324 { setMaxRecvPacketSize(getDefaultMaxRecvPacketSize()); }
325
326 inline virtual
328 { }
329
330 private:
332 // filter value for received packets length.
334 };
335 // queuebase
337
338 #ifdef CCXX_NAMESPACES
339 }
340 #endif
341
342 #endif //CCXX_RTP_QUEUEBASE_H_
343
virtual ~OutgoingDataQueueBase()
bool isMarked() const
Is this data unit marked?.
virtual size_t dispatchBYE(const std::string &)
A plugin point for posting of BYE messages.
PayloadType getType() const
Synchronization source in an RTP session.
Interface (envelope) to data received over RTP packets.
uint16 getSeqNum() const
Get data unit sequence number.
RTP packets received from other participants.
bool setPayloadFormat(const PayloadFormat &pf)
Set the payload format in use, for timing and payload type identification purposes.
size_t getDefaultMaxSendSegmentSize()
virtual ~IncomingDataQueueBase()
virtual void renewLocalSSRC()
Sources of synchronization and participants related clases.
size_t getMaxRecvPacketSize() const
PayloadType getCurrentPayloadType() const
timeval getInitialTime() const
Pointer< const IncomingRTPPkt > datablock
void setLocalSSRC(uint32 ssrc)
void setMaxSendSegmentSize(size_t size)
Set maximum payload segment size before fragmenting sends.
A virtual base class for RTP queue hierarchies.
size_t getMaxSendSegmentSize()
uint32 getLocalSSRCNetwork() const
const SyncSource * source
PayloadType currentPayloadType
uint32 getLocalSSRC() const
size_t maxSendSegmentSize
size_t getDefaultMaxRecvPacketSize() const
const SyncSource & getSource() const
void setMaxRecvPacketSize(size_t maxsize)
uint8 getContributorsCount() const
Get the number of contributing sources in the CSRC list.
const uint32 * getContributorsID() const
Get the array of 32-bit CSRC identifiers.
const uint8 *const getData() const
Get data as it is received in RTP packets (i.e.
uint32 getCurrentRTPClockRate() const
Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T).
static const size_t defaultMaxRecvPacketSize
Template for creating reference count managed smart pointers.
uint32 currentRTPClockRate
static const size_t defaultMaxSendSegmentSize
uint8 PayloadType
RTP payload type numeric identifier.