Exemplo n.º 1
0
 public void beg() {
   oggEncoder.beg();
   oggEncoder.enc(header.toPacket(), 0, 0, false);
   packet = commentHeader.toPacket();
   now = 0;
   granule = 0;
   frames = 0;
   bits.reset();
   this.onEncoderBegin();
 }
Exemplo n.º 2
0
 public void end() {
   Arrays.fill(buffer, now, buffer.length, (short) 0);
   if (now > 0) {
     Arrays.fill(buffer, now, buffer.length, (short) 0);
     frame();
   }
   oggEncoder.enc(packet, 0, granule, true);
   oggEncoder.end();
   this.onEncoderEnd();
 }
Exemplo n.º 3
0
  private void frame() {
    if (spPreprocessor != null) {
      spPreprocessor.run(buffer);
    }

    spEncoder.encode(buffer, bits);
    granule += buffer.length;

    if (++frames < header.getFramesPerPacket()) {
      return;
    }

    frames = 0;
    oggEncoder.enc(packet, 0, granule, false);
    if (onePacketPerPage) {
      oggEncoder.flush(0);
    }

    bits.insertTerminator();
    packet = bits.get(bits.size(), true);
    bits.reset();
  }