org.red5.server.net.rtp
Class RTPPacket

java.lang.Object
  extended by org.red5.server.net.rtp.RTPPacket
All Implemented Interfaces:
Packet

public class RTPPacket
extends Object
implements Packet

This class wraps a RTP packet providing method to convert from and to a IoBuffer.

A RTP packet is composed of an header and the subsequent payload.

The RTP header has the following format:

        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |V=2|P|X|  CC   |M|     PT      |       sequence number         |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |                           timestamp                           |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |           synchronization source (SSRC) identifier            |
        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
        |            contributing source (CSRC) identifiers             |
        |                             ....                              |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
The first twelve octets are present in every RTP packet, while the list of CSRC identifiers is present only when inserted by a mixer.

Author:
Matteo Merli

Constructor Summary
protected RTPPacket()
           
  RTPPacket(IoBuffer buffer)
          Construct a new RTPPacket reading the fields from a IoBuffer
 
Method Summary
 UnsignedInt[] getCsrc()
           
 byte getCsrcCount()
           
 byte[] getPayload()
           
 UnsignedByte getPayloadType()
           
 UnsignedShort getSequence()
           
 UnsignedInt getSsrc()
           
 UnsignedInt getTimestamp()
           
 byte getVersion()
           
 boolean isExtension()
           
 boolean isMarker()
           
 boolean isPadding()
           
 void setCsrc(UnsignedInt[] csrc)
           
 void setCsrcCount(byte csrcCount)
           
 void setExtension(boolean extension)
           
 void setMarker(boolean marker)
           
 void setPadding(boolean padding)
           
 void setPayload(byte[] payload)
           
 void setPayloadType(UnsignedByte payloadType)
           
 void setSequence(UnsignedShort sequence)
           
 void setSsrc(UnsignedInt ssrc)
           
 void setTimestamp(UnsignedInt timestamp)
           
 void setVersion(byte version)
           
 IoBuffer toByteBuffer()
          Convert the packet instance into a IoBuffer ready to be sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTPPacket

public RTPPacket(IoBuffer buffer)
Construct a new RTPPacket reading the fields from a IoBuffer

Parameters:
buffer - the buffer containing the packet

RTPPacket

protected RTPPacket()
Method Detail

toByteBuffer

public IoBuffer toByteBuffer()
Convert the packet instance into a IoBuffer ready to be sent.

Specified by:
toByteBuffer in interface Packet
Returns:
a new IoBuffer

getCsrc

public UnsignedInt[] getCsrc()
Returns:
Returns the csrc.

setCsrc

public void setCsrc(UnsignedInt[] csrc)
Parameters:
csrc - The csrc to set.

getCsrcCount

public byte getCsrcCount()
Returns:
Returns the csrcCount.

setCsrcCount

public void setCsrcCount(byte csrcCount)
Parameters:
csrcCount - The csrcCount to set.

isExtension

public boolean isExtension()
Returns:
Returns the extension.

setExtension

public void setExtension(boolean extension)
Parameters:
extension - The extension to set.

isMarker

public boolean isMarker()
Returns:
Returns the marker.

setMarker

public void setMarker(boolean marker)
Parameters:
marker - The marker to set.

isPadding

public boolean isPadding()
Returns:
Returns the padding.

setPadding

public void setPadding(boolean padding)
Parameters:
padding - The padding to set.

getPayload

public byte[] getPayload()
Returns:
Returns the payload.

setPayload

public void setPayload(byte[] payload)
Parameters:
payload - The payload to set.

getPayloadType

public UnsignedByte getPayloadType()
Returns:
Returns the payloadType.

setPayloadType

public void setPayloadType(UnsignedByte payloadType)
Parameters:
payloadType - The payloadType to set.

getSequence

public UnsignedShort getSequence()
Returns:
Returns the sequence.

setSequence

public void setSequence(UnsignedShort sequence)
Parameters:
sequence - The sequence to set.

getSsrc

public UnsignedInt getSsrc()
Returns:
Returns the ssrc.

setSsrc

public void setSsrc(UnsignedInt ssrc)
Parameters:
ssrc - The ssrc to set.

getTimestamp

public UnsignedInt getTimestamp()
Returns:
Returns the timestamp.

setTimestamp

public void setTimestamp(UnsignedInt timestamp)
Parameters:
timestamp - The timestamp to set.

getVersion

public byte getVersion()
Returns:
Returns the version.

setVersion

public void setVersion(byte version)
Parameters:
version - The version to set.


Copyright © 2006-2009 The Red5 Project