*/\r
\r
\r
-import java.io.InputStream;\r
+//import java.io.InputStream;\r
\r
\r
/**\r
\r
// REVIEW: the audio device should not be opened until the\r
// first MPEG audio frame has been decoded. \r
+@LATTICE("B<DE,DE<ST,DE<HE,HE<ST,ST<FR")\r
public class Player\r
{ \r
/**\r
* The current frame number. \r
*/\r
- private int frame = 0;\r
+ @LOC("FR") private int frame = 0;\r
\r
/**\r
* The MPEG audio bitstream. \r
*/\r
// javac blank final bug. \r
- /*final*/ private Bitstream bitstream;\r
+ /*final*/ @LOC("ST") private Bitstream bitstream;\r
\r
/**\r
* The MPEG audio decoder. \r
*/\r
- /*final*/ private Decoder decoder; \r
+ /*final*/ @LOC("DE") private Decoder decoder; \r
\r
/**\r
* The AudioDevice the audio samples are written to. \r
/**\r
* Has the player been closed?\r
*/\r
- private boolean closed = false;\r
+ @LOC("B") private boolean closed = false;\r
\r
/**\r
* Has the player played back all frames from the stream?\r
*/\r
- private boolean complete = false;\r
+ @LOC("B") private boolean complete = false;\r
\r
- private int lastPosition = 0;\r
+ @LOC("B") private int lastPosition = 0;\r
\r
/**\r
* Creates a new <code>Player</code> instance. \r
*/\r
public Player(InputStream stream) throws JavaLayerException\r
{\r
- //this(stream, null); \r
+ this(stream, null); \r
}\r
\r
- /* temporarily disabled by eom\r
+\r
public Player(InputStream stream, AudioDevice device) throws JavaLayerException\r
{\r
bitstream = new Bitstream(stream); \r
decoder = new Decoder();\r
- \r
- if (device!=null)\r
- { \r
- audio = device;\r
- }\r
- else\r
- { \r
- FactoryRegistry r = FactoryRegistry.systemRegistry();\r
- audio = r.createAudioDevice();\r
- }\r
- audio.open(decoder);\r
+ \r
+// if (device!=null)\r
+// { \r
+// audio = device;\r
+// }\r
+// else\r
+// { \r
+// FactoryRegistry r = FactoryRegistry.systemRegistry();\r
+// audio = r.createAudioDevice();\r
+// }\r
+ \r
+ device.open(decoder);\r
}\r
- */\r
+ \r
\r
public void play() throws JavaLayerException\r
{\r
* @return true if the last frame was played, or false if there are\r
* more frames. \r
*/\r
- public boolean play(int frames) throws JavaLayerException\r
+ @LATTICE("IN<T,IN*,THISLOC=T")\r
+ @RETURNLOC("IN")\r
+ public boolean play(@LOC("IN") int frames) throws JavaLayerException\r
{\r
- boolean ret = true;\r
- \r
- \r
+ @LOC("IN") boolean ret = true;\r
+ \r
+ SSJAVA:\r
while (frames-- > 0 && ret)\r
{\r
- ret = decodeFrame(); \r
+ ret = decodeFrame();\r
}\r
/*\r
if (!ret)\r
* \r
* @return true if there are no more frames to decode, false otherwise.\r
*/\r
+ @LATTICE("O<TH,THISLOC=TH")\r
+ @RETURNLOC("O")\r
protected boolean decodeFrame() throws JavaLayerException\r
{ \r
try\r
return false;\r
\r
// sample buffer set when decoder constructed\r
- SampleBuffer output = (SampleBuffer)decoder.decodeFrame(h, bitstream);\r
+ @LOC("O") SampleBuffer output = (SampleBuffer)decoder.decodeFrame(h, bitstream);\r
\r
//synchronized (this)\r
//{\r
*/ \r
return true;\r
}\r
-\r
\r
}\r