protected static SL parse(ByteBuffer input, IDescriptorFactory factory) { Assert.assertEquals(0x2, input.get() & 0xff); return new SL(); }
public static MTSPacket parsePacket(ByteBuffer buffer) { int marker = buffer.get() & 0xff; Assert.assertEquals(0x47, marker); int guidFlags = buffer.getShort(); int guid = (int) guidFlags & 0x1fff; int payloadStart = (guidFlags >> 14) & 0x1; int b0 = buffer.get() & 0xff; int counter = b0 & 0xf; if ((b0 & 0x20) != 0) { int taken = 0; taken = (buffer.get() & 0xff) + 1; NIOUtils.skip(buffer, taken - 1); } return new MTSPacket(guid, payloadStart == 1, ((b0 & 0x10) != 0) ? buffer : null); }
@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)); } }
@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)); } }
Assert.assertEquals(0x47, tsPkt[0] & 0xff); int guidFlags = ((tsPkt[1] & 0xff) << 8) | (tsPkt[2] & 0xff); int guid = (int) guidFlags & 0x1fff;
protected void analyseBuffer(ByteBuffer buf, long pos) { while (buf.hasRemaining()) { ByteBuffer tsBuf = NIOUtils.read(buf, 188); pos += 188; Assert.assertEquals(0x47, tsBuf.get() & 0xff); int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff); int guid = (int) guidFlags & 0x1fff; for (int i = 0; i < indexer.indexers.length; i++) { if (guid == indexer.indexers[i].targetGuid) { int payloadStart = (guidFlags >> 14) & 0x1; int b0 = tsBuf.get() & 0xff; int counter = b0 & 0xf; if ((b0 & 0x20) != 0) { NIOUtils.skip(tsBuf, tsBuf.get() & 0xff); } indexer.indexers[i].analyseBuffer(tsBuf, pos - tsBuf.remaining()); } } } }
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 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 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); }
ByteBuffer pkt = NIOUtils.read(buf, TS_PKT_SIZE); ByteBuffer pktRead = pkt.duplicate(); Assert.assertEquals(TS_START_CODE, pktRead.get() & 0xff); ++totalPkt; int guidFlags = ((pktRead.get() & 0xff) << 8) | (pktRead.get() & 0xff);
Assert.assertEquals(0x47, tsBuf.get() & 0xff); ++tsNo; int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff);
while (buf.hasRemaining()) { ByteBuffer tsBuf = NIOUtils.read(buf, 188); Assert.assertEquals(0x47, tsBuf.get() & 0xff); int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff); int guid = guidFlags & 0x1fff;
for (int pkt = 0; buf.hasRemaining(); ++pkt) { ByteBuffer tsBuf = NIOUtils.read(buf, 188); Assert.assertEquals(0x47, tsBuf.get() & 0xff); int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff); int guid = (int) guidFlags & 0x1fff;
@Override public void filter(FloatBuffer[] _in, long[] inPos, FloatBuffer[] out) { if (_in.length != format.getChannels()) { throw new IllegalArgumentException("Channel merge must be supplied with " + format.getChannels() + " input buffers to hold the channels."); } if (out.length != 1) { throw new IllegalArgumentException("Channel merget invoked on more then one output"); } FloatBuffer out0 = out[0]; int min = Integer.MAX_VALUE; for (int i = 0; i < _in.length; i++) { if (_in[i].remaining() < min) min = _in[i].remaining(); } for (int i = 0; i < _in.length; i++) { Assert.assertEquals(_in[i].remaining(), min); } if (out0.remaining() < min * _in.length) throw new IllegalArgumentException("Supplied output buffer is not big enough to hold " + min + " * " + _in.length + " = " + (min * _in.length) + " output samples."); for (int i = 0; i < min; i++) { for (int j = 0; j < _in.length; j++) out0.put(_in[j].get()); } }
ByteBuffer fullPkt = tsBuf.duplicate(); pos += TS_PKT_SIZE; Assert.assertEquals(TS_SYNC_MARKER, tsBuf.get() & 0xff); int guidFlags = ((tsBuf.get() & 0xff) << 8) | (tsBuf.get() & 0xff); int guid = (int) guidFlags & 0x1fff;
public static void main1(String[] args) throws Exception { Cmd cmd = MainUtils.parseArguments(args, ALL_FLAGS); if (cmd.argsLength() < 1) { MainUtils.printHelp(ALL_FLAGS, asList("filename.wav")); System.exit(-1); } File s = new File(args[0]); String pattern = cmd.getStringFlagD(FLAG_PATTERN, "c%02d.wav"); WavHeader wavHeader = WavHeader.read(s); System.out.println("WAV: " + wavHeader.getFormat()); Assert.assertEquals(2, wavHeader.fmt.numChannels); int dataOffset = wavHeader.dataOffset; FileChannelWrapper is = NIOUtils.readableChannel(s); is.setPosition(dataOffset); int channels = wavHeader.getFormat().getChannels(); SeekableByteChannel[] out = new SeekableByteChannel[channels]; for (int i = 0; i < channels; i++) { out[i] = NIOUtils.writableChannel((new File(s.getParentFile(), String.format(pattern, i)))); WavHeader.copyWithChannels(wavHeader, 1).write(out[i]); } copy(wavHeader.getFormat(), is, out); for (int i = 0; i < channels; i++) { out[i].close(); } }
Assert.assertEquals(0, log2OfPartCnt); int partitionsCount = 1; long runningSize = 0; Assert.assertEquals(1, macroBlockNoCoeffSkip); int probSkipFalse = headerDecoder.decodeInt(8); for (int mbRow = 0; mbRow < numberOfMBRows; mbRow++) {
Assert.assertEquals(1, bits.read1Bit()); // Marker