Java Code Examples for com.google.android.exoplayer2.util.ParsableByteArray#readUtf8EncodedLong()

The following examples show how to use com.google.android.exoplayer2.util.ParsableByteArray#readUtf8EncodedLong() . 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: FlacReader.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
    default:
      return -1;
  }
}
 
Example 2
Source File: FlacReader.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
    default:
      return -1;
  }
}
 
Example 3
Source File: FlacReader.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
    default:
      return -1;
  }
}
 
Example 4
Source File: FlacReader.java    From K-Sonic with MIT License 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
  }
  return -1;
}
 
Example 5
Source File: FlacReader.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
    default:
      return -1;
  }
}
 
Example 6
Source File: FlacReader.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private int getFlacFrameBlockSize(ParsableByteArray packet) {
  int blockSizeCode = (packet.data[2] & 0xFF) >> 4;
  switch (blockSizeCode) {
    case 1:
      return 192;
    case 2:
    case 3:
    case 4:
    case 5:
      return 576 << (blockSizeCode - 2);
    case 6:
    case 7:
      // skip the sample number
      packet.skipBytes(FRAME_HEADER_SAMPLE_NUMBER_OFFSET);
      packet.readUtf8EncodedLong();
      int value = blockSizeCode == 6 ? packet.readUnsignedByte() : packet.readUnsignedShort();
      packet.setPosition(0);
      return value + 1;
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
    case 15:
      return 256 << (blockSizeCode - 8);
    default:
      return -1;
  }
}