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
00044 #ifndef CCXX_RTP_QUEUEBASE_H_
00045 #define CCXX_RTP_QUEUEBASE_H_
00046
00047 #include <cc++/pointer.h>
00048 #include <ccrtp/rtppkt.h>
00049 #include <ccrtp/sources.h>
00050
00051 #ifdef CCXX_NAMESPACES
00052 namespace ost {
00053 #endif
00054
00071 class __EXPORT AppDataUnit
00072 {
00073 public:
00074 AppDataUnit(const IncomingRTPPkt& packet, const SyncSource& src);
00075
00076 inline ~AppDataUnit()
00077 { }
00078
00082 AppDataUnit(const AppDataUnit& src);
00083
00090 AppDataUnit&
00091 operator=(const AppDataUnit& source);
00092
00096 inline PayloadType
00097 getType() const
00098 { return datablock->getPayloadType(); }
00099
00107 inline const uint8* const
00108 getData() const
00109 { return datablock->getPayload(); }
00110
00114 size_t
00115 getSize() const
00116 { return datablock->getPayloadSize(); }
00117
00121 inline const SyncSource&
00122 getSource() const
00123 { return *source; }
00124
00130 inline bool
00131 isMarked() const
00132 { return datablock->isMarked(); }
00133
00137 inline uint16
00138 getSeqNum() const
00139 { return datablock->getSeqNum(); }
00140
00144 inline uint8
00145 getContributorsCount() const
00146 { return (uint8)datablock->getCSRCsCount(); }
00147
00153 inline const uint32*
00154 getContributorsID() const
00155 { return datablock->getCSRCs(); }
00156
00157 private:
00158 Pointer<const IncomingRTPPkt> datablock;
00159 const SyncSource* source;
00160 };
00161
00169 class __EXPORT RTPQueueBase
00170 {
00171 public:
00179 inline bool
00180 setPayloadFormat(const PayloadFormat& pf)
00181 {
00182 currentPayloadType = pf.getPayloadType();
00183 currentRTPClockRate = pf.getRTPClockRate();
00184 return true;
00185 }
00186
00187 inline uint32 getLocalSSRC() const
00188 { return localSSRC; }
00189
00198 inline uint32 getCurrentRTPClockRate() const
00199 { return currentRTPClockRate; }
00200
00201 inline PayloadType getCurrentPayloadType() const
00202 { return currentPayloadType; }
00203
00204 inline timeval getInitialTime() const
00205 { return initialTime; }
00206
00207 protected:
00212 RTPQueueBase(uint32 *ssrc = NULL);
00213
00214 inline void setLocalSSRC(uint32 ssrc)
00215 { localSSRC = ssrc; localSSRCNetwork = htonl(ssrc); }
00216
00217 inline uint32 getLocalSSRCNetwork() const
00218 { return localSSRCNetwork; }
00219
00220 virtual
00221 ~RTPQueueBase()
00222 { }
00223
00230 inline virtual size_t
00231 dispatchBYE(const std::string&)
00232 { return 0; }
00233
00234 inline virtual void
00235 renewLocalSSRC()
00236 { }
00237
00238 private:
00239
00240 uint32 localSSRC;
00241
00242 uint32 localSSRCNetwork;
00243
00244 uint32 currentRTPClockRate;
00245
00246
00247 PayloadType currentPayloadType;
00248
00249 timeval initialTime;
00250 };
00251
00257 class __EXPORT OutgoingDataQueueBase:
00258 public virtual RTPQueueBase
00259 {
00260 public:
00261 inline size_t
00262 getDefaultMaxSendSegmentSize()
00263 { return defaultMaxSendSegmentSize;}
00264
00271 inline void
00272 setMaxSendSegmentSize(size_t size)
00273 { maxSendSegmentSize = size; }
00274
00275 inline size_t
00276 getMaxSendSegmentSize()
00277 { return maxSendSegmentSize; }
00278
00279 protected:
00280 OutgoingDataQueueBase();
00281
00282 inline virtual
00283 ~OutgoingDataQueueBase()
00284 { }
00285
00286 private:
00287 static const size_t defaultMaxSendSegmentSize;
00288
00289 size_t maxSendSegmentSize;
00290 };
00291
00297 class __EXPORT IncomingDataQueueBase:
00298 public virtual RTPQueueBase
00299 {
00300 public:
00301 inline size_t getDefaultMaxRecvPacketSize() const
00302 { return defaultMaxRecvPacketSize; }
00303
00304 inline size_t
00305 getMaxRecvPacketSize() const
00306 { return maxRecvPacketSize; }
00307
00318 inline void
00319 setMaxRecvPacketSize(size_t maxsize)
00320 { maxRecvPacketSize = maxsize; }
00321
00322 protected:
00323 IncomingDataQueueBase()
00324 { setMaxRecvPacketSize(getDefaultMaxRecvPacketSize()); }
00325
00326 inline virtual
00327 ~IncomingDataQueueBase()
00328 { }
00329
00330 private:
00331 static const size_t defaultMaxRecvPacketSize;
00332
00333 size_t maxRecvPacketSize;
00334 };
00335
00337
00338 #ifdef CCXX_NAMESPACES
00339 }
00340 #endif
00341
00342 #endif //CCXX_RTP_QUEUEBASE_H_
00343