*/\r
\r
\r
-import java.io.InputStream;\r
+//import java.io.InputStream;\r
\r
\r
/**\r
\r
private int lastPosition = 0;\r
\r
+ private Header header;\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
+ // decoder initialization\r
+ // taking out from ssjava loop \r
+ header = bitstream.readFrame(); \r
+ decoder.initialize(header, bitstream);\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
+// 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
{\r
boolean ret = true;\r
\r
- SSJAVA:\r
+ SSJAVA:\r
while (frames-- > 0 && ret)\r
{\r
ret = decodeFrame(); \r
//if (out==null)\r
// return false;\r
\r
- Header h = bitstream.readFrame(); \r
- \r
- if (h==null)\r
- return false;\r
+// Header h = bitstream.readFrame(); \r
+// \r
+// if (h==null)\r
+// return false;\r
\r
// sample buffer set when decoder constructed\r
- SampleBuffer output = (SampleBuffer)decoder.decodeFrame(h, bitstream);\r
+ SampleBuffer output = (SampleBuffer)decoder.decodeFrame(header, bitstream);\r
\r
//synchronized (this)\r
//{\r
*/ \r
return true;\r
}\r
-\r
\r
}\r