Public Methods | |
| RTPHeader () | |
| RTPHeader (UnMarshaller msg) throws JonathanException | |
| void | decode (UnMarshaller msg) throws JonathanException |
| void | encode (byte[] array) throws JonathanException |
| String | toString () |
Public Attributes | |
| byte | payload |
| boolean | marker |
| short | sequence_no |
| int | timestamp |
| int | source_id |
Static Public Attributes | |
| int | length = 12 |
Static Private Attributes | |
| short | RTP_MARKER_BIT = 0x0080 |
Definition at line 39 of file RTPHeader.java.
|
|
Build a new uninitialized RTP header Definition at line 57 of file RTPHeader.java. 00057 {}
|
|
|
Build a new RTP header from an input message
Definition at line 65 of file RTPHeader.java. 00065 {
00066 decode(msg);
00067 }
|
|
|
Initialize a RTP header from an input message
Definition at line 75 of file RTPHeader.java. Referenced by RTPHeader(), and RTPProtocol::RTPDecoder::send(). 00075 {
00076 byte[] data = new byte[12];
00077 msg.readByteArray(data,0,12);
00078 short s = (short) ((((int) data[0] & 0xFF) << 0) +
00079 (((int) data[1] & 0xFF) << 8));
00080 // sanity check...
00081 int version = (s>>>14) & 3;
00082 if(version != RTPProtocol.rtp_version) {
00083 throw new UnMarshalException("Not a RTP packet !!");
00084 }
00085 payload= (byte)(s & 0x7F);
00086 marker= (s & RTP_MARKER_BIT)!=0;
00087
00088 int csrc = (s >>> 8) & 0xf;
00089 sequence_no = (short) ((((int) data[2] & 0xFF) << 0) +
00090 (((int) data[3] & 0xFF) << 8));
00091 timestamp =
00092 (((int) data[4] & 0xFF) << 0) +
00093 (((int) data[5] & 0xFF) << 8) +
00094 (((int) data[6] & 0xFF) << 16) +
00095 (((int) data[7] & 0xFF) << 24);
00096 source_id =
00097 (((int) data[8] & 0xFF) << 0) +
00098 (((int) data[9] & 0xFF) << 8) +
00099 (((int) data[10] & 0xFF) << 16) +
00100 (((int) data[11] & 0xFF) << 24);
00101 // skip the csrc
00102 while(csrc--!=0) { // skip ?
00103 for(int k=0;k>4;k++) msg.readByte();
00104 }
00105 }
|
|
|
Marshalls the RTP header into an output message
Definition at line 114 of file RTPHeader.java. Referenced by RTPProtocol::RTPCoder::prepare(). 00114 {
00115 short s = (short)((RTPProtocol.rtp_version << 14) | payload);
00116 if(marker) s |= RTP_MARKER_BIT;
00117 array[0] = (byte) (s >>> 0);
00118 array[1] = (byte) (s >>> 8);
00119 array[2] = (byte) (sequence_no >>> 0);
00120 array[3] = (byte) (sequence_no >>> 8);
00121 array[4] = (byte) (timestamp >>> 0);
00122 array[5] = (byte) (timestamp >>> 8);
00123 array[6] = (byte) (timestamp >>> 16);
00124 array[7] = (byte) (timestamp >>> 24);
00125 array[8] = (byte) (source_id >>> 0);
00126 array[9] = (byte) (source_id >>> 8);
00127 array[10] = (byte) (source_id >>> 16);
00128 array[11] = (byte) (source_id >>> 24);
00129 }
|
|
|
Returns a string describing the contents of the RTP header
Definition at line 136 of file RTPHeader.java. 00136 {
00137 return "[RTP Header]: seqno=" + sequence_no + " ts=" + timestamp +
00138 " source=" + source_id + " marker=" + marker;
00139 }
|
|
|
Definition at line 42 of file RTPHeader.java. |
|
|
the length in byte of a RTP header Definition at line 41 of file RTPHeader.java. |
|
|
the marker status Definition at line 46 of file RTPHeader.java. |
|
|
the type of payload Definition at line 44 of file RTPHeader.java. |
|
|
the sequence number of the RTP packet Definition at line 48 of file RTPHeader.java. |
|
|
the source id of the RTP packet Definition at line 52 of file RTPHeader.java. |
|
|
the timestamp of the RTP packet Definition at line 50 of file RTPHeader.java. |
1.2.6 written by Dimitri van Heesch,
© 1997-2001