From 9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e Mon Sep 17 00:00:00 2001 From: Michiel Van Der Kolk Date: Mon, 11 Jul 2005 15:42:37 +0000 Subject: Songdb java version, source. only 1.5 compatible git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7101 a1c6a512-1295-4272-9138-f99709370657 --- songdbj/de/jarnbjo/ogg/LogicalOggStream.java | 151 +++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 songdbj/de/jarnbjo/ogg/LogicalOggStream.java (limited to 'songdbj/de/jarnbjo/ogg/LogicalOggStream.java') diff --git a/songdbj/de/jarnbjo/ogg/LogicalOggStream.java b/songdbj/de/jarnbjo/ogg/LogicalOggStream.java new file mode 100644 index 0000000000..2f97b2a728 --- /dev/null +++ b/songdbj/de/jarnbjo/ogg/LogicalOggStream.java @@ -0,0 +1,151 @@ +/* + * $ProjectName$ + * $ProjectRevision$ + * ----------------------------------------------------------- + * $Id$ + * ----------------------------------------------------------- + * + * $Author$ + * + * Description: + * + * Copyright 2002-2003 Tor-Einar Jarnbjo + * ----------------------------------------------------------- + * + * Change History + * ----------------------------------------------------------- + * $Log$ + * Revision 1.1 2005/07/11 15:42:36 hcl + * Songdb java version, source. only 1.5 compatible + * + * Revision 1.1.1.1 2004/04/04 22:09:12 shred + * First Import + * + * Revision 1.2 2003/04/10 19:48:22 jarnbjo + * no message + * + * Revision 1.1 2003/03/03 21:02:20 jarnbjo + * no message + * + */ + +package de.jarnbjo.ogg; + +import java.io.IOException; + +/** + * Interface providing access to a logical Ogg stream as part of a + * physical Ogg stream. + */ + + +public interface LogicalOggStream { + + public static final String FORMAT_UNKNOWN = "application/octet-stream"; + + public static final String FORMAT_VORBIS = "audio/x-vorbis"; + public static final String FORMAT_FLAC = "audio/x-flac"; + public static final String FORMAT_THEORA = "video/x-theora"; + + /** + * Note: To read from the stream, you must use either + * this method or the method getNextOggPacket. + * Mixing calls to the two methods will cause data corruption. + * + * @return the next Ogg page + * + * @see #getNextOggPacket() + * + * @throws OggFormatException if the ogg stream is corrupted + * @throws IOException if some other IO error occurs + */ + + public OggPage getNextOggPage() throws OggFormatException, IOException; + + /** + * Note: To read from the stream, you must use either + * this method or the method getNextOggPage. + * Mixing calls to the two methods will cause data corruption. + * + * @return the next packet as a byte array + * + * @see #getNextOggPage() + * + * @throws OggFormatException if the ogg stream is corrupted + * @throws IOException if some other IO error occurs + */ + + public byte[] getNextOggPacket() throws OggFormatException, IOException; + + /** + * Checks if this stream is open for reading. + * + * @return true if this stream is open for reading, + * false otherwise + */ + + public boolean isOpen(); + + /** + * Closes this stream. After invoking this method, no further access + * to the streams data is possible. + * + * @throws IOException if an IO error occurs + */ + + public void close() throws IOException; + + /** + * Sets the stream's position to the beginning of the stream. + * This method does not work if the physical Ogg stream is not + * seekable. + * + * @throws OggFormatException if the ogg stream is corrupted + * @throws IOException if some other IO error occurs + */ + + public void reset() throws OggFormatException, IOException; + + /** + * This method does not work if the physical Ogg stream is not + * seekable. + * + * @return the granule position of the last page within + * this stream + */ + + public long getMaximumGranulePosition(); + + /** + * This method is invoked on all logical streams when + * calling the same method on the physical stream. The + * same restrictions as mentioned there apply. + * This method does not work if the physical Ogg stream is not + * seekable. + * + * @param granulePosition + * + * @see PhysicalOggStream#setTime(long) + * + * @throws IOException if an IO error occurs + */ + + public void setTime(long granulePosition) throws IOException; + + /** + * @return the last parsed granule position of this stream + */ + + public long getTime(); + + /** + * @return the content type of this stream + * + * @see #FORMAT_UNKNOWN + * @see #FORMAT_VORBIS + * @see #FORMAT_FLAC + * @see #FORMAT_THEORA + */ + + public String getFormat(); +} \ No newline at end of file -- cgit v1.2.3