/** * Peeks a variable-length unsigned EBML integer from the input. */ private long readUint(ExtractorInput input) throws IOException, InterruptedException { input.peekFully(scratch.data, 0, 1); int value = scratch.data[0] & 0xFF; if (value == 0) { return Long.MIN_VALUE; } int mask = 0x80; int length = 0; while ((value & mask) == 0) { mask >>= 1; length++; } value &= ~mask; input.peekFully(scratch.data, 1, length); for (int i = 0; i < length; i++) { value <<= 8; value += scratch.data[i + 1] & 0xFF; } peekLength += length + 1; return value; }
@Override public boolean sniff(ExtractorInput input) throws IOException, InterruptedException { byte[] scratch = new byte[1]; for (int i = 0; i < 5; i++) { input.peekFully(scratch, 0, 1); if ((scratch[0] & 0xFF) != 0x47) { return false; } input.advancePeekPosition(TS_PACKET_SIZE - 1); } return true; }
@Override public boolean sniff(ExtractorInput input) throws IOException, InterruptedException { ParsableByteArray scratch = new ParsableByteArray(10); input.peekFully(scratch.data, 0, 10); int value = scratch.readUnsignedInt24(); if (value != Util.getIntegerCodeForString("ID3")) { value = value >> 8; } else { int length = (scratch.data[6] & 0x7F) << 21 | ((scratch.data[7] & 0x7F) << 14) | ((scratch.data[8] & 0x7F) << 7) | (scratch.data[9] & 0x7F); input.advancePeekPosition(length); input.peekFully(scratch.data, 0, 2); scratch.setPosition(0); value = scratch.readUnsignedShort(); } return (value & 0xFFF6) == 0xFFF0; }
input.peekFully(buffer.data, 0, headerSize); buffer.setPosition(0); long atomSize = buffer.readUnsignedInt(); int atomType = buffer.readInt(); if (atomSize == Atom.LONG_SIZE_PREFIX) { input.peekFully(buffer.data, headerSize, Atom.LONG_HEADER_SIZE - headerSize); headerSize = Atom.LONG_HEADER_SIZE; atomSize = buffer.readLong(); input.peekFully(buffer.data, 0, 4 * (compatibleBrandsCount + 2)); for (int i = 0; i < compatibleBrandsCount + 2; i++) { if (i == 1) {
int startPosition = 0; while (true) { input.peekFully(scratch.data, 0, 3); scratch.setPosition(0); if (scratch.readUnsignedInt24() != ID3_TAG) { input.peekFully(scratch.data, 0, 4); int headerLength = ((scratch.data[0] & 0x7F) << 21) | ((scratch.data[1] & 0x7F) << 14) | ((scratch.data[2] & 0x7F) << 7) | (scratch.data[3] & 0x7F); input.peekFully(scratch.data, 0, 4); scratch.setPosition(0); int headerData = scratch.readInt();