fi.helsinki.cs.ohtu.mpeg2.video
Class SequenceHeader

java.lang.Object
  extended by fi.helsinki.cs.ohtu.mpeg2.video.SequenceHeader

public class SequenceHeader
extends java.lang.Object

Represents the first part of the headers in a MPEG-2 video sequence. A video sequence is the highest level syntactic structure in a MPEG-2 video bitstream. A video sequence is described by headers which are written to its immediate beginning. This class represents the "sequence header", the first of those headers. It is the one of the sequence headers MPEG-2 has in common with MPEG-1. In MPEG-2 usage it's always followed by a sequence extension header, which forms an extended sequence header together with the header represented by this class. The extended sequence header is represented by the class ExtendedSequenceHeader.


Nested Class Summary
static class SequenceHeader.AspectRatioInformation
          Represents the allowed values for the aspect ratio information field.
static class SequenceHeader.FrameRateCode
          Represents the allowed values for the frame rate code field.
 
Field Summary
private  SequenceHeader.AspectRatioInformation aspectRatioInformation
           
private  UnsignedIntegerField bitRateValue
           
private  SequenceHeader.FrameRateCode frameRateCode
           
private  UnsignedIntegerField horizontalSizeValue
           
private  UnsignedIntegerField vbvBufferSizeValue
           
private  UnsignedIntegerField verticalSizeValue
           
 
Constructor Summary
SequenceHeader(int horizontalSizeValue, int verticalSizeValue, SequenceHeader.AspectRatioInformation ratio, SequenceHeader.FrameRateCode rate, int bitRateValue, int vbvBufferSizeValue)
          Constructs a new instance.
 
Method Summary
 SequenceHeader.AspectRatioInformation getAspectRatioInformation()
          Gets the aspect ratio information.
 long getBitRateValue()
          Gets the bit rate value.
 SequenceHeader.FrameRateCode getFrameRateCode()
          Gets the frame rate code.
 long getHorizontalSizeValue()
          Gets the horizontal size value.
 long getVBVBufferSizeValue()
          Gets the video buffering verifier buffer size value.
 long getVerticalSizeValue()
          Gets the vertical size value.
 void setAspectRatioInformation(SequenceHeader.AspectRatioInformation aspectRatioInformation)
          Sets the aspect ratio information.
 void setBitRateValue(int bitRateValue)
          Sets the bit rate value.
 void setFrameRateCode(SequenceHeader.FrameRateCode frameRateCode)
          Sets the frame rate code.
 void setHorizontalSizeValue(int horizontalSizeValue)
          Sets the horizontal size value.
 void setVBVBufferSizeValue(int vbvBufferSizeValue)
          Sets the video buffering verifier buffer size value.
 void setVerticalSizeValue(int verticalSizeValue)
          Sets the vertical size value.
 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

horizontalSizeValue

private UnsignedIntegerField horizontalSizeValue

verticalSizeValue

private UnsignedIntegerField verticalSizeValue

aspectRatioInformation

private SequenceHeader.AspectRatioInformation aspectRatioInformation

frameRateCode

private SequenceHeader.FrameRateCode frameRateCode

bitRateValue

private UnsignedIntegerField bitRateValue

vbvBufferSizeValue

private UnsignedIntegerField vbvBufferSizeValue
Constructor Detail

SequenceHeader

public SequenceHeader(int horizontalSizeValue,
                      int verticalSizeValue,
                      SequenceHeader.AspectRatioInformation ratio,
                      SequenceHeader.FrameRateCode rate,
                      int bitRateValue,
                      int vbvBufferSizeValue)
Constructs a new instance.

Parameters:
horizontalSizeValue - Initial value for the horizontal size value. Same constraints as in setHorizontalSizeValue() apply.
verticalSizeValue - Initial value for the vertical size value. Same constraints as in setVerticalSizeValue() apply.
ratio - Initial value for the aspect ratio information.
rate - Initial value for the frame rate code.
bitRateValue - Initial value for the bit rate value.
vbvBufferSizeValue - Initial value for the VBV buffer size value.
Method Detail

getHorizontalSizeValue

public long getHorizontalSizeValue()
Gets the horizontal size value.

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

setHorizontalSizeValue

public void setHorizontalSizeValue(int horizontalSizeValue)
Sets the horizontal size value. To prevent start code emulation, the value zero is forbidden.

Parameters:
horizontalSizeValue - The new value. Must fit into 12 bits.

getVerticalSizeValue

public long getVerticalSizeValue()
Gets the vertical size value.

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

setVerticalSizeValue

public void setVerticalSizeValue(int verticalSizeValue)
Sets the vertical size value. To prevent start code emulation, the value zero is forbidden.

Parameters:
verticalSizeValue - The new value. Must fit into 12 bits.

getAspectRatioInformation

public SequenceHeader.AspectRatioInformation getAspectRatioInformation()
Gets the aspect ratio information.

Returns:
The information.

setAspectRatioInformation

public void setAspectRatioInformation(SequenceHeader.AspectRatioInformation aspectRatioInformation)
Sets the aspect ratio information.

Parameters:
aspectRatioInformation - The new information.

getFrameRateCode

public SequenceHeader.FrameRateCode getFrameRateCode()
Gets the frame rate code.

Returns:
The code.

setFrameRateCode

public void setFrameRateCode(SequenceHeader.FrameRateCode frameRateCode)
Sets the frame rate code.

Parameters:
frameRateCode - The new code.

getBitRateValue

public long getBitRateValue()
Gets the bit rate value.

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

setBitRateValue

public void setBitRateValue(int bitRateValue)
Sets the bit rate value.

Parameters:
bitRateValue - The new value. Must fit into 18 bits.

getVBVBufferSizeValue

public long getVBVBufferSizeValue()
Gets the video buffering verifier buffer size value.

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

setVBVBufferSizeValue

public void setVBVBufferSizeValue(int vbvBufferSizeValue)
Sets the video buffering verifier buffer size value.

Parameters:
vbvBufferSizeValue - The new value. Must fit into 10 bits.

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.