37 #ifndef RTPPACKETBUILDER_H 39 #define RTPPACKETBUILDER_H 41 #include "rtpconfig.h" 43 #include "rtpdefines.h" 67 int Init(
size_t maxpacksize);
79 int SetMaximumPacketSize(
size_t maxpacksize);
82 int AddCSRC(uint32_t csrc);
85 int DeleteCSRC(uint32_t csrc);
95 int BuildPacket(
const void *data,
size_t len);
102 int BuildPacket(
const void *data,
size_t len,
103 uint8_t pt,
bool mark,uint32_t timestampinc);
112 int BuildPacketEx(
const void *data,
size_t len,
113 uint16_t hdrextID,
const void *hdrextdata,
size_t numhdrextwords);
122 int BuildPacketEx(
const void *data,
size_t len,
123 uint8_t pt,
bool mark,uint32_t timestampinc,
124 uint16_t hdrextID,
const void *hdrextdata,
size_t numhdrextwords);
127 uint8_t *
GetPacket() {
if (!init)
return 0;
return buffer; }
133 int SetDefaultPayloadType(uint8_t pt);
136 int SetDefaultMark(
bool m);
139 int SetDefaultTimestampIncrement(uint32_t timestampinc);
147 int IncrementTimestamp(uint32_t inc);
156 int IncrementTimestampDefault();
162 uint32_t CreateNewSSRC();
172 uint32_t
GetSSRC()
const {
if (!init)
return 0;
return ssrc; }
175 uint32_t
GetTimestamp()
const {
if (!init)
return 0;
return timestamp; }
195 int PrivateBuildPacket(
const void *data,
size_t len,
196 uint8_t pt,
bool mark,uint32_t timestampinc,
bool gotextension,
197 uint16_t hdrextID = 0,
const void *hdrextdata = 0,
size_t numhdrextwords = 0);
204 uint32_t numpayloadbytes;
212 uint32_t defaulttimestampinc;
213 uint8_t defaultpayloadtype;
216 bool deftsset,defptset,defmarkset;
218 uint32_t csrcs[RTP_MAXCSRCS];
222 uint32_t lastrtptimestamp;
223 uint32_t prevrtptimestamp;
229 return ERR_RTP_PACKBUILD_NOTINIT;
231 defaultpayloadtype = pt;
238 return ERR_RTP_PACKBUILD_NOTINIT;
247 return ERR_RTP_PACKBUILD_NOTINIT;
249 defaulttimestampinc = timestampinc;
256 return ERR_RTP_PACKBUILD_NOTINIT;
264 return ERR_RTP_PACKBUILD_NOTINIT;
266 return ERR_RTP_PACKBUILD_DEFAULTTSINCNOTSET;
267 timestamp += defaulttimestampinc;
273 #endif // RTPPACKETBUILDER_H This class can be used to build RTP packets and is a bit more high-level than the RTPPacket class: it...
Definition: rtppacketbuilder.h:57
void AdjustSSRC(uint32_t s)
Sets a specific SSRC to be used.
Definition: rtppacketbuilder.h:193
int SetDefaultTimestampIncrement(uint32_t timestampinc)
Sets the default timestamp increment to timestampinc.
Definition: rtppacketbuilder.h:244
Interface for generating random numbers.
Definition: rtprandom.h:51
uint32_t GetSSRC() const
Returns the current SSRC identifier.
Definition: rtppacketbuilder.h:172
uint32_t GetPacketCount()
Returns the number of packets which have been created with the current SSRC identifier.
Definition: rtppacketbuilder.h:73
int IncrementTimestampDefault()
This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement ...
Definition: rtppacketbuilder.h:261
size_t GetPacketLength()
Returns the size of the last built RTP packet.
Definition: rtppacketbuilder.h:130
uint32_t GetPacketTimestamp() const
Returns the RTP timestamp which corresponds to the time returned by the previous function.
Definition: rtppacketbuilder.h:187
int SetDefaultMark(bool m)
Sets the default marker bit to m.
Definition: rtppacketbuilder.h:235
Represents a table in which information about the participating sources is kept.
Definition: rtpsources.h:74
RTPTime GetPacketTime() const
Returns the time at which a packet was generated.
Definition: rtppacketbuilder.h:184
uint32_t GetPayloadOctetCount()
Returns the number of payload octets which have been generated with this SSRC identifier.
Definition: rtppacketbuilder.h:76
uint16_t GetSequenceNumber() const
Returns the current sequence number.
Definition: rtppacketbuilder.h:178
int IncrementTimestamp(uint32_t inc)
This function increments the timestamp with the amount given by inc.
Definition: rtppacketbuilder.h:253
Definition: rtpfaketransmitter.h:64
uint32_t GetTimestamp() const
Returns the current RTP timestamp.
Definition: rtppacketbuilder.h:175
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:84
A memory manager.
Definition: rtpmemorymanager.h:150
int SetDefaultPayloadType(uint8_t pt)
Sets the default payload type to pt.
Definition: rtppacketbuilder.h:226
uint8_t * GetPacket()
Returns a pointer to the last built RTP packet data.
Definition: rtppacketbuilder.h:127