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