|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mediaframe.mpeg1.audio.player.Player
The Player class implements a simple player for playback
of an MPEG audio stream.
| Field Summary | |
private MPEG1 |
_pech
The reference to the video applet. |
private static boolean |
_soundChecked
True, if the audio device detection has been already done. |
private static boolean |
_soundEnabled
True, if the player has detected the suitable audio device for the current VM and able to play the sound. |
private boolean |
_stopped
True, if the audio player is stopped. |
private AudioDevice |
audio
The AudioDevice the audio samples are written to. |
private java.lang.Thread |
audio_thread
The "Audio Decoder" thread object. |
private io_tool |
bitstream
The MPEG audio bitstream. |
private mediaframe.mpeg1.audio.decoder.Crc16[] |
crc
The 16-Bit CRC checksum of the MPEG audio bitstream. |
private mediaframe.mpeg1.audio.decoder.Decoder |
decoder
The MPEG audio decoder. |
private mediaframe.mpeg1.audio.decoder.Header |
header
The Audio header of the MPEG stream. |
private java.lang.Thread |
moribund
The "Audio Decoder" thread that is being stopped. |
| Constructor Summary | |
Player(io_tool stream,
MPEG1 pl)
Creates a new Player instance with the specified MPEG audio bitstream and
the reference to the video applet. |
|
| Method Summary | |
protected boolean |
decodeFrame()
Decodes a single frame. |
static boolean |
isSoundEnabled()
Returns true, if the player has detected the suitable audio device for the current VM and able to play the sound. |
boolean |
isStopped()
Returns true, if the audio playback is stopped. |
void |
join()
Waits until the audio process is dead. |
void |
pause()
Pause the Audio Player. |
void |
play()
Turns on audio output device. |
void |
run()
Decodes the MPEG audio bitstream (calls in the loop the decodeFrame() method for each audio frame).
|
void |
setMute(boolean mute)
Sets the mute state of the audio player. |
void |
setVolume(float volume)
Sets the volume (in the range 0..1) of the audio player. |
void |
start()
Starts the "Audio Decoder" thread. |
void |
stop()
Closes this player. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private io_tool bitstream
private mediaframe.mpeg1.audio.decoder.Decoder decoder
private AudioDevice audio
AudioDevice the audio samples are written to.
private final mediaframe.mpeg1.audio.decoder.Header header
private mediaframe.mpeg1.audio.decoder.Crc16[] crc
private volatile java.lang.Thread audio_thread
private MPEG1 _pech
private boolean _stopped
private static boolean _soundChecked
private static boolean _soundEnabled
private java.lang.Thread moribund
| Constructor Detail |
public Player(io_tool stream,
MPEG1 pl)
Player instance with the specified MPEG audio bitstream and
the reference to the video applet.
stream - the MPEG audio bitstream.pl - the reference to the video applet.| Method Detail |
public void start()
public void run()
decodeFrame() method for each audio frame).
This method is called by the JRE after the "Audio Decoder" thread is started.
run in interface java.lang.Runnablepublic void play()
public void stop()
public void join()
public void pause()
protected boolean decodeFrame()
throws mediaframe.mpeg1.audio.decoder.JavaLayerException,
java.lang.InterruptedException
mediaframe.mpeg1.audio.decoder.JavaLayerException - if the decoder could not decode the audio frame.
java.lang.InterruptedException - if another process interrupts the current process.public boolean isStopped()
public void setMute(boolean mute)
mute - the mute state (true, if the mute on and the player don't play the audio).public void setVolume(float volume)
volume - the volume to set.public static boolean isSoundEnabled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||