de.jarnbjo.ogg
Interface PhysicalOggStream

All Known Implementing Classes:
BasicStream, CachedUrlStream, FileStream, OnDemandUrlStream, UncachedUrlStream

public interface PhysicalOggStream

Interface providing access to a physical Ogg stream. Typically this is a file.


Method Summary
 void close()
          Closes this stream.
 java.util.Collection getLogicalStreams()
          Returns a collection of objects implementing LogicalOggStream for accessing the separate logical streams within this physical Ogg stream.
 OggPage getOggPage(int index)
          Return the Ogg page with the absolute index index, independent from the logical structure of this stream or if the index parameter is -1, the next Ogg page is returned.
 boolean isOpen()
          Checks if this stream is open for reading.
 boolean isSeekable()
           
 void setTime(long granulePosition)
          Sets this stream's (and its logical stream's) position to the granule position.
 

Method Detail

getLogicalStreams

public java.util.Collection getLogicalStreams()
Returns a collection of objects implementing LogicalOggStream for accessing the separate logical streams within this physical Ogg stream.

Returns:
a collection of objects implementing LogicalOggStream which are representing the logical streams contained within this physical stream
See Also:
LogicalOggStream

getOggPage

public OggPage getOggPage(int index)
                   throws OggFormatException,
                          java.io.IOException
Return the Ogg page with the absolute index index, independent from the logical structure of this stream or if the index parameter is -1, the next Ogg page is returned. This method should only be used by implementations of LogicalOggStream to access the raw pages.

Parameters:
index - the absolute index starting from 0 at the beginning of the file or stream or -1 to get the next page in a non-seekable stream
Returns:
the Ogg page with the physical absolute index index
Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs

isOpen

public boolean isOpen()
Checks if this stream is open for reading.

Returns:
true if this stream is open for reading, false otherwise

close

public void close()
           throws java.io.IOException
Closes this stream. After invoking this method, no further access to the streams data is possible.

Throws:
java.io.IOException

setTime

public void setTime(long granulePosition)
             throws OggFormatException,
                    java.io.IOException
Sets this stream's (and its logical stream's) position to the granule position. The next packet read from any logical stream will be the first packet beginning on the first page with a granule position higher than the argument.

At the moment, this method only works correctly for Ogg files with a single logical Vorbis stream, and due to the different interpretations of the granule position, depending on mixed content, this method will never be able to work for mixed streams. Chained and interleaved streams are also not yet supported. Actually, this method is only a hack to support seeking from JMF, but may of course be abused otherwise too :)

Parameters:
granulePosition -
Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs

isSeekable

public boolean isSeekable()
Returns:
true if the stream is seekable, false otherwise