javazoom.jl.decoder.DecoderException Java Examples
The following examples show how to use
javazoom.jl.decoder.DecoderException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Mp3InputStream.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
@Override public int read() throws IOException { if (atEnd()) return -1; while (bpos / 2 >= bufLen) { try { header = bitstream.readFrame(); if (header == null) { buf.clear_buffer(); endOfStream = true; return -1; } buf.clear_buffer(); decoder.decodeFrame(header, bitstream); bufLen = buf.getBufferLength(); bitstream.closeFrame(); } catch (DecoderException | BitstreamException e) { Log.error(e); } bpos = 0; } int npos = bpos / 2; bpos++; if (bpos % 2 == 0) return (buf.getBuffer()[npos] >> 8) & 0xff; else return (buf.getBuffer()[npos]) & 0xff; }
Example #2
Source File: Mp3InputStream.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
@Override public long skip(long length) { if (bufLen <= 0) Log.warn("Mp3InputStream: skip: bufLen not yet determined."); int skipped = 0; while (skipped + bufLen * 2 < length) { try { header = bitstream.readFrame(); if (header == null) { // Log.warn("Mp3InputStream: skip: header is null."); endOfStream = true; return -1; } // last frame that won't be skipped so better read it if (skipped + bufLen * 2 * 4 >= length || bufLen <= 0) { buf.clear_buffer(); decoder.decodeFrame(header, bitstream); bufLen = buf.getBufferLength(); } skipped += bufLen * 2 - bpos; bitstream.closeFrame(); bpos = 0; } catch (BitstreamException | DecoderException e) { Log.error(e); } } if (bufLen * 2 - bpos > length - skipped) { bpos += length - skipped; skipped += length - skipped; } return skipped; }
Example #3
Source File: Mp3InputStream.java From opsu with GNU General Public License v3.0 | 5 votes |
@Override public int read() throws IOException { if (atEnd()) return -1; while (bpos / 2 >= bufLen) { try { header = bitstream.readFrame(); if (header == null) { buf.clear_buffer(); endOfStream = true; return -1; } buf.clear_buffer(); decoder.decodeFrame(header, bitstream); bufLen = buf.getBufferLength(); bitstream.closeFrame(); } catch (DecoderException | BitstreamException e) { Log.error(e); } bpos = 0; } int npos = bpos / 2; bpos++; if (bpos % 2 == 0) return (buf.getBuffer()[npos] >> 8) & 0xff; else return (buf.getBuffer()[npos]) & 0xff; }
Example #4
Source File: Mp3InputStream.java From opsu with GNU General Public License v3.0 | 5 votes |
@Override public long skip(long length) { if (bufLen <= 0) Log.warn("Mp3InputStream: skip: bufLen not yet determined."); int skipped = 0; while (skipped + bufLen * 2 < length) { try { header = bitstream.readFrame(); if (header == null) { // Log.warn("Mp3InputStream: skip: header is null."); endOfStream = true; return -1; } // last frame that won't be skipped so better read it if (skipped + bufLen * 2 * 4 >= length || bufLen <= 0) { buf.clear_buffer(); decoder.decodeFrame(header, bitstream); bufLen = buf.getBufferLength(); } skipped += bufLen * 2 - bpos; bitstream.closeFrame(); bpos = 0; } catch (BitstreamException | DecoderException e) { Log.error(e); } } if (bufLen * 2 - bpos > length - skipped) { bpos += length - skipped; skipped += length - skipped; } return skipped; }