Logo Search packages:      
Sourcecode: libjlayer-java version File versions  Download package

boolean javazoom::jl::player::advanced::AdvancedPlayer::decodeFrame (  )  throws JavaLayerException [inline, protected]

Decodes a single frame.

Returns:
true if there are no more frames to decode, false otherwise.

Definition at line 145 of file AdvancedPlayer.java.

References audio, bitstream, javazoom::jl::decoder::Bitstream::closeFrame(), javazoom::jl::decoder::Decoder::decodeFrame(), decoder, javazoom::jl::decoder::SampleBuffer::getBuffer(), javazoom::jl::decoder::SampleBuffer::getBufferLength(), javazoom::jl::decoder::Bitstream::readFrame(), and javazoom::jl::player::AudioDevice::write().

Referenced by play().

      {
            try
            {
                  AudioDevice out = audio;
                  if (out == null) return false;

                  Header h = bitstream.readFrame();
                  if (h == null) return false;

                  // sample buffer set when decoder constructed
                  SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);

                  synchronized (this)
                  {
                        out = audio;
                        if(out != null)
                        {
                              out.write(output.getBuffer(), 0, output.getBufferLength());
                        }
                  }

                  bitstream.closeFrame();
            }
            catch (RuntimeException ex)
            {
                  throw new JavaLayerException("Exception decoding audio frame", ex);
            }
            return true;
      }


Generated by  Doxygen 1.6.0   Back to index