get rid of the stream parsing that occurs in the Layer III decoder. BitStream.readFra...
[IRC.git] / Robust / src / Tests / ssJava / mp3decoder / Player.java
index 90c4fc2c1154c43be8844ecde40e7e7487422714..75d5863b5e07491e711e22bbcef88f301a7777d1 100644 (file)
 \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
@@ -58,14 +59,14 @@ public class Player
        /**\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
@@ -80,7 +81,7 @@ public class Player
        {\r
                bitstream = new Bitstream(stream);              \r
                decoder = new Decoder();\r
-                               \r
+               \r
 //             if (device!=null)\r
 //             {               \r
 //                     audio = device;\r
@@ -107,14 +108,16 @@ public class Player
         * @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
-           SSJAVA:\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
@@ -199,6 +202,8 @@ public class Player
         * \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
@@ -213,7 +218,7 @@ public class Player
                                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