38 #ifndef CCXX_RTP_RTPPKT_H_
39 #define CCXX_RTP_RTPPKT_H_
76 struct RTPFixedHeader;
92 RTPPacket(
const unsigned char*
const block,
size_t len,
93 bool duplicate =
false);
121 inline const uint8*
const
123 {
return (uint8*)(buffer + getHeaderSize()); }
130 {
return payloadSize; }
137 {
return static_cast<PayloadType>(getHeader()->payload); }
144 {
return cachedSeqNum; }
151 {
return cachedTimestamp; }
158 {
return getHeader()->version; }
166 {
return getHeader()->padding; }
176 {
return buffer[total - 1]; }
186 {
return getHeader()->marker; }
195 {
return getHeader()->extension; }
203 {
return getHeader()->cc; }
214 {
return static_cast<const uint32*
>(&(getHeader()->sources[1])); }
230 {
return (isExtended()? getHeaderExt()->undefined : 0); }
245 {
return (isExtended()?
246 (static_cast<uint32>(ntohs(getHeaderExt()->length)) << 2) :
255 inline const unsigned char*
257 {
return (isExtended() ?
258 (reinterpret_cast<const unsigned char*>(getHeaderExt()) +
259 sizeof(RTPHeaderExt)) :
268 inline const unsigned char*
const
284 {
return total + srtpLength; }
288 {
return sizeof(RTPFixedHeader); }
301 void reComputePayLength(
bool padding);
321 inline RTPFixedHeader*
323 {
return reinterpret_cast<RTPFixedHeader*
>(buffer); }
327 { getHeader()->extension = e; }
336 inline const RTPHeaderExt*
339 uint32 fixsize =
sizeof(RTPFixedHeader) + (getHeader()->cc << 2);
340 return (reinterpret_cast<RTPHeaderExt*>(buffer + fixsize));
350 {
return ntohl(getHeader()->timestamp); }
354 { memcpy(buffer + pos,src,len); }
384 unsigned char* buffer;
403 struct RTPFixedHeader
405 #if __BYTE_ORDER == __BIG_ENDIAN
406 unsigned char version:2;
408 unsigned char padding:1;
409 unsigned char extension:1;
411 unsigned char marker:1;
412 unsigned char payload:7;
416 unsigned char extension:1;
417 unsigned char padding:1;
418 unsigned char version:2;
419 unsigned char payload:7;
420 unsigned char marker:1;
438 #if __BYTE_ORDER == __BIG_ENDIAN
443 uint16 duration : 16;
449 uint16 duration : 16;
487 {
return ntohs(getRaw2833Payload()->duration);}
495 {getRaw2833Payload()->duration = htons(timestamp);}
538 const unsigned char*
const hdrext, uint32 hdrextlen,
539 const unsigned char*
const data,
size_t datalen,
563 const unsigned char*
const data,
size_t datalen,
613 cachedTimestamp = pts;
625 {
getHeader()->sources[0] = htonl(ssrc); }
689 void setCSRCArray(
const uint32*
const csrcs, uint16 numcsrc);
732 {
return headerValid; }
742 {
return cachedSSRC; }
764 (this->getSSRC() == p.
getSSRC()) ); }
772 {
return !( *
this == p ); }
795 static const uint16 RTP_INVALID_PT_MASK;
796 static const uint16 RTP_INVALID_PT_VALUE;
803 #endif // ndef CCXX_RTP_RTPPKT_H_