public int[] values() { int[] result = createArray(_size); for (int i = 0, r = 0; i < storage.length; i++) { if (storage[i] != MIN_VALUE) result[r++] = storage[i]; } return result; }
/** * Parses PAT ( Program Association Table ) * * @param data * @deprecated Use org.jcodec.containers.mps.psi.PAT.parse method instead, * this method will not work correctly for streams with multiple * programs * @return Pid of the first PMT found in the PAT */ @Deprecated public static int parsePAT(ByteBuffer data) { PATSection pat = PATSection.parsePAT(data); if (pat.getPrograms().size() > 0) return pat.getPrograms().values()[0]; else return -1; }
private void replaceRefs(IntIntMap replaceSpec, int guid, ByteBuffer buf, Set<Integer> pmtPids) { if (guid == 0) { PATSection pat = PATSection.parsePAT(buf); for (int pids : pat.getPrograms().values()) { pmtPids.add(pids); } } else if (pmtPids.contains(guid)) { System.out.println(MainUtils.bold("PMT")); PSISection.parsePSI(buf); buf.getShort(); NIOUtils.skip(buf, buf.getShort() & 0xfff); while (buf.remaining() > 4) { byte streamType = buf.get(); MTSStreamType fromTag = MTSStreamType.fromTag(streamType); System.out.print((fromTag == null ? "UNKNOWN" : fromTag) + "(" + String.format("0x%02x", streamType) + "):\t"); int wn = buf.getShort() & 0xffff; int wasPid = wn & 0x1fff; int elementaryPid = replacePid(replaceSpec, wasPid); buf.putShort(buf.position() - 2, (short) ((elementaryPid & 0x1fff) | (wn & ~0x1fff))); NIOUtils.skip(buf, buf.getShort() & 0xfff); } } }
public void writeVLC(BitWriter out, int code) { super.writeVLC(out, self.forward.get(code)); } };
patPkt = pkt; PATSection pat = PATSection.parsePAT(pktRead); int[] values = pat.getPrograms().values(); for (int i = 0; i < values.length; i++) { int pmtPid = values[i];
public int readVLC(BitReader _in) { return self.inverse.get(super.readVLC(_in)); }
public static PATSection parsePAT(ByteBuffer data) { PSISection psi = PSISection.parsePSI(data); IntArrayList networkPids = IntArrayList.createIntArrayList(); IntIntMap programs = new IntIntMap(); while (data.remaining() > 4) { int programNum = data.getShort() & 0xffff; int w = data.getShort(); int pid = w & 0x1fff; if (programNum == 0) networkPids.add(pid); else programs.put(programNum, pid); } return new PATSection(psi, networkPids.toArray(), programs); } }
PATSection pat = PATSection.parsePAT(tsBuf); IntIntMap programs = pat.getPrograms(); pmtPid = programs.values()[0]; printPat(pat); } else if (guid == pmtPid) {
public IntIntMap() { this.storage = createArray(GROW_BY); Arrays.fill(this.storage, MIN_VALUE); }
public int readVLC16(BitReader _in) { return self.inverse.get(super.readVLC16(_in)); }
PATSection pat = PATSection.parsePAT(tsBuf); IntIntMap programs = pat.getPrograms(); pmtPid = programs.values()[0]; printPat(pat); } else if (guid == pmtPid) {
public void put(int key, int val) { if (val == MIN_VALUE) throw new IllegalArgumentException("This implementation can not store " + MIN_VALUE); if (storage.length <= key) { int[] ns = createArray(key + GROW_BY); arraycopy(storage, 0, ns, 0, storage.length); Arrays.fill(ns, storage.length, ns.length, MIN_VALUE); storage = ns; } if (storage[key] == MIN_VALUE) _size++; storage[key] = val; }