Java 类com.google.android.exoplayer.text.eia608.Eia608Parser 实例源码

项目:miku    文件:SeiReader.java   
@Override
public void consume(ParsableByteArray seiBuffer, long pesTimeUs, boolean startOfPacket) {
  int b;
  while (seiBuffer.bytesLeft() > 1 /* last byte will be rbsp_trailing_bits */) {
    // Parse payload type.
    int payloadType = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadType += b;
    } while (b == 0xFF);
    // Parse payload size.
    int payloadSize = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadSize += b;
    } while (b == 0xFF);
    // Process the payload. We only support EIA-608 payloads currently.
    if (Eia608Parser.isSeiMessageEia608(payloadType, payloadSize, seiBuffer)) {
      output.sampleData(seiBuffer, payloadSize);
      output.sampleMetadata(pesTimeUs, C.SAMPLE_FLAG_SYNC, payloadSize, 0, null);
    } else {
      seiBuffer.skipBytes(payloadSize);
    }
  }
}
项目:ExoPlayer-Demo    文件:SeiReader.java   
public void consume(long pesTimeUs, ParsableByteArray seiBuffer) {
  int b;
  while (seiBuffer.bytesLeft() > 1 /* last byte will be rbsp_trailing_bits */) {
    // Parse payload type.
    int payloadType = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadType += b;
    } while (b == 0xFF);
    // Parse payload size.
    int payloadSize = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadSize += b;
    } while (b == 0xFF);
    // Process the payload.
    if (Eia608Parser.isSeiMessageEia608(payloadType, payloadSize, seiBuffer)) {
      output.sampleData(seiBuffer, payloadSize);
      output.sampleMetadata(pesTimeUs, C.SAMPLE_FLAG_SYNC, payloadSize, 0, null);
    } else {
      seiBuffer.skipBytes(payloadSize);
    }
  }
}
项目:ExoPlayer    文件:SeiReader.java   
@Override
public void consume(ParsableByteArray seiBuffer, long pesTimeUs, boolean startOfPacket) {
  int b;
  while (seiBuffer.bytesLeft() > 1 /* last byte will be rbsp_trailing_bits */) {
    // Parse payload type.
    int payloadType = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadType += b;
    } while (b == 0xFF);
    // Parse payload size.
    int payloadSize = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadSize += b;
    } while (b == 0xFF);
    // Process the payload. We only support EIA-608 payloads currently.
    if (Eia608Parser.isSeiMessageEia608(payloadType, payloadSize, seiBuffer)) {
      output.sampleData(seiBuffer, payloadSize);
      output.sampleMetadata(pesTimeUs, C.SAMPLE_FLAG_SYNC, payloadSize, 0, null);
    } else {
      seiBuffer.skipBytes(payloadSize);
    }
  }
}
项目:Exoplayer_VLC    文件:SeiReader.java   
public void read(byte[] data, int position, int limit, long pesTimeUs) {
  seiBuffer.reset(data, limit);
  // Skip the NAL prefix and type.
  seiBuffer.setPosition(position + 4);

  int b;
  while (seiBuffer.bytesLeft() > 1 /* last byte will be rbsp_trailing_bits */) {
    // Parse payload type.
    int payloadType = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadType += b;
    } while (b == 0xFF);
    // Parse payload size.
    int payloadSize = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadSize += b;
    } while (b == 0xFF);
    // Process the payload. We only support EIA-608 payloads currently.
    if (Eia608Parser.inspectSeiMessage(payloadType, payloadSize, seiBuffer)) {
      startSample(pesTimeUs);
      appendData(seiBuffer, payloadSize);
      commitSample(true);
    } else {
      seiBuffer.skip(payloadSize);
    }
  }
}
项目:Exoplayer_VLC    文件:SeiReader.java   
public void read(byte[] data, int position, int limit, long pesTimeUs) {
  seiBuffer.reset(data, limit);
  // Skip the NAL prefix and type.
  seiBuffer.setPosition(position + 4);

  int b;
  while (seiBuffer.bytesLeft() > 1 /* last byte will be rbsp_trailing_bits */) {
    // Parse payload type.
    int payloadType = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadType += b;
    } while (b == 0xFF);
    // Parse payload size.
    int payloadSize = 0;
    do {
      b = seiBuffer.readUnsignedByte();
      payloadSize += b;
    } while (b == 0xFF);
    // Process the payload. We only support EIA-608 payloads currently.
    if (Eia608Parser.inspectSeiMessage(payloadType, payloadSize, seiBuffer)) {
      startSample(pesTimeUs);
      appendData(seiBuffer, payloadSize);
      commitSample(true);
    } else {
      seiBuffer.skip(payloadSize);
    }
  }
}