|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mediaframe.mpeg1.MPEG_Reader
The MPEG_Reader class consists of two buffers, one for video and
one for audio. It starts the "MPEG_Reader" thread and fills these buffers.
It starts rebuffering and calls endOfBuffer method of the applet after the
(re-)buffering process is finished.
| Field Summary | |
private boolean |
_eof
True if the end of the movie has been reached. |
private java.io.InputStream |
_in
The input stream with the movie data. |
private long |
_long
The 4 bytes buffer for the input data. |
private long |
_read_time
The time stamp of the last readed frame. |
private java.lang.Thread |
_thread
The "MPEG_Reader" thread object. |
private int |
_waiting
The number of threads which waits the writer side. |
private DataBuffer |
audioBuffer
The DataBuffer for audio stream. |
static int |
BUFFERING
Constanta, the "buffering" state of the reader. |
static int |
CLOSED
Constanta, the "closed" state of the reader. |
int |
contentLength
The length of the movie file. |
private int |
initBufferSize
Equals to the initial value of the maxBufferSize. |
long |
lastPrintedTime
Last time when the "(re)-buffering" percent was printed. |
int |
loadBytes
The number of bytes loaded into the buffer. |
static long |
MASK
4 bytes mask (0xffffffff). |
int |
maxBufferSize
The number of bytes that should be put into the buffer before the movie playback could start. |
int |
minBufferSize
The minimum number of bytes in the buffer before the "re-buffering" starts. |
private java.lang.Thread |
moribund
The "MPEG_Reader" thread that is being stopped. |
int |
printedPercent
Last printed "(re)-buffering" percent value. |
static int |
READING
Constanta, the "reading" state of the reader. |
static int |
REBUFFERING
Constanta, the "re-buffering" state of the reader. |
int |
reBufferingSize
The number of bytes that should be put into the buffer during the "rebuffering" process. |
private int |
state
Current state of the reader. |
private DataBuffer |
videoBuffer
The DataBuffer for video stream. |
MPEG1 |
videoPlayer
The reference to the main applet object. |
| Constructor Summary | |
MPEG_Reader(MPEG1 videoPlayer,
java.io.InputStream in,
int maxBufferSize,
int minBufferSize,
int contentLength)
Constructs a MPEG_Reader object with the specified parameters
and starts the "MPEG_Reader" thread. |
|
| Method Summary | |
void |
close()
Closes the input stream. |
void |
endOfBuffering()
Invoked when the reader ends buffering and is ready to play the movie. |
void |
endOfReBuffering()
Invoked when the reader ends the "re-buffering" process and is ready to play the movie. |
DataBuffer |
getAudioBuffer()
Gets the audio buffer instance. |
int |
getState()
Returns the state of the reader. |
DataBuffer |
getVideoBuffer()
Gets the video buffer instance. |
boolean |
isEOF()
Returns true if the end of the movie has been reached. |
void |
join()
Waits until the "MPEG_Reader" thread is dead. |
void |
notify_reader()
Notifies the reader side about the next portion of data. |
void |
read_element()
Reads the current frame (audio or video) into the buffer. |
void |
read_to_long()
Reads one byte from the input stream into 4 bytes buffer. |
void |
run()
Start point and main loop of the "MPEG_Reader" thread. |
void |
startRebuffering()
Starts the "re-buffering" process. |
void |
stop()
Stops the "MPEG_Reader" thread. |
void |
wait_for_read()
Waits the writer for the next block of data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final long MASK
public int loadBytes
public static final int BUFFERING
public static final int REBUFFERING
public static final int READING
public static final int CLOSED
private int state
public int maxBufferSize
public int minBufferSize
public int reBufferingSize
private int initBufferSize
maxBufferSize.
public int contentLength
public int printedPercent
public long lastPrintedTime
public MPEG1 videoPlayer
private DataBuffer audioBuffer
DataBuffer for audio stream.
private DataBuffer videoBuffer
DataBuffer for video stream.
private long _long
private boolean _eof
private int _waiting
private volatile java.lang.Thread _thread
private java.io.InputStream _in
private long _read_time
private volatile java.lang.Thread moribund
| Constructor Detail |
public MPEG_Reader(MPEG1 videoPlayer,
java.io.InputStream in,
int maxBufferSize,
int minBufferSize,
int contentLength)
MPEG_Reader object with the specified parameters
and starts the "MPEG_Reader" thread.
videoPlayer - the reference to the main applet object.in - the input stream with the movie data.maxBufferSize - the number of bytes that should be put into the buffer
before the movie playback could start.minBufferSize - the minimum number of bytes in the buffer before the "re-buffering" starts.contentLength - the length of the movie file.| Method Detail |
public void read_element()
throws java.lang.Exception
java.lang.Exception - if an error occurs.
public void read_to_long()
throws java.lang.Exception
java.lang.Exception - if an error occurs.public void run()
run in interface java.lang.Runnable
public void wait_for_read()
throws java.lang.InterruptedException
java.lang.InterruptedException - if another process interrupts this process.public void notify_reader()
public void stop()
public void join()
public void close()
public void endOfBuffering()
public void startRebuffering()
public void endOfReBuffering()
public DataBuffer getAudioBuffer()
public DataBuffer getVideoBuffer()
public boolean isEOF()
public int getState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||