Пример #1
0
  /**
   * Open callbacks.
   *
   * @param is input stream
   * @param initial initial bytes
   * @param ibytes initial count
   * @return success flag
   * @throws JOrbisException if an error occurs
   */
  int openCallbacks(InputStream is, byte[] initial, int ibytes) throws JOrbisException {
    int ret;
    datasource = is;

    oy.init();

    // perhaps some data was previously read into a buffer for testing
    // against other stream types. Allow initialization from this
    // previously read data (as we may be reading from a non-seekable
    // stream)
    if (initial != null) {
      int index = oy.buffer(ibytes);
      System.arraycopy(initial, 0, oy.data, index, ibytes);
      oy.wrote(ibytes);
    }
    // can we seek? Stevens suggests the seek test was portable
    if (is instanceof SeekableInputStream) {
      ret = openSeekable();
    } else {
      ret = openNonseekable();
    }
    if (ret != 0) {
      datasource = null;
      clear();
    }
    return ret;
  }
 /** Initializes all the jOrbis and jOgg vars that are used for song playback. */
 private void init_jorbis() {
   oggSyncState_ = new SyncState();
   oggStreamState_ = new StreamState();
   oggPage_ = new Page();
   oggPacket_ = new Packet();
   vorbisInfo = new Info();
   vorbisComment = new Comment();
   vorbisDspState = new DspState();
   vorbisBlock = new Block(vorbisDspState);
   buffer = null;
   bytes = 0;
   oggSyncState_.init();
 }
Пример #3
0
  /*
   * Taken from the JOrbis Player
   */
  private void initJOrbis() {
    oy = new SyncState();
    os = new StreamState();
    og = new Page();
    op = new Packet();

    vi = new Info();
    vc = new Comment();
    vd = new DspState();
    vb = new Block(vd);

    buffer = null;
    bytes = 0;

    oy.init();
  }