Package org.red5.server.net.rtmp
Class RTMPUtils
java.lang.Object
org.red5.server.net.rtmp.RTMPUtils
- All Implemented Interfaces:
Constants
RTMP utilities class.
- Author:
- The Red5 Project, Luke Hubbard, Codegent Ltd ([email protected]), Art Clarke ([email protected])
-
Field Summary
Fields inherited from interface org.red5.server.net.rtmp.message.Constants
HANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_EDGE_ORIGIN, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompareTimestamps(int a, int b) Compares two RTMP time stamps, accounting for time stamp wrapping.static intdecodeChannelId(int header, int byteCount) Decode channel id.static bytedecodeHeaderSize(int header, int byteCount) Decode header size.static longdiffTimestamps(int a, int b) Calculates the delta between two time stamps, adjusting for time stamp wrapping.static voidencodeHeaderByte(org.apache.mina.core.buffer.IoBuffer out, byte headerSize, int channelId) Encodes header size marker and channel id into header marker.static intgetHeaderLength(byte headerSize) Return header length from marker value.static intreadMediumInt(org.apache.mina.core.buffer.IoBuffer in) static intreadMediumIntOld(org.apache.mina.core.buffer.IoBuffer in) static intreadReverseInt(org.apache.mina.core.buffer.IoBuffer in) Read integer in reversed order.static intreadUnsignedMediumInt(org.apache.mina.core.buffer.IoBuffer in) static intreadUnsignedMediumIntOld(org.apache.mina.core.buffer.IoBuffer in) static voidwriteMediumInt(org.apache.mina.core.buffer.IoBuffer out, int value) static voidwriteReverseInt(org.apache.mina.core.buffer.IoBuffer out, int value) Writes reversed integer to buffer.static voidwriteReverseIntOld(org.apache.mina.core.buffer.IoBuffer out, int value) Writes reversed integer to buffer.
-
Constructor Details
-
RTMPUtils
public RTMPUtils()
-
-
Method Details
-
writeReverseIntOld
public static void writeReverseIntOld(org.apache.mina.core.buffer.IoBuffer out, int value) Writes reversed integer to buffer.- Parameters:
out- Buffervalue- Integer to write
-
writeReverseInt
public static void writeReverseInt(org.apache.mina.core.buffer.IoBuffer out, int value) Writes reversed integer to buffer.- Parameters:
out- Buffervalue- Integer to write
-
writeMediumInt
public static void writeMediumInt(org.apache.mina.core.buffer.IoBuffer out, int value) - Parameters:
out- output buffervalue- value to write
-
readUnsignedMediumInt
public static int readUnsignedMediumInt(org.apache.mina.core.buffer.IoBuffer in) - Parameters:
in- input- Returns:
- unsigned int
-
readUnsignedMediumIntOld
public static int readUnsignedMediumIntOld(org.apache.mina.core.buffer.IoBuffer in) - Parameters:
in- input- Returns:
- unsigned medium (3 byte) int.
-
readMediumIntOld
public static int readMediumIntOld(org.apache.mina.core.buffer.IoBuffer in) - Parameters:
in- input- Returns:
- signed 3-byte int
-
readMediumInt
public static int readMediumInt(org.apache.mina.core.buffer.IoBuffer in) - Parameters:
in- input- Returns:
- signed 3 byte int
-
readReverseInt
public static int readReverseInt(org.apache.mina.core.buffer.IoBuffer in) Read integer in reversed order.- Parameters:
in- Input buffer- Returns:
- Integer
-
encodeHeaderByte
public static void encodeHeaderByte(org.apache.mina.core.buffer.IoBuffer out, byte headerSize, int channelId) Encodes header size marker and channel id into header marker.- Parameters:
out- output bufferheaderSize- Header size markerchannelId- Channel used
-
decodeChannelId
public static int decodeChannelId(int header, int byteCount) Decode channel id.- Parameters:
header- HeaderbyteCount- byte count- Returns:
- Channel id
-
decodeHeaderSize
public static byte decodeHeaderSize(int header, int byteCount) Decode header size.- Parameters:
header- Header bytebyteCount- byte count- Returns:
- Header size byte
-
getHeaderLength
public static int getHeaderLength(byte headerSize) Return header length from marker value.- Parameters:
headerSize- Header size marker value- Returns:
- Header length
-
compareTimestamps
public static int compareTimestamps(int a, int b) Compares two RTMP time stamps, accounting for time stamp wrapping.- Parameters:
a- First time stampb- Second time stamp- Returns:
- -1 if a < b, 1 if a > b, or 0 if a == b
-
diffTimestamps
public static long diffTimestamps(int a, int b) Calculates the delta between two time stamps, adjusting for time stamp wrapping.- Parameters:
a- First time stampb- Second time stamp- Returns:
- the distance between a and b, which will be negative if a is less than b.
-