diff options
Diffstat (limited to 'songdbj/de/jarnbjo/ogg/LogicalOggStream.java')
-rw-r--r-- | songdbj/de/jarnbjo/ogg/LogicalOggStream.java | 151 |
1 files changed, 151 insertions, 0 deletions
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 @@ | |||
1 | /* | ||
2 | * $ProjectName$ | ||
3 | * $ProjectRevision$ | ||
4 | * ----------------------------------------------------------- | ||
5 | * $Id$ | ||
6 | * ----------------------------------------------------------- | ||
7 | * | ||
8 | * $Author$ | ||
9 | * | ||
10 | * Description: | ||
11 | * | ||
12 | * Copyright 2002-2003 Tor-Einar Jarnbjo | ||
13 | * ----------------------------------------------------------- | ||
14 | * | ||
15 | * Change History | ||
16 | * ----------------------------------------------------------- | ||
17 | * $Log$ | ||
18 | * Revision 1.1 2005/07/11 15:42:36 hcl | ||
19 | * Songdb java version, source. only 1.5 compatible | ||
20 | * | ||
21 | * Revision 1.1.1.1 2004/04/04 22:09:12 shred | ||
22 | * First Import | ||
23 | * | ||
24 | * Revision 1.2 2003/04/10 19:48:22 jarnbjo | ||
25 | * no message | ||
26 | * | ||
27 | * Revision 1.1 2003/03/03 21:02:20 jarnbjo | ||
28 | * no message | ||
29 | * | ||
30 | */ | ||
31 | |||
32 | package de.jarnbjo.ogg; | ||
33 | |||
34 | import java.io.IOException; | ||
35 | |||
36 | /** | ||
37 | * Interface providing access to a logical Ogg stream as part of a | ||
38 | * physical Ogg stream. | ||
39 | */ | ||
40 | |||
41 | |||
42 | public interface LogicalOggStream { | ||
43 | |||
44 | public static final String FORMAT_UNKNOWN = "application/octet-stream"; | ||
45 | |||
46 | public static final String FORMAT_VORBIS = "audio/x-vorbis"; | ||
47 | public static final String FORMAT_FLAC = "audio/x-flac"; | ||
48 | public static final String FORMAT_THEORA = "video/x-theora"; | ||
49 | |||
50 | /** | ||
51 | * <i>Note:</i> To read from the stream, you must use either | ||
52 | * this method or the method <code>getNextOggPacket</code>. | ||
53 | * Mixing calls to the two methods will cause data corruption. | ||
54 | * | ||
55 | * @return the next Ogg page | ||
56 | * | ||
57 | * @see #getNextOggPacket() | ||
58 | * | ||
59 | * @throws OggFormatException if the ogg stream is corrupted | ||
60 | * @throws IOException if some other IO error occurs | ||
61 | */ | ||
62 | |||
63 | public OggPage getNextOggPage() throws OggFormatException, IOException; | ||
64 | |||
65 | /** | ||
66 | * <i>Note:</i> To read from the stream, you must use either | ||
67 | * this method or the method <code>getNextOggPage</code>. | ||
68 | * Mixing calls to the two methods will cause data corruption. | ||
69 | * | ||
70 | * @return the next packet as a byte array | ||
71 | * | ||
72 | * @see #getNextOggPage() | ||
73 | * | ||
74 | * @throws OggFormatException if the ogg stream is corrupted | ||
75 | * @throws IOException if some other IO error occurs | ||
76 | */ | ||
77 | |||
78 | public byte[] getNextOggPacket() throws OggFormatException, IOException; | ||
79 | |||
80 | /** | ||
81 | * Checks if this stream is open for reading. | ||
82 | * | ||
83 | * @return <code>true</code> if this stream is open for reading, | ||
84 | * <code>false</code> otherwise | ||
85 | */ | ||
86 | |||
87 | public boolean isOpen(); | ||
88 | |||
89 | /** | ||
90 | * Closes this stream. After invoking this method, no further access | ||
91 | * to the streams data is possible. | ||
92 | * | ||
93 | * @throws IOException if an IO error occurs | ||
94 | */ | ||
95 | |||
96 | public void close() throws IOException; | ||
97 | |||
98 | /** | ||
99 | * Sets the stream's position to the beginning of the stream. | ||
100 | * This method does not work if the physical Ogg stream is not | ||
101 | * seekable. | ||
102 | * | ||
103 | * @throws OggFormatException if the ogg stream is corrupted | ||
104 | * @throws IOException if some other IO error occurs | ||
105 | */ | ||
106 | |||
107 | public void reset() throws OggFormatException, IOException; | ||
108 | |||
109 | /** | ||
110 | * This method does not work if the physical Ogg stream is not | ||
111 | * seekable. | ||
112 | * | ||
113 | * @return the granule position of the last page within | ||
114 | * this stream | ||
115 | */ | ||
116 | |||
117 | public long getMaximumGranulePosition(); | ||
118 | |||
119 | /** | ||
120 | * This method is invoked on all logical streams when | ||
121 | * calling the same method on the physical stream. The | ||
122 | * same restrictions as mentioned there apply. | ||
123 | * This method does not work if the physical Ogg stream is not | ||
124 | * seekable. | ||
125 | * | ||
126 | * @param granulePosition | ||
127 | * | ||
128 | * @see PhysicalOggStream#setTime(long) | ||
129 | * | ||
130 | * @throws IOException if an IO error occurs | ||
131 | */ | ||
132 | |||
133 | public void setTime(long granulePosition) throws IOException; | ||
134 | |||
135 | /** | ||
136 | * @return the last parsed granule position of this stream | ||
137 | */ | ||
138 | |||
139 | public long getTime(); | ||
140 | |||
141 | /** | ||
142 | * @return the content type of this stream | ||
143 | * | ||
144 | * @see #FORMAT_UNKNOWN | ||
145 | * @see #FORMAT_VORBIS | ||
146 | * @see #FORMAT_FLAC | ||
147 | * @see #FORMAT_THEORA | ||
148 | */ | ||
149 | |||
150 | public String getFormat(); | ||
151 | } \ No newline at end of file | ||