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

int javazoom::jl::decoder::Bitstream::syncHeader ( byte  syncmode  )  throws BitstreamException [inline, package]

Get next 32 bits from bitstream. They are stored in the headerstring. syncmod allows Synchro flag ID The returned value is False at the end of stream.

Definition at line 423 of file Bitstream.java.

References readBytes(), javazoom::jl::decoder::BitstreamErrors::STREAM_EOF, and syncword.

      {
            boolean sync;
            int headerstring;
            // read additional 2 bytes
            int bytesRead = readBytes(syncbuf, 0, 3);

            if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);

            headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);

            do
            {
                  headerstring <<= 8;

                  if (readBytes(syncbuf, 3, 1)!=1)
                        throw newBitstreamException(STREAM_EOF, null);

                  headerstring |= (syncbuf[3] & 0x000000FF);

                  sync = isSyncMark(headerstring, syncmode, syncword);
            }
            while (!sync);

            //current_frame_number++;
            //if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;

            return headerstring;
      }


Generated by  Doxygen 1.6.0   Back to index