fi.helsinki.cs.ohtu.mpeg2
Class PackHeader

java.lang.Object
  extended by fi.helsinki.cs.ohtu.mpeg2.PackHeader

public class PackHeader
extends java.lang.Object

Represents the program stream pack header.


Field Summary
(package private)  UnsignedIntegerField programMuxRate
           
(package private)  long scrBase
           
(package private)  UnsignedIntegerField scrExtension
           
(package private)  UnsignedIntegerField stuffingLength
           
 
Constructor Summary
PackHeader(long scrBase, int scrExtension, int programMuxRate, int stuffingLength)
          Class constructor.
 
Method Summary
 int getHeaderLength()
          Returns the size of this PackHeader, in bytes.
 long getProgramMuxRate()
          Gets the program mux rate.
 long getSCRBase()
          Gets the system clock reference base.
 long getSCRExtension()
          Gets the system clock reference extension.
 int getStuffingLength()
          Gets the stuffing length.
 void setProgramMuxRate(int muxRate)
          Sets the program mux rate.
 void setSCRBase(long scrBase)
          Sets the system clock reference base.
 void setSCRExtension(int scrExtension)
          Sets the system clock reference extension.
 void setStuffingLength(int length)
          Sets the stuffing length.
 void writeTo(BitOutputStream stream)
          Writes the header to a bit stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scrBase

long scrBase

scrExtension

UnsignedIntegerField scrExtension

programMuxRate

UnsignedIntegerField programMuxRate

stuffingLength

UnsignedIntegerField stuffingLength
Constructor Detail

PackHeader

public PackHeader(long scrBase,
                  int scrExtension,
                  int programMuxRate,
                  int stuffingLength)
Class constructor.

Parameters:
scrBase - Initial value for the system clock reference base. Same constraints as in setSCRBase() apply.
scrExtension - Initial value for the system clock reference extension. Same constraints as in setSCRExtension() apply.
programMuxRate - Initial value for the program mux rate. Same constraints as in setProgramMuxRate() apply.
stuffingLength - Initial value for the stuffing length. Same constraints as in setStuffingLength() apply.
Method Detail

getSCRBase

public long getSCRBase()
Gets the system clock reference base.

Returns:
The base value. Only the lowest 33 bits will be meaningful.

setSCRBase

public void setSCRBase(long scrBase)
Sets the system clock reference base.

Parameters:
scrBase - The new base value. The value must fit into 33 bits as an unsigned integer.

getSCRExtension

public long getSCRExtension()
Gets the system clock reference extension.

Returns:
The extension value. Only the lowest 9 bits will be meaningful. The value will be in range [0..299].

setSCRExtension

public void setSCRExtension(int scrExtension)
Sets the system clock reference extension.

Parameters:
scrExtension - The new extension value. The value must be in range [0..299].

getProgramMuxRate

public long getProgramMuxRate()
Gets the program mux rate.

Returns:
The rate. Only the lowest 22 bits will be meaningful.

setProgramMuxRate

public void setProgramMuxRate(int muxRate)
Sets the program mux rate.

Parameters:
muxRate - The new rate. The value must be in the range [1..2^22-1].

getStuffingLength

public int getStuffingLength()
Gets the stuffing length.

Returns:
The length. Will be in range [0..7].

setStuffingLength

public void setStuffingLength(int length)
Sets the stuffing length.

Parameters:
length - The new length. Must be in range [0..7].

writeTo

public void writeTo(BitOutputStream stream)
             throws java.io.IOException
Writes the header to a bit stream.

Parameters:
stream - The stream to write to.
Throws:
java.io.IOException - Propagated from the stream write.

getHeaderLength

public int getHeaderLength()
Returns the size of this PackHeader, in bytes.

Returns:
the size in bytes