* @return true if the last frame was played, or false if there are more\r
* frames.\r
*/\r
- @LATTICE("T<IN,T*,IN*,THISLOC=T")\r
- @RETURNLOC("T")\r
+ @LATTICE("OUT<THIS,THIS<IN,IN*,THISLOC=THIS")\r
+ @RETURNLOC("OUT")\r
public boolean play(@LOC("IN") int frames) throws JavaLayerException {\r
- @LOC("T") boolean ret = true;\r
- \r
- @LOC("T") int count=0;\r
+ @LOC("OUT") boolean ret = true;\r
+\r
+ // initialization before ssjava loop\r
+ @LOC("THIS,Player.FR") boolean init = true;\r
+ @LOC("THIS,Player.ST") Header h = BitstreamWrapper.readFrame();\r
+ decoder.init(h);\r
+\r
+ @LOC("IN") int count = 0;\r
SSJAVA: while (count++ < 2147483646) {\r
- ret = decodeFrame();\r
- if(!ret){\r
- break;\r
+ ret = decodeFrame(init, h);\r
+ init = false;\r
+ if (!ret) {\r
+ break;\r
}\r
}\r
\r
* @return true if there are no more frames to decode, false otherwise.\r
*/\r
@LATTICE("C<THIS,O<THIS,THIS<IN,C*,THISLOC=THIS,RETURNLOC=O,GLOBALLOC=THIS")\r
- protected boolean decodeFrame() throws JavaLayerException {\r
+ protected boolean decodeFrame(@LOC("THIS,Player.FR") boolean init, @LOC("THIS,Player.ST") Header h)\r
+ throws JavaLayerException {\r
try {\r
// AudioDevice out = audio;\r
// if (out==null)\r
// return false;\r
\r
// Header h = bitstream.readFrame();\r
- @LOC("THIS,Player.ST") Header h = BitstreamWrapper.readFrame();\r
+ if (!init) {\r
+ h = BitstreamWrapper.readFrame();\r
+ }\r
\r
if (h == null)\r
return false;\r
@LOC("C") int sum = 0;\r
@LOC("C") short[] outbuf = SampleBufferWrapper.getBuffer();\r
// short[] outbuf = output.getBuffer();\r
- TERMINATE:\r
- for (@LOC("C") int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {\r
+ TERMINATE: for (@LOC("C") int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {\r
// System.out.println(outbuf[i]);\r
sum += outbuf[i];\r
}\r