fi.helsinki.cs.ohtu.mpeg2
Class AccessUnit

java.lang.Object
  extended by fi.helsinki.cs.ohtu.mpeg2.AccessUnit
Direct Known Subclasses:
VideoStream.VideoAccessUnit

public class AccessUnit
extends java.lang.Object

Represents a coded presentation of a presentation unit. A decoder handles its input in access units. Access units are queued into the decoder's input buffer and are removed after decoding.

The exact meaning of an access unit depends on a decoder. In case of audio, an access unit might be decoded into a frame of samples. A video decoder might generate a picture frame or field from an access unit.

Instances of this class are immutable. They can be shared safely between objects and threads.


Field Summary
private  byte[] data
           
private  boolean discont
           
private  long dts
           
private  long pts
           
 
Constructor Summary
AccessUnit(long pts, long dts, byte[] data)
          Creates a new AccessUnit instance.
AccessUnit(long pts, long dts, byte[] data, boolean discont)
          Creates a new AccessUnit instance.
 
Method Summary
 byte byteAt(int i)
          Returns the data byte at the specified index i.
 long getDts()
          Returns the decoding timestamp of this AccessUnit.
 int getLength()
          Returns the number of raw data bytes of this AccessUnit.
 long getPts()
          Returns the presentation timestamp of this AccessUnit.
 boolean isDiscontinuous()
          Returns whether decoding discontinuity precedes this AccessUnit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pts

private final long pts

dts

private final long dts

data

private final byte[] data

discont

private final boolean discont
Constructor Detail

AccessUnit

public AccessUnit(long pts,
                  long dts,
                  byte[] data,
                  boolean discont)
Creates a new AccessUnit instance.

Parameters:
pts - the PTS for the access unit, in ticks of the 90kHz clock
dts - the DTS for the access unit, in ticks of the 90kHz clock
data - the data for the access unit
discont - true if a decoding discontinuity precedes the access unit

AccessUnit

public AccessUnit(long pts,
                  long dts,
                  byte[] data)
Creates a new AccessUnit instance.

Parameters:
pts - the PTS for the access unit, in ticks of the 90kHz clock
dts - the DTS for the access unit, in ticks of the 90kHz clock
data - the data for the access unit
Method Detail

isDiscontinuous

public boolean isDiscontinuous()
Returns whether decoding discontinuity precedes this AccessUnit.

Returns:
true in the presence of deconfing discontinuity

getPts

public long getPts()
Returns the presentation timestamp of this AccessUnit.

Returns:
the presentation timestamp

getDts

public long getDts()
Returns the decoding timestamp of this AccessUnit.

Returns:
the decoding timestamp

getLength

public int getLength()
Returns the number of raw data bytes of this AccessUnit.

Returns:
the number of raw data bytes

byteAt

public byte byteAt(int i)
Returns the data byte at the specified index i.

Parameters:
i - the index of the data byte
Returns:
the data byte