org.gagravarr.ogg
Class OggPacket

java.lang.Object
  extended by org.gagravarr.ogg.OggPacketData
      extended by org.gagravarr.ogg.OggPacket

public class OggPacket
extends OggPacketData

Represents a logical group of data. RFC3533 suggests that these should usually be around 50-200 bytes long.


Constructor Summary
  OggPacket(byte[] data)
          Creates a new Ogg Packet filled with data to be later written.
protected OggPacket(OggPage parent, byte[] data, boolean bos, boolean eos)
          Creates a new Ogg Packet based on data read from within an Ogg Page.
 
Method Summary
protected  OggPage _getParent()
          Unit tests only!
 long getGranulePosition()
          Returns the granule position of the page that this packet belongs to.
 int getSequenceNumber()
          Returns the sequence number within the stream of the page that this packet belongs to.
 int getSid()
          Returns the Stream ID (Sid) that this packet belongs to.
 boolean isBeginningOfStream()
          Is this the first packet in the stream? If so, the data should hold the magic information required to identify which decoder will be needed.
 boolean isEndOfStream()
          Is this the last packet in the stream?
protected  void setIsBOS()
           
protected  void setIsEOS()
           
protected  void setParent(OggPage parent)
           
 
Methods inherited from class org.gagravarr.ogg.OggPacketData
getData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OggPacket

protected OggPacket(OggPage parent,
                    byte[] data,
                    boolean bos,
                    boolean eos)
Creates a new Ogg Packet based on data read from within an Ogg Page.


OggPacket

public OggPacket(byte[] data)
Creates a new Ogg Packet filled with data to be later written. The Sid, and begin/end flags will be available after the packet has been flushed.

Method Detail

setParent

protected void setParent(OggPage parent)

setIsBOS

protected void setIsBOS()

setIsEOS

protected void setIsEOS()

_getParent

protected OggPage _getParent()
Unit tests only!


getSid

public int getSid()
Returns the Stream ID (Sid) that this packet belongs to.


getGranulePosition

public long getGranulePosition()
Returns the granule position of the page that this packet belongs to. The meaning of the granule depends on the codec.


getSequenceNumber

public int getSequenceNumber()
Returns the sequence number within the stream of the page that this packet belongs to. You can use this to detect when pages have been lost.


isBeginningOfStream

public boolean isBeginningOfStream()
Is this the first packet in the stream? If so, the data should hold the magic information required to identify which decoder will be needed.


isEndOfStream

public boolean isEndOfStream()
Is this the last packet in the stream?



Copyright © 2012. All Rights Reserved.