|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.neomedia.RawPacket
public class RawPacket
When using TransformConnector, a RTP/RTCP packet is represented using RawPacket. RawPacket stores the buffer holding the RTP/RTCP packet, as well as the inner offset and length of RTP/RTCP packet data. After transformation, data is also store in RawPacket objects, either the original RawPacket (in place transformation), or a newly created RawPacket. Besides packet info storage, RawPacket also provides some other operations such as readInt() to ease the development process.
| Field Summary | |
|---|---|
static int |
EXT_HEADER_SIZE
The size of the extension header as defined by RFC 3550. |
static int |
FIXED_HEADER_SIZE
The size of the fixed part of the RTP header as defined by RFC 3550. |
| Constructor Summary | |
|---|---|
RawPacket()
Construct an empty RawPacket |
|
RawPacket(byte[] buffer,
int offset,
int length)
Construct a RawPacket using specified value. |
|
| Method Summary | |
|---|---|
void |
addExtension(byte[] extBuff,
int newExtensionLen)
Adds the extBuff buffer to as an extension of this packet according the rules specified in RFC 5285. |
void |
append(byte[] data,
int len)
Append a byte array to the end of the packet. |
long[][] |
extractCsrcLevels(byte csrcExtID)
Returns a bi-dimensional byte array containing a map binding CSRC IDs to audio levels as reported by the remote party that sent this packet. |
long[] |
extractCsrcList()
Returns the list of CSRC IDs, currently encapsulated in this packet. |
byte[] |
getBuffer()
Get buffer containing the content of this packet |
int |
getCsrcCount()
Returns the number of CSRC identifiers currently included in this packet. |
boolean |
getExtensionBit()
Returns true if the extension bit of this packet has been set and false otherwise. |
int |
getExtensionLength()
Returns the length of the extensions currently added to this packet. |
int |
getHeaderExtensionType()
Return the define by profile part of the extension header. |
int |
getHeaderLength()
Get RTP header length from a RTP packet |
int |
getLength()
Get the length of this packet's data |
int |
getOffset()
Get the start offset of this packet's data inside storing buffer |
int |
getPaddingSize()
Get RTP padding size from a RTP packet |
byte[] |
getPayload()
Get the RTP payload (bytes) of this RTP packet. |
int |
getPayloadLength()
Get RTP payload length from a RTP packet |
byte |
getPayloadType()
Get RTP payload type from a RTP packet |
int |
getSequenceNumber()
Get RTP sequence number from a RTP packet |
int |
getSSRC()
Get RTP SSRC from a RTP packet |
long |
getTimestamp()
Returns the timestamp for this RTP RawPacket. |
boolean |
isPacketMarked()
Test whether if a RTP packet is padded |
byte |
readByte(int off)
Read a byte from this packet at specified offset |
int |
readInt(int off)
Read a integer from this packet at specified offset |
byte[] |
readRegion(int off,
int len)
Read a byte region from specified offset with specified length |
void |
readRegionToBuff(int off,
int len,
byte[] outBuff)
Read a byte region from specified offset with specified length in given buffer |
short |
readShort(int off)
Read a short from this packet at specified offset |
byte[] |
readTimeStampIntoByteArray()
Get RTP timestamp from a RTP packet |
long |
readUnsignedIntAsLong(int off)
Read an unsigned integer as long at specified offset |
int |
readUnsignedShortAsInt(int off)
Read an unsigned short at specified offset as a int |
void |
removeExtension()
Removes the extension from the packet and its header. |
protected void |
setBuffer(byte[] buffer)
|
void |
setCsrcList(long[] newCsrcList)
Replaces the existing CSRC list (even if empty) with newCsrcList and updates the CC (CSRC count) field of this RawPacket accordingly. |
protected void |
setLength(int length)
|
void |
setMarker(boolean marker)
Sets or resets the marker bit of this packet according to the marker parameter. |
protected void |
setOffset(int offset)
|
void |
setPayload(byte payload)
Sets the payload of this packet. |
void |
setTimestamp(long timestamp)
Set the timestamp value of the RTP Packet |
void |
shrink(int len)
Shrink the buffer of this packet by specified length |
void |
writeByte(int off,
byte b)
Write a byte to this packet at specified offset |
void |
writeInt(int off,
int data)
Set an integer at specified offset in network order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FIXED_HEADER_SIZE
public static final int EXT_HEADER_SIZE
| Constructor Detail |
|---|
public RawPacket()
public RawPacket(byte[] buffer,
int offset,
int length)
buffer - Byte array holding the content of this Packetoffset - Start offset of packet content inside bufferlength - Length of the packet's data| Method Detail |
|---|
public byte[] getBuffer()
public int getLength()
public int getOffset()
protected void setBuffer(byte[] buffer)
buffer - the buffer to setprotected void setOffset(int offset)
offset - the offset to setprotected void setLength(int length)
length - the length to setpublic void setMarker(boolean marker)
marker - true if we are to raise the marker bit and
false otherwise.public void setPayload(byte payload)
payload - the RTP payload type describing the content of this
packet.public long getTimestamp()
public void setTimestamp(long timestamp)
timestamp - : the RTP Timestamppublic int readInt(int off)
off - start offset of the integer to be read
public void writeInt(int off,
int data)
off - Offset into the bufferdata - The integer to store in the packetpublic short readShort(int off)
off - start offset of this short
public int readUnsignedShortAsInt(int off)
off - start offset of the unsigned short
public byte readByte(int off)
off - start offset of the byte
public void writeByte(int off,
byte b)
off - start offset of the byteb - byte to writepublic long readUnsignedIntAsLong(int off)
off - start offset of this unsigned integer
public byte[] readRegion(int off,
int len)
off - start offset of the region to be readlen - length of the region to be read
public void readRegionToBuff(int off,
int len,
byte[] outBuff)
off - start offset of the region to be readlen - length of the region to be readoutBuff - output buffer
public void append(byte[] data,
int len)
data - byte array to appendlen - the number of bytes to appendpublic void shrink(int len)
len - length to shrinkpublic int getCsrcCount()
public void setCsrcList(long[] newCsrcList)
newCsrcList - the list of CSRC identifiers that we'd like to set for
this RawPacket.public long[] extractCsrcList()
public int getPaddingSize()
public int getHeaderLength()
public int getPayloadLength()
public int getSSRC()
public int getSequenceNumber()
public boolean isPacketMarked()
public byte getPayloadType()
public byte[] getPayload()
public byte[] readTimeStampIntoByteArray()
public boolean getExtensionBit()
public int getExtensionLength()
public void addExtension(byte[] extBuff,
int newExtensionLen)
extBuff - the buffer that we'd like to add as an extension in this
packet.newExtensionLen - the length of the data in extBuff.public void removeExtension()
public long[][] extractCsrcLevels(byte csrcExtID)
csrcExtID - the ID of the extension that's transporting csrc audio
levels in the session that this RawPacket belongs to.
public int getHeaderExtensionType()
|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||