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

Header javazoom::jl::decoder::Bitstream::readFrame (  )  throws BitstreamException [inline]

Reads and parses the next frame from the input source.

Returns:
the Header describing details of the frame read, or null if the end of the stream has been reached.

Definition at line 264 of file Bitstream.java.

References closeFrame(), frame_bytes, javazoom::jl::decoder::BitstreamException::getErrorCode(), javazoom::jl::decoder::BitstreamErrors::INVALIDFRAME, javazoom::jl::decoder::Header::parseVBR(), readNextFrame(), and javazoom::jl::decoder::BitstreamErrors::STREAM_EOF.

Referenced by javazoom::jl::player::Player::decodeFrame(), javazoom::jl::player::advanced::AdvancedPlayer::decodeFrame(), and javazoom::jl::player::advanced::AdvancedPlayer::skipFrame().

      {
            Header result = null;
            try
            {
                  result = readNextFrame();
                  // E.B, Parse VBR (if any) first frame.
                  if (firstframe == true)
                  {
                        result.parseVBR(frame_bytes);
                        firstframe = false;
                  }                 
            }
            catch (BitstreamException ex)
            {
                  if ((ex.getErrorCode()==INVALIDFRAME))
                  {
                        // Try to skip this frame.
                        //System.out.println("INVALIDFRAME");
                        try
                        {
                              closeFrame();
                              result = readNextFrame();
                        }
                        catch (BitstreamException e)
                        {
                              if ((e.getErrorCode()!=STREAM_EOF))
                              {
                                    // wrap original exception so stack trace is maintained.
                                    throw newBitstreamException(e.getErrorCode(), e);
                              }
                        }
                  }
                  else if ((ex.getErrorCode()!=STREAM_EOF))
                  {
                        // wrap original exception so stack trace is maintained.
                        throw newBitstreamException(ex.getErrorCode(), ex);
                  }
            }
            return result;
      }


Generated by  Doxygen 1.6.0   Back to index