org.red5.server.net.rtmp
Class RTMPUtils

java.lang.Object
  extended by org.red5.server.net.rtmp.RTMPUtils
All Implemented Interfaces:
Constants

public class RTMPUtils
extends Object
implements Constants

RTMP utilities class.

Author:
The Red5 Project (red5@osflash.org), Luke Hubbard, Codegent Ltd (luke@codegent.com)

Field Summary
 
Fields inherited from interface org.red5.server.net.rtmp.message.Constants
ACTION_CLOSE_STREAM, ACTION_CONNECT, ACTION_CREATE_STREAM, ACTION_DELETE_STREAM, ACTION_DISCONNECT, ACTION_PAUSE, ACTION_PLAY, ACTION_PUBLISH, ACTION_RECEIVE_AUDIO, ACTION_RECEIVE_VIDEO, ACTION_RELEASE_STREAM, ACTION_SEEK, ACTION_STOP, 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, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, 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
RTMPUtils()
           
 
Method Summary
static int decodeChannelId(int header, int byteCount)
          Decode channel id.
static byte decodeHeaderSize(int header, int byteCount)
          Decode header size.
static void encodeHeaderByte(org.apache.mina.common.ByteBuffer out, byte headerSize, int channelId)
          Encodes header size marker and channel id into header marker.
static int getHeaderLength(byte headerSize)
          Return header length from marker value.
static int readMediumInt(org.apache.mina.common.ByteBuffer in)
           
static int readMediumIntOld(org.apache.mina.common.ByteBuffer in)
           
static int readReverseInt(org.apache.mina.common.ByteBuffer in)
          Read integer in reversed order.
static int readReverseIntOld(org.apache.mina.common.ByteBuffer in)
          Read integer in reversed order.
static int readUnsignedMediumInt(org.apache.mina.common.ByteBuffer in)
           
static int readUnsignedMediumIntOld(org.apache.mina.common.ByteBuffer in)
           
static void writeMediumInt(org.apache.mina.common.ByteBuffer out, int value)
           
static void writeReverseInt(org.apache.mina.common.ByteBuffer out, int value)
          Writes reversed integer to buffer.
static void writeReverseIntOld(org.apache.mina.common.ByteBuffer out, int value)
          Writes reversed integer to buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTMPUtils

public RTMPUtils()
Method Detail

writeReverseIntOld

public static void writeReverseIntOld(org.apache.mina.common.ByteBuffer out,
                                      int value)
Writes reversed integer to buffer.

Parameters:
out - Buffer
value - Integer to write

writeReverseInt

public static void writeReverseInt(org.apache.mina.common.ByteBuffer out,
                                   int value)
Writes reversed integer to buffer.

Parameters:
out - Buffer
value - Integer to write

writeMediumInt

public static void writeMediumInt(org.apache.mina.common.ByteBuffer out,
                                  int value)
Parameters:
out -
value -

readUnsignedMediumInt

public static int readUnsignedMediumInt(org.apache.mina.common.ByteBuffer in)
Parameters:
in -
Returns:

readUnsignedMediumIntOld

public static int readUnsignedMediumIntOld(org.apache.mina.common.ByteBuffer in)
Parameters:
in -
Returns:

readMediumIntOld

public static int readMediumIntOld(org.apache.mina.common.ByteBuffer in)
Parameters:
in -
Returns:

readMediumInt

public static int readMediumInt(org.apache.mina.common.ByteBuffer in)
Parameters:
in -
Returns:

readReverseInt

public static int readReverseInt(org.apache.mina.common.ByteBuffer in)
Read integer in reversed order.

Parameters:
in - Input buffer
Returns:
Integer

readReverseIntOld

public static int readReverseIntOld(org.apache.mina.common.ByteBuffer in)
Read integer in reversed order.

Parameters:
in - Input buffer
Returns:
Integer

encodeHeaderByte

public static void encodeHeaderByte(org.apache.mina.common.ByteBuffer out,
                                    byte headerSize,
                                    int channelId)
Encodes header size marker and channel id into header marker.

Parameters:
headerSize - Header size marker
channelId - Channel used

decodeChannelId

public static int decodeChannelId(int header,
                                  int byteCount)
Decode channel id.

Parameters:
header - Header
Returns:
Channel id

decodeHeaderSize

public static byte decodeHeaderSize(int header,
                                    int byteCount)
Decode header size.

Parameters:
header - Header byte
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


Copyright © 2006-2007 the Red5 project.