public static void writePascalString(ByteBuffer buffer, String string, int maxLen) { buffer.put((byte) string.length()); buffer.put(asciiString(string)); skip(buffer, maxLen - string.length()); }
public static void writePascalString(ByteBuffer buffer, String string, int maxLen) { buffer.put((byte) string.length()); buffer.put(asciiString(string)); skip(buffer, maxLen - string.length()); }
public static int probe(final ByteBuffer b) { ByteBuffer fork = b.duplicate(); int success = 0; int total = 0; while (fork.remaining() >= 8) { long len = fork.getInt() & 0xffffffffL; int fcc = fork.getInt(); int hdrLen = 8; if (len == 1) { len = fork.getLong(); hdrLen = 16; } else if (len < 8) break; if (fcc == ftyp && len < 64 || fcc == moov && len < 100 * 1024 * 1024 || fcc == free || fcc == mdat || fcc == wide) success++; total++; if (len >= Integer.MAX_VALUE) break; NIOUtils.skip(fork, (int) (len - hdrLen)); } return total == 0 ? 0 : success * 100 / total; } }
public static int probe(final ByteBuffer b) { ByteBuffer fork = b.duplicate(); int success = 0; int total = 0; while (fork.remaining() >= 8) { long len = fork.getInt() & 0xffffffffL; int fcc = fork.getInt(); int hdrLen = 8; if (len == 1) { len = fork.getLong(); hdrLen = 16; } else if (len < 8) break; if (fcc == ftyp && len < 64 || fcc == moov && len < 100 * 1024 * 1024 || fcc == free || fcc == mdat || fcc == wide) success++; total++; if (len >= Integer.MAX_VALUE) break; NIOUtils.skip(fork, (int) (len - hdrLen)); } return total == 0 ? 0 : success * 100 / total; } }
@Override public void parse(ByteBuffer input) { NIOUtils.skip(input, 1); profile = input.get() & 0xff; profileCompat = input.get() & 0xff; level = input.get() & 0xff; int flags = input.get() & 0xff; nalLengthSize = (flags & 0x03) + 1; int nSPS = input.get() & 0x1f; // 3 bits reserved + 5 bits number of // sps for (int i = 0; i < nSPS; i++) { int spsSize = input.getShort(); Assert.assertEquals(0x27, input.get() & 0x3f); spsList.add(NIOUtils.read(input, spsSize - 1)); } int nPPS = input.get() & 0xff; for (int i = 0; i < nPPS; i++) { int ppsSize = input.getShort(); Assert.assertEquals(0x28, input.get() & 0x3f); ppsList.add(NIOUtils.read(input, ppsSize - 1)); } }
@Override public void parse(ByteBuffer input) { NIOUtils.skip(input, 1); profile = input.get() & 0xff; profileCompat = input.get() & 0xff; level = input.get() & 0xff; int flags = input.get() & 0xff; nalLengthSize = (flags & 0x03) + 1; int nSPS = input.get() & 0x1f; // 3 bits reserved + 5 bits number of // sps for (int i = 0; i < nSPS; i++) { int spsSize = input.getShort(); Assert.assertEquals(0x27, input.get() & 0x3f); spsList.add(NIOUtils.read(input, spsSize - 1)); } int nPPS = input.get() & 0xff; for (int i = 0; i < nPPS; i++) { int ppsSize = input.getShort(); Assert.assertEquals(0x28, input.get() & 0x3f); ppsList.add(NIOUtils.read(input, ppsSize - 1)); } }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
public void parse(ByteBuffer input) { super.parse(input); if (version == 0) { created = fromMovTime(input.getInt()); modified = fromMovTime(input.getInt()); timescale = input.getInt(); duration = input.getInt(); } else if (version == 1) { created = fromMovTime((int) input.getLong()); modified = fromMovTime((int) input.getLong()); timescale = input.getInt(); duration = input.getLong(); } else { throw new RuntimeException("Unsupported version"); } rate = readRate(input); volume = readVolume(input); NIOUtils.skip(input, 10); matrix = readMatrix(input); NIOUtils.skip(input, 24); nextTrackId = input.getInt(); }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
public void parse(ByteBuffer input) { super.parse(input); if (version == 0) { created = fromMovTime(input.getInt()); modified = fromMovTime(input.getInt()); timescale = input.getInt(); duration = input.getInt(); } else if (version == 1) { created = fromMovTime((int) input.getLong()); modified = fromMovTime((int) input.getLong()); timescale = input.getInt(); duration = input.getLong(); } else { throw new RuntimeException("Unsupported version"); } rate = readRate(input); volume = readVolume(input); NIOUtils.skip(input, 10); matrix = readMatrix(input); NIOUtils.skip(input, 24); nextTrackId = input.getInt(); }
volumeAttributes = is.getInt(); fsId = is.getShort(); NIOUtils.skip(is, 10);
volumeAttributes = is.getInt(); fsId = is.getShort(); NIOUtils.skip(is, 10);