blob: 2f97b2a72873ca9503557cce30b9954b38537930 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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";
/**
* <i>Note:</i> To read from the stream, you must use either
* this method or the method <code>getNextOggPacket</code>.
* 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;
/**
* <i>Note:</i> To read from the stream, you must use either
* this method or the method <code>getNextOggPage</code>.
* 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 <code>true</code> if this stream is open for reading,
* <code>false</code> 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();
}
|