edu.umd.cfar.lamp.mpeg1.system
Class SystemIndex

java.lang.Object
  extended byedu.umd.cfar.lamp.mpeg1.system.SystemIndex

public class SystemIndex
extends java.lang.Object


Field Summary
static int MAGIC_NUMBER
           
 
Constructor Summary
SystemIndex()
           
 
Method Summary
 void addPacket(int stream_id, long systemStreamBytePosition, int packetDataLength)
          Adds a SystemIndexElement to the index.
 long getLastByteInPacket(int stream_id, long bytePosition)
           
 long getPosition(int stream_id, long bytePosition)
          Gets the byte position in the System Stream of the given byte position in the elementary stream with the given stream_id.
 java.util.Vector getStreamList()
           
 java.util.Vector getVideoStreamList()
           
 void readIndex(java.io.DataInput in)
           
 java.lang.String toString()
           
 void writeIndex(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAGIC_NUMBER

public static final int MAGIC_NUMBER
See Also:
Constant Field Values
Constructor Detail

SystemIndex

public SystemIndex()
Method Detail

writeIndex

public void writeIndex(java.io.DataOutput out)
                throws java.io.IOException
Throws:
java.io.IOException

readIndex

public void readIndex(java.io.DataInput in)
               throws java.io.IOException,
                      MpegException
Throws:
java.io.IOException
MpegException

toString

public java.lang.String toString()

getStreamList

public java.util.Vector getStreamList()
Returns:
a Vector of Integers, corresponding to the list of stream_ids.

getVideoStreamList

public java.util.Vector getVideoStreamList()

addPacket

public void addPacket(int stream_id,
                      long systemStreamBytePosition,
                      int packetDataLength)
Adds a SystemIndexElement to the index. The SystemIndexElement is calculated based on the stream_id, the systemStreamBytePosition, and the index so far.

Parameters:
stream_id - the stream
systemStreamBytePosition - the byte position into the system stream
packetDataLength - the length of the packet

getPosition

public long getPosition(int stream_id,
                        long bytePosition)
                 throws StreamNotFoundException
Gets the byte position in the System Stream of the given byte position in the elementary stream with the given stream_id.

Parameters:
stream_id - the stream
bytePosition - the position into the stream
Returns:
the position in the file
Throws:
StreamNotFoundException

getLastByteInPacket

public long getLastByteInPacket(int stream_id,
                                long bytePosition)
                         throws StreamNotFoundException
Throws:
StreamNotFoundException