fi.helsinki.cs.ohtu.mpeg2
Class DecoderBuffer

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

public class DecoderBuffer
extends java.lang.Object

Implements a simple model of decoder buffering.


Nested Class Summary
private static class DecoderBuffer.DecoderBufferEntry
           
 
Field Summary
private  java.util.Queue<DecoderBuffer.DecoderBufferEntry> buffer
           
private  int length
           
private  int size
           
 
Constructor Summary
DecoderBuffer(int size)
          Creates a new decoder buffer with the given buffer size.
 
Method Summary
 void add(long dts, int length)
          Adds a new decoding entry to the buffer.
 int getLength()
          Returns the length of the buffer, that is, the sum of the lengths of all the entries.
 int getSize()
          Returns the size of the buffer.
 int getSpace()
          Returns the space available in the buffer.
 void removeDecoded(long pcr)
          Removes all the decoding entries to be decoded by the given PCR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

private final java.util.Queue<DecoderBuffer.DecoderBufferEntry> buffer

size

private final int size

length

private int length
Constructor Detail

DecoderBuffer

public DecoderBuffer(int size)
Creates a new decoder buffer with the given buffer size.

Parameters:
size - the size of the buffer
Method Detail

add

public void add(long dts,
                int length)
Adds a new decoding entry to the buffer.

Parameters:
dts - the DTS for the entry, i.e. when the entry is removed
length - the length of the entry

removeDecoded

public void removeDecoded(long pcr)
Removes all the decoding entries to be decoded by the given PCR.

Parameters:
pcr - the program clock reference

getLength

public int getLength()
Returns the length of the buffer, that is, the sum of the lengths of all the entries.

Returns:
the length of the buffer

getSize

public int getSize()
Returns the size of the buffer.

Returns:
the size of the buffer

getSpace

public int getSpace()
Returns the space available in the buffer.

Returns:
the space available