javazoom.jl.decoder.Bitstream.closeFrame()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中javazoom.jl.decoder.Bitstream.closeFrame()方法的一些代码示例,展示了Bitstream.closeFrame()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitstream.closeFrame()方法的具体详情如下:
包路径:javazoom.jl.decoder.Bitstream
类名称:Bitstream
方法名:closeFrame

Bitstream.closeFrame介绍

[英]Close MP3 frame.
[中]关闭MP3框架。

代码示例

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();
output.write(outputBuffer.getBuffer(), 0, outputBuffer.reset());

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();
output.write(outputBuffer.getBuffer(), 0, outputBuffer.reset());

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();
output.write(outputBuffer.getBuffer(), 0, outputBuffer.reset());

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();
output.write(outputBuffer.getBuffer(), 0, outputBuffer.reset());

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();

代码示例来源:origin: libgdx/libgdx

bitstream.closeFrame();

代码示例来源:origin: pdudits/soundlibs

/**
 * skips over a single frame
 * @return false    if there are no more frames to decode, true otherwise.
 */
protected boolean skipFrame() throws JavaLayerException
{
  Header h = bitstream.readFrame();
  if (h == null) return false;
  bitstream.closeFrame();
  return true;
}

代码示例来源:origin: tulskiy/musique

private Header skipFrame() throws BitstreamException {
  readFrame = bitstream.readFrame();
  if (readFrame == null) {
    return null;
  }
  bitstream.closeFrame();
  return readFrame;
}

代码示例来源:origin: javazoom/jlayer

/**
 * skips over a single frame
 * @return false    if there are no more frames to decode, true otherwise.
 */
protected boolean skipFrame() throws JavaLayerException
{
  Header h = bitstream.readFrame();
  if (h == null) return false;
  bitstream.closeFrame();
  return true;
}

代码示例来源:origin: com.googlecode.soundlibs/jlayer

/**
 * skips over a single frame
 * @return false    if there are no more frames to decode, true otherwise.
 */
protected boolean skipFrame() throws JavaLayerException
{
  Header h = bitstream.readFrame();
  if (h == null) return false;
  bitstream.closeFrame();
  return true;
}

代码示例来源:origin: tulskiy/musique

/**
 * Construct a IBitstream that reads data from a
 * given InputStream.
 *
 * @param source The InputStream to read from.
 */
public Bitstream(InputStream source) {
  this.source = new PushbackInputStream(
      new BufferedInputStream(source, 30000), BUFFER_INT_SIZE);
  skipID3v2();
  firstframe = true;
  closeFrame();
}

代码示例来源:origin: com.badlogicgames.jlayer/jlayer

/**
 * Construct a IBitstream that reads data from a given InputStream.
 * 
 * @param in The InputStream to read from.
 */
public Bitstream (InputStream in) {
  if (in == null) throw new NullPointerException("in");
  in = new BufferedInputStream(in);
  loadID3v2(in);
  firstframe = true;
  // source = new PushbackInputStream(in, 1024);
  source = new PushbackInputStream(in, BUFFER_INT_SIZE * 4);
  closeFrame();
  // current_frame_number = -1;
  // last_frame_number = -1;
}

代码示例来源:origin: com.googlecode.soundlibs/jlayer

/**
 * Construct a IBitstream that reads data from a
 * given InputStream.
 *
 * @param in    The InputStream to read from.
 */
public Bitstream(InputStream in)
{
  if (in==null) throw new NullPointerException("in");
  in = new BufferedInputStream(in);		
  loadID3v2(in);
  firstframe = true;
  //source = new PushbackInputStream(in, 1024);
  source = new PushbackInputStream(in, BUFFER_INT_SIZE*4);
  
  closeFrame();
  //current_frame_number = -1;
  //last_frame_number = -1;
}

代码示例来源:origin: javazoom/jlayer

/**
 * Construct a IBitstream that reads data from a
 * given InputStream.
 *
 * @param in    The InputStream to read from.
 */
public Bitstream(InputStream in)
{
  if (in==null) throw new NullPointerException("in");
  in = new BufferedInputStream(in);		
  loadID3v2(in);
  firstframe = true;
  //source = new PushbackInputStream(in, 1024);
  source = new PushbackInputStream(in, BUFFER_INT_SIZE*4);
  
  closeFrame();
  //current_frame_number = -1;
  //last_frame_number = -1;
}

代码示例来源:origin: pdudits/soundlibs

/**
 * Construct a IBitstream that reads data from a
 * given InputStream.
 *
 * @param in    The InputStream to read from.
 */
public Bitstream(InputStream in)
{
  if (in==null) throw new NullPointerException("in");
  in = new BufferedInputStream(in);		
  loadID3v2(in);
  firstframe = true;
  //source = new PushbackInputStream(in, 1024);
  source = new PushbackInputStream(in, BUFFER_INT_SIZE*4);
  
  closeFrame();
  //current_frame_number = -1;
  //last_frame_number = -1;
}

代码示例来源:origin: com.threerings/nenya

@Override
public int read (ByteBuffer buf)
  throws IOException
{
  ShortBuffer sbuf = buf.asShortBuffer();
  int total = 0;
  while (sbuf.hasRemaining() && _header != null) {
    if (_buffer == null) {
      try {
        _buffer = (SampleBuffer)_decoder.decodeFrame(_header, _istream);
        _istream.closeFrame();
        _header = _istream.readFrame();
      } catch (JavaLayerException e) {
        throw new IOException(e.toString());
      }
    }
    int blen = _buffer.getBufferLength(),
      length = Math.min(sbuf.remaining(), blen - _offset);
    sbuf.put(_buffer.getBuffer(), _offset, length);
    if ((_offset += length) >= blen) {
      _offset = 0;
      _buffer = null;
    }
    total += (length * 2);
  }
  buf.position(buf.position() + total);
  return total;
}

代码示例来源:origin: threerings/nenya

@Override
public int read (ByteBuffer buf)
  throws IOException
{
  ShortBuffer sbuf = buf.asShortBuffer();
  int total = 0;
  while (sbuf.hasRemaining() && _header != null) {
    if (_buffer == null) {
      try {
        _buffer = (SampleBuffer)_decoder.decodeFrame(_header, _istream);
        _istream.closeFrame();
        _header = _istream.readFrame();
      } catch (JavaLayerException e) {
        throw new IOException(e.toString());
      }
    }
    int blen = _buffer.getBufferLength(),
      length = Math.min(sbuf.remaining(), blen - _offset);
    sbuf.put(_buffer.getBuffer(), _offset, length);
    if ((_offset += length) >= blen) {
      _offset = 0;
      _buffer = null;
    }
    total += (length * 2);
  }
  buf.position(buf.position() + total);
  return total;
}

代码示例来源:origin: com.badlogicgames.jlayer/jlayer

/**
 * Reads and parses the next frame from the input source.
 * @return the Header describing details of the frame read, or null if the end of the stream has been reached.
 */
public Header readFrame () throws BitstreamException {
  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;
}

相关文章