public class MP3Stream extends PushbackInputStream
A specialized stream class which can be used to extract single frames of MPEG audio files.
Instances of this class are constructed with an underlying stream which should point to an audio file. Read operations are possible in the usual way. However, there are special methods for searching and extracting headers of MPEG frames. Some meta information of frames can be queried.
This class was copied from Apache Tika and modified for Red5.buf, posin| Constructor and Description |
|---|
MP3Stream(InputStream in)
Creates a new instance of
MpegStream and initializes it with the underlying stream. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
eos() |
org.apache.tika.parser.mp3.AudioFrame |
nextFrame()
Searches for the next MPEG frame header from the current stream position on.
|
boolean |
skipFrame()
Skips the current MPEG frame.
|
available, close, mark, markSupported, read, read, reset, skip, unread, unread, unreadreadpublic MP3Stream(InputStream in)
MpegStream and initializes it with the underlying stream.in - the underlying audio streampublic boolean eos()
public org.apache.tika.parser.mp3.AudioFrame nextFrame()
throws IOException
AudioFrame object is created. In the latter case there are no more headers, so the end of the stream is probably reached.AudioFrame or nullIOException - if an IO error occurspublic boolean skipFrame()
throws IOException
nextFrame(). In this case the underlying stream is advanced to the end of the associated MPEG frame. Otherwise, this method has no effect. The return value indicates whether a frame could be skipped.IOException - if an IO error occursCopyright © 2005–2017 Red5. All rights reserved.