|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjlibrtp.RtpPkt
public class RtpPkt
RtpPkt is the basic class for creating and parsing RTP packets. There are two ways of instantiating an RtpPkt. One is for packets that you wish to send, which requires that you provide basic information about the packet and a payload. Upon calling encode() the fields of the structure are written into a bytebuffer, in the form that it would sent across the network, excluding the UDP headers. The other way is by passing a bytebuffer. The assumption is that this is a packet that has been received from the network, excluding UDP headers, and the bytebuffer will be parsed into the correct fields. The class keeps track of changes. Therefore, modifications are possible after calling encode(), if necessary, the raw version of the packet will be regenerated on subsequent requests.
Field Summary | |
---|---|
private long[] |
csrcArray
SSRCs of contributing sources, 32xn bits, n<16 |
private int |
extension
Whether and extension is used, 1 bit |
private int |
marker
Whether the packet is marked, 1 bit |
private int |
padding
Whether the packet is padded, 1 bit |
private byte[] |
payload
The actual data, without any RTP stuff |
private int |
payloadType
What payload type is used, 7 bits |
private byte[] |
rawPkt
Contains the actual data (eventually) |
private boolean |
rawPktCurrent
Whether the packet has been changed since encode() |
private int |
seqNumber
The sequence number, taken from RTP Session, 16 bits |
private long |
ssrc
The SSRC of the packet sender, 32 bits |
private long |
timeStamp
The RTP timestamp, 32bits |
private int |
version
The version, always 2, 2 bits |
Constructor Summary | |
---|---|
protected |
RtpPkt(byte[] aRawPkt,
int packetSize)
Construct a packet-instance from an raw packet (believed to be RTP). |
protected |
RtpPkt(long aTimeStamp,
long syncSource,
int seqNum,
int plt,
byte[] pl)
Construct a packet-instance. |
Method Summary | |
---|---|
protected int |
checkPkt()
Reading stuff |
protected byte[] |
encode()
Encodes the a |
protected long[] |
getCsrcArray()
|
protected int |
getCsrcCount()
|
protected int |
getHeaderLength()
|
protected byte[] |
getPayload()
|
protected int |
getPayloadLength()
|
protected int |
getPayloadType()
|
protected int |
getSeqNumber()
|
protected long |
getSsrc()
|
protected long |
getTimeStamp()
|
protected int |
getVersion()
|
protected boolean |
isMarked()
|
protected void |
printPkt()
|
protected int |
setCsrcs(long[] contributors)
|
protected void |
setMarked(boolean mark)
Setting stuff |
protected int |
setPayload(byte[] data)
|
protected int |
setPayloadType(int plType)
|
protected int |
setSeqNumber(int number)
|
protected int |
setSsrc(long source)
|
protected int |
setTimeStamp(long time)
|
private void |
sliceCSRCs()
|
private void |
sliceFirstLine()
|
private void |
slicePayload(int bytes)
|
private void |
sliceSSRC()
|
private void |
sliceTimeStamp()
|
private void |
writeFirstLine()
|
private void |
writePkt()
Private functions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean rawPktCurrent
private int version
private int padding
private int extension
private int marker
private int payloadType
private int seqNumber
private long timeStamp
private long ssrc
private long[] csrcArray
private byte[] rawPkt
private byte[] payload
Constructor Detail |
---|
protected RtpPkt(long aTimeStamp, long syncSource, int seqNum, int plt, byte[] pl)
aTimeStamp
- RTP timestamp for datasyncSource
- the SSRC, usually taken from RTPSessionseqNum
- Sequency numberplt
- Type of payloadpl
- Payload, the actual dataprotected RtpPkt(byte[] aRawPkt, int packetSize)
aRawPkt
- The data-part of a UDP-packet believed to be RTPpacketSize
- the number of valid octets in the packet, should be aRawPkt.lengthMethod Detail |
---|
protected int checkPkt()
protected int getHeaderLength()
protected int getPayloadLength()
protected int getVersion()
protected boolean isMarked()
protected int getPayloadType()
protected int getSeqNumber()
protected long getTimeStamp()
protected long getSsrc()
protected int getCsrcCount()
protected long[] getCsrcArray()
protected byte[] encode()
protected void printPkt()
protected void setMarked(boolean mark)
protected int setPayloadType(int plType)
protected int setSeqNumber(int number)
protected int setTimeStamp(long time)
protected int setSsrc(long source)
protected int setCsrcs(long[] contributors)
protected int setPayload(byte[] data)
protected byte[] getPayload()
private void writePkt()
private void writeFirstLine()
private void sliceFirstLine()
private void sliceTimeStamp()
private void sliceSSRC()
private void sliceCSRCs()
private void slicePayload(int bytes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |