public final class Bitstream extends Object
Bistream class is responsible for parsing an MPEG audio bitstream.
REVIEW: much of the parsing currently occurs in the various decoders. This should be moved into this class and
associated inner classes.| Modifier and Type | Field and Description |
|---|---|
static int |
BITSTREAM_ERROR
The first bitstream error code.
|
static int |
BITSTREAM_LAST |
static int |
INVALIDFRAME
Frame data are missing.
|
static int |
STREAM_EOF
The end of the stream was reached.
|
static int |
STREAM_ERROR
A problem occurred reading from the stream.
|
static int |
UNEXPECTED_EOF
The end of the stream was reached prematurely.
|
static int |
UNKNOWN_ERROR
An undeterminable error occurred.
|
static int |
UNKNOWN_SAMPLE_RATE
The header describes an unknown sample rate.
|
| Constructor and Description |
|---|
Bitstream(InputStream in)
Construct a IBitstream that reads data from a given InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the Bitstream.
|
void |
closeFrame()
Close MP3 frame.
|
int |
get_bits(int number_of_bits)
Read bits from buffer into the lower bits of an unsigned int.
|
InputStream |
getRawID3v2()
Return raw ID3v2 frames + header.
|
Float |
getReplayGainScale() |
int |
header_pos()
Return position of the first audio header.
|
boolean |
isSyncCurrentPosition(int syncmode)
Determines if the next 4 bytes of the stream represent a frame header.
|
boolean |
isSyncMark(int headerstring,
int syncmode,
int word) |
protected BitstreamException |
newBitstreamException(int errorcode) |
protected BitstreamException |
newBitstreamException(int errorcode,
Throwable throwable) |
int |
readBits(int n) |
int |
readCheckedBits(int n) |
Header |
readFrame()
Reads and parses the next frame from the input source.
|
void |
unreadFrame()
Unreads the bytes read from the frame.
|
public static final int BITSTREAM_ERROR
DecoderErrors interface for other bitstream error codes.public static final int UNKNOWN_ERROR
public static final int UNKNOWN_SAMPLE_RATE
public static final int STREAM_ERROR
public static final int UNEXPECTED_EOF
public static final int STREAM_EOF
public static final int INVALIDFRAME
public static final int BITSTREAM_LAST
public Bitstream(InputStream in)
in - The InputStream to read from.public int header_pos()
public InputStream getRawID3v2()
public Float getReplayGainScale()
public void close()
throws BitstreamException
BitstreamExceptionpublic Header readFrame() throws BitstreamException
BitstreamExceptionpublic void unreadFrame()
throws BitstreamException
BitstreamExceptionpublic void closeFrame()
public boolean isSyncCurrentPosition(int syncmode)
throws BitstreamException
BitstreamExceptionpublic int readBits(int n)
public int readCheckedBits(int n)
protected BitstreamException newBitstreamException(int errorcode)
protected BitstreamException newBitstreamException(int errorcode, Throwable throwable)
public boolean isSyncMark(int headerstring,
int syncmode,
int word)
public int get_bits(int number_of_bits)
Copyright © 2013. All Rights Reserved.