|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.io.InputStream
|
+--mediaframe.mpeg1.audio.player.BigPipedInputStream
The BigPipedInputStream represents the Piped Input Stream.
It receives the input data from a BigPipedOutputStream, puts them into the circle data buffer
and returns when a client requests for the next portion of the data.
This class responds for convertion the audio samples into the uLaw representation for eight-bit eight khz ulaw decoder (browser).
This class implements volume and mute features (multiplies the digital sound data word by a volume value or returns
uLaw zero if the mute equals true).
| Field Summary | |
private short[] |
buffer
The circle buffer of audio samples. |
(package private) boolean |
bufferFilled
True, if the decoding of the audio stream has been finished and the circle buffer has been filled with the audio samples. |
private boolean |
firstPause
True for the first pause in the movie playback (normally if the player doesn't played any frames). |
private int |
inp
The pointer for read in the circle buffer. |
private boolean |
isClosedByReader
True, if the pipe has been already closed by BigPipedInputStream. |
(package private) boolean |
isClosedByWriter
True, if the pipe has been already closed by BigPipedOutputStream. |
private int |
lastOutp
The value of the pointer for write in the circle buffer during last read from the stream. |
static boolean |
mute
The mute state of the audio player. |
private int |
outp
The pointer for write in the circle buffer. |
(package private) BigPipedOutputStream |
outputPipe
The reference to the output stream in the pipe. |
boolean |
playing
True if the audio player is playing the sound, false if the playback is paused. |
static int |
ULAW_BIAS
Constanta used in the linear -> uLaw computation. |
static int |
ULAW_CLIP
Constanta used in the linear -> uLaw computation. |
static int[] |
ULAW_LUT
Table of (roughly) logarithms base 2, used in the linear -> uLaw computation. |
static byte |
ULAW_ZERO
uLaw representation of zero. |
static int |
Volume
The volume of the audio signal. |
private int |
waiting_reader
The amount of threads which waits the reader side. |
private int |
waiting_writer
The amount of threads which waits the writer side. |
| Fields inherited from class java.io.InputStream |
|
| Constructor Summary | |
BigPipedInputStream(int nBufferSize)
Constructs a BigPipedInputStream class with the specified buffer size. |
|
| Method Summary | |
void |
close()
Closes the BigPipedInputStream |
private static int[] |
computeUlawLut()
Compute logarithm (roughly) table used in the linear -> uLaw mapping. |
void |
connect(BigPipedOutputStream src)
Connects this object with the specified BigPipedOutputStream object in the pipe. |
int |
freeInBuffer()
Returns the amount of audio samples that could be placed into the circle buffer. |
void |
notify_reader()
Notifies the reader side for about the next portion of data. |
void |
notify_writer()
Notifies the writer side that the circle buffer is ready for receiving samples. |
int |
read()
Reads uLaw representation of the next sample of sound data from the circle buffer. |
int |
read(byte[] b,
int off,
int len)
Reads uLaw representations of len samples of sound data from the circle buffer
into the array b starting from the offset off.
|
(package private) void |
receive(short b)
Places the next auduo sample into the circle buffer. |
void |
wait_for_reader()
Waits the reader until the circle buffer will be ready for receiving samples. |
void |
wait_for_writer()
Waits the writer for the next portion of data. |
| Methods inherited from class java.io.InputStream |
available, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int inp
private int outp
private int lastOutp
private short[] buffer
boolean isClosedByWriter
BigPipedOutputStream.
private boolean isClosedByReader
BigPipedInputStream.
BigPipedOutputStream outputPipe
public boolean playing
public static int Volume
public static boolean mute
boolean bufferFilled
private boolean firstPause
private int waiting_reader
private int waiting_writer
public static final byte ULAW_ZERO
public static final int ULAW_BIAS
public static final int ULAW_CLIP
public static final int[] ULAW_LUT
| Constructor Detail |
public BigPipedInputStream(int nBufferSize)
BigPipedInputStream class with the specified buffer size.
nBufferSize - the size of a circle buffer.| Method Detail |
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - raises if a error occurs.
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
len samples of sound data from the circle buffer
into the array b starting from the offset off.
Implements the volume feature (multiplies the sample value by a volume value)
or returns uLaw zero value if the mute equals true.
read in class java.io.InputStreamb - the array into which the data is read.off - the start offset in the array b into which the data is written.len - the maximum amount of bytes to read.
java.io.IOException - raises if a error occurs.public int freeInBuffer()
public void connect(BigPipedOutputStream src)
BigPipedOutputStream object in the pipe.
src - the BigPipedOutputStream object.public void close()
BigPipedInputStream
close in class java.io.InputStream
void receive(short b)
throws java.io.IOException
b - the next audio sample.
java.io.IOException - raises if a error occurs.public void notify_writer()
public void wait_for_reader()
throws java.io.InterruptedIOException
java.io.InterruptedIOException - when the current process has been interrupted by the another process.public void notify_reader()
public void wait_for_writer()
throws java.io.InterruptedIOException
java.io.InterruptedIOException - when the current process has been interrupted by the another process.private static int[] computeUlawLut()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||