net.sf.fmj.media.codec.video.jpeg
Class JpegRTPHeader

java.lang.Object
  extended by net.sf.fmj.media.codec.video.jpeg.JpegRTPHeader

public class JpegRTPHeader
extends java.lang.Object

A JPEG/RTP header. A special header is added to each packet that immediately follows the RTP header: 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type specific | Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Q | Width | Height | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Author:
Ken Larson, Martin Harvan

Field Summary
static int HEADER_SIZE
          In bytes.
 
Constructor Summary
JpegRTPHeader(byte typeSpecific, int fragmentOffset, byte type, byte q, byte width, byte height)
           
 
Method Summary
static byte[] createQHeader(int length, int[] lqt, int[] cqt)
          Creates header containing Quantization tables (used when Q is set to values greater than 127).
static byte[] createRstHeader(int dri, int f, int l, int count)
          Creates RST header for JPEG/RTP packet.
 boolean equals(java.lang.Object o)
           
 int getFragmentOffset()
           
 int getHeightInBlocks()
           
 int getHeightInPixels()
           
 int getQ()
           
 int getType()
           
 int getTypeSpecific()
           
 int getWidthInBlocks()
           
 int getWidthInPixels()
           
 int hashCode()
           
static JpegRTPHeader parse(byte[] data, int offset)
           
 byte[] toBytes()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HEADER_SIZE

public static final int HEADER_SIZE
In bytes.

See Also:
Constant Field Values
Constructor Detail

JpegRTPHeader

public JpegRTPHeader(byte typeSpecific,
                     int fragmentOffset,
                     byte type,
                     byte q,
                     byte width,
                     byte height)
Method Detail

parse

public static JpegRTPHeader parse(byte[] data,
                                  int offset)

toBytes

public byte[] toBytes()

createQHeader

public static byte[] createQHeader(int length,
                                   int[] lqt,
                                   int[] cqt)
Creates header containing Quantization tables (used when Q is set to values greater than 127).

Parameters:
length - length for the headers (usually 128 - two 64 bytes long tables)
lqt - Luma Quantization table
cqt - Chroma Quantization table
Returns:
Qtable header

getWidthInPixels

public int getWidthInPixels()

getHeightInPixels

public int getHeightInPixels()

getWidthInBlocks

public int getWidthInBlocks()

getHeightInBlocks

public int getHeightInBlocks()

getFragmentOffset

public int getFragmentOffset()

getQ

public int getQ()

getType

public int getType()

getTypeSpecific

public int getTypeSpecific()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createRstHeader

public static byte[] createRstHeader(int dri,
                                     int f,
                                     int l,
                                     int count)
Creates RST header for JPEG/RTP packet.

Parameters:
dri - Restart interval - number of MCUs between restart markers
f - first bit (should be set to 1)
l - last bit (should be set to 1)
count - number of restart markers (should be set to 3FFF)
Returns:
RST header

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object